From 69743fb6782f9b40a459ce1d69bd4daef2e691fc Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Sun, 27 Jan 2019 21:51:14 -0800 Subject: [PATCH] New upstream version 1.32.0+dfsg1 --- Cargo.lock | 96 ++-- RELEASES.md | 309 +++++++++++++ git-commit-hash | 2 +- src/ci/docker/dist-i686-linux/Dockerfile | 2 +- src/ci/docker/dist-x86_64-linux/Dockerfile | 2 +- .../docker/dist-x86_64-linux/build-clang.sh | 2 +- src/ci/docker/mingw-check/Dockerfile | 3 +- src/ci/docker/scripts/musl.sh | 2 +- src/ci/run.sh | 2 +- src/doc/book/redirects/attributes.md | 2 +- src/doc/book/redirects/bibliography.md | 4 +- src/doc/book/redirects/borrow-and-asref.md | 4 +- .../book/redirects/casting-between-types.md | 6 +- .../redirects/choosing-your-guarantees.md | 6 +- src/doc/book/redirects/closures.md | 6 +- src/doc/book/redirects/comments.md | 6 +- src/doc/book/redirects/concurrency.md | 6 +- .../book/redirects/conditional-compilation.md | 4 +- src/doc/book/redirects/crates-and-modules.md | 10 +- src/doc/book/redirects/deref-coercions.md | 6 +- src/doc/book/redirects/drop.md | 6 +- src/doc/book/redirects/effective-rust.md | 4 +- src/doc/book/redirects/enums.md | 6 +- src/doc/book/redirects/error-handling.md | 6 +- src/doc/book/redirects/functions.md | 6 +- src/doc/book/redirects/generics.md | 6 +- src/doc/book/redirects/getting-started.md | 6 +- src/doc/book/redirects/glossary.md | 4 +- src/doc/book/redirects/guessing-game.md | 6 +- src/doc/book/redirects/if-let.md | 7 +- src/doc/book/redirects/iterators.md | 6 +- src/doc/book/redirects/lifetimes.md | 10 +- src/doc/book/redirects/macros.md | 6 +- src/doc/book/redirects/match.md | 10 +- src/doc/book/redirects/method-syntax.md | 6 +- src/doc/book/redirects/mutability.md | 6 +- src/doc/book/redirects/ownership.md | 6 +- src/doc/book/redirects/primitive-types.md | 6 +- src/doc/book/redirects/procedural-macros.md | 10 +- .../redirects/references-and-borrowing.md | 6 +- src/doc/book/redirects/release-channels.md | 6 +- src/doc/book/redirects/structs.md | 4 +- .../book/redirects/syntax-and-semantics.md | 14 +- src/doc/book/redirects/syntax-index.md | 11 +- src/doc/book/redirects/testing.md | 6 +- src/doc/book/redirects/trait-objects.md | 6 +- src/doc/book/redirects/traits.md | 10 +- src/doc/book/redirects/unsafe.md | 6 +- ...using-rust-without-the-standard-library.md | 2 +- src/doc/book/redirects/vectors.md | 6 +- .../book/src/appendix-03-derivable-traits.md | 2 +- src/doc/book/src/ch00-00-introduction.md | 2 +- .../src/ch02-00-guessing-game-tutorial.md | 79 ++-- .../src/ch03-01-variables-and-mutability.md | 26 +- src/doc/book/src/ch03-02-data-types.md | 4 +- .../book/src/ch03-03-how-functions-work.md | 8 +- src/doc/book/src/ch03-04-comments.md | 6 +- src/doc/book/src/ch03-05-control-flow.md | 22 +- src/doc/book/src/ch04-01-what-is-ownership.md | 30 +- .../src/ch04-02-references-and-borrowing.md | 17 +- src/doc/book/src/ch04-03-slices.md | 35 +- src/doc/book/src/ch05-01-defining-structs.md | 20 +- src/doc/book/src/ch05-02-example-structs.md | 23 +- src/doc/book/src/ch05-03-method-syntax.md | 10 +- src/doc/book/src/ch06-01-defining-an-enum.md | 6 +- src/doc/book/src/ch06-02-match.md | 10 +- src/doc/book/src/ch06-03-if-let.md | 18 +- src/doc/book/src/ch08-01-vectors.md | 62 ++- src/doc/book/src/ch08-02-strings.md | 28 +- src/doc/book/src/ch08-03-hash-maps.md | 48 +- ...ch09-01-unrecoverable-errors-with-panic.md | 24 +- .../ch09-02-recoverable-errors-with-result.md | 40 +- .../src/ch14-02-publishing-to-crates-io.md | 1 + .../book/src/ch15-05-interior-mutability.md | 10 +- src/doc/book/src/ch18-03-pattern-syntax.md | 2 +- src/doc/book/src/ch19-06-macros.md | 10 +- src/librustc/hir/def.rs | 2 +- src/librustc/traits/auto_trait.rs | 98 +++- src/librustc/traits/object_safety.rs | 52 ++- src/librustc/ty/mod.rs | 96 ++-- src/librustc_codegen_ssa/Cargo.toml | 2 +- src/librustc_codegen_ssa/mir/place.rs | 13 +- src/librustc_codegen_ssa/mir/rvalue.rs | 3 +- .../borrow_check/nll/type_check/mod.rs | 2 +- src/librustc_mir/interpret/machine.rs | 2 +- src/librustc_mir/interpret/memory.rs | 9 +- src/librustc_mir/transform/qualify_consts.rs | 2 +- src/librustc_resolve/build_reduced_graph.rs | 9 +- src/librustc_resolve/lib.rs | 43 +- src/librustc_resolve/macros.rs | 61 ++- src/librustc_resolve/resolve_imports.rs | 66 ++- src/librustc_typeck/astconv.rs | 28 +- src/librustc_typeck/check/callee.rs | 2 +- src/librustc_typeck/check/mod.rs | 82 +++- src/librustdoc/html/static/rustdoc.css | 6 +- src/librustdoc/test.rs | 51 ++- src/libsyntax/feature_gate.rs | 7 +- src/rustllvm/llvm-rebuild-trigger | 2 +- src/stage0.txt | 4 +- src/test/codegen/issue-56927.rs | 44 ++ src/test/codegen/packed.rs | 36 ++ src/test/run-pass/issue-56237.rs | 11 + .../uniform-paths/auxiliary/issue-53691.rs | 2 - .../run-pass/uniform-paths/basic-nested.rs | 18 +- src/test/run-pass/uniform-paths/basic.rs | 6 +- .../run-pass/uniform-paths/macros-nested.rs | 16 +- src/test/run-pass/uniform-paths/macros.rs | 16 +- src/test/run-pass/uniform-paths/same-crate.rs | 3 - src/test/rustdoc/issue-50159.rs | 31 ++ .../issue-56822.rs} | 35 +- .../synthetic_auto/self-referential.rs | 40 ++ src/test/ui/consts/promoted_regression.rs | 9 + .../consts/static_mut_containing_mut_ref.rs | 7 + .../consts/static_mut_containing_mut_ref2.rs | 8 + .../static_mut_containing_mut_ref2.stderr | 9 + .../consts/static_mut_containing_mut_ref3.rs | 8 + .../static_mut_containing_mut_ref3.stderr | 9 + src/test/ui/editions/edition-imports-2015.rs | 2 - .../ui/editions/edition-imports-2015.stderr | 2 +- .../edition-imports-virtual-2015-gated.stderr | 4 +- .../feature-gate-uniform-paths.stderr | 62 --- src/test/ui/imports/duplicate.rs | 2 +- src/test/ui/imports/duplicate.stderr | 21 +- src/test/ui/imports/issue-56125.rs | 2 - src/test/ui/imports/issue-56125.stderr | 26 +- src/test/ui/imports/issue-57015.rs | 13 + src/test/ui/imports/issue-57015.stderr | 9 + src/test/ui/issues/issue-56199.rs | 23 + src/test/ui/issues/issue-56199.stderr | 30 ++ src/test/ui/issues/issue-56835.rs | 10 + src/test/ui/issues/issue-56835.stderr | 15 + src/test/ui/issues/issue-57156.rs | 23 + .../nll/issue-57265-return-type-wf-check.rs | 26 ++ .../issue-57265-return-type-wf-check.stderr | 12 + .../ui/proc-macro/derive-helper-shadowing.rs | 19 +- .../not-whitelisted.rs | 2 - .../not-whitelisted.stderr | 4 +- .../ui/rust-2018/future-proofing-locals.rs | 5 +- .../rust-2018/future-proofing-locals.stderr | 24 +- .../rust-2018/local-path-suggestions-2018.rs | 2 - .../local-path-suggestions-2018.stderr | 4 +- .../uniform-paths/auxiliary/issue-56596-2.rs | 1 + .../uniform-paths/auxiliary/issue-56596.rs | 1 + .../block-scoped-shadow-nested.rs | 2 - .../block-scoped-shadow-nested.stderr | 6 +- .../rust-2018/uniform-paths/fn-local-enum.rs | 2 - .../ui/rust-2018/uniform-paths/issue-54390.rs | 11 - .../uniform-paths/issue-54390.stderr | 32 -- .../rust-2018/uniform-paths/issue-56596-2.rs | 11 + .../ui/rust-2018/uniform-paths/issue-56596.rs | 12 + .../uniform-paths/issue-56596.stderr | 18 + .../ui/rust-2018/uniform-paths/macro-rules.rs | 21 +- .../uniform-paths/macro-rules.stderr | 40 +- .../rust-2018/uniform-paths/prelude-fail-2.rs | 19 + .../uniform-paths/prelude-fail-2.stderr | 44 ++ .../rust-2018/uniform-paths/prelude-fail.rs | 2 - .../uniform-paths/prelude-fail.stderr | 4 +- .../ui/rust-2018/uniform-paths/prelude.rs | 10 - ...ject-with-self-in-projection-output-bad.rs | 50 +++ ...-with-self-in-projection-output-bad.stderr | 21 + ...ect-with-self-in-projection-output-good.rs | 28 ++ ...n-projection-output-repeated-supertrait.rs | 48 ++ src/test/ui/write-to-static-mut-in-static.rs | 4 +- .../ui/write-to-static-mut-in-static.stderr | 20 +- src/tools/build-manifest/src/main.rs | 4 +- vendor/libc/.cargo-checksum.json | 2 +- vendor/libc/.cargo_vcs_info.json | 5 + vendor/libc/.cirrus.yml | 14 + vendor/libc/.travis.yml | 123 ----- vendor/libc/Cargo.toml | 14 +- vendor/libc/README.md | 3 +- vendor/libc/appveyor.yml | 28 -- vendor/libc/build.rs | 35 ++ vendor/libc/ci/README.md | 243 ---------- vendor/libc/ci/android-install-ndk.sh | 37 -- vendor/libc/ci/android-install-sdk.sh | 60 --- vendor/libc/ci/android-sysimage.sh | 52 --- .../docker/aarch64-linux-android/Dockerfile | 45 -- .../aarch64-unknown-linux-gnu/Dockerfile | 7 - .../aarch64-unknown-linux-musl/Dockerfile | 27 -- .../docker/arm-linux-androideabi/Dockerfile | 45 -- .../arm-unknown-linux-gnueabihf/Dockerfile | 7 - .../arm-unknown-linux-musleabihf/Dockerfile | 25 -- .../asmjs-unknown-emscripten/Dockerfile | 20 - .../ci/docker/i686-linux-android/Dockerfile | 45 -- .../docker/i686-unknown-linux-gnu/Dockerfile | 5 - .../docker/i686-unknown-linux-musl/Dockerfile | 31 -- .../docker/mips-unknown-linux-gnu/Dockerfile | 10 - .../docker/mips-unknown-linux-musl/Dockerfile | 17 - .../mips64-unknown-linux-gnuabi64/Dockerfile | 11 - .../Dockerfile | 11 - .../mipsel-unknown-linux-musl/Dockerfile | 17 - .../powerpc-unknown-linux-gnu/Dockerfile | 10 - .../powerpc64-unknown-linux-gnu/Dockerfile | 11 - .../powerpc64le-unknown-linux-gnu/Dockerfile | 11 - .../docker/s390x-unknown-linux-gnu/Dockerfile | 18 - .../sparc64-unknown-linux-gnu/Dockerfile | 21 - .../wasm32-unknown-emscripten/Dockerfile | 21 - .../wasm32-unknown-emscripten/node-wrapper.sh | 15 - .../ci/docker/x86_64-linux-android/Dockerfile | 26 -- .../docker/x86_64-rumprun-netbsd/Dockerfile | 10 - .../docker/x86_64-rumprun-netbsd/runtest.rs | 54 --- .../docker/x86_64-unknown-freebsd/Dockerfile | 13 - .../x86_64-unknown-linux-gnu/Dockerfile | 5 - .../x86_64-unknown-linux-gnux32/Dockerfile | 5 - .../x86_64-unknown-linux-musl/Dockerfile | 20 - vendor/libc/ci/dox.sh | 33 -- vendor/libc/ci/emscripten-entry.sh | 19 - vendor/libc/ci/emscripten.sh | 54 --- .../ci/ios/deploy_and_run_on_ios_simulator.rs | 172 ------- vendor/libc/ci/landing-page-footer.html | 3 - vendor/libc/ci/landing-page-head.html | 7 - vendor/libc/ci/linux-s390x.sh | 18 - vendor/libc/ci/linux-sparc64.sh | 17 - vendor/libc/ci/run-docker.sh | 36 -- vendor/libc/ci/run-qemu.sh | 32 -- vendor/libc/ci/run.sh | 98 ---- vendor/libc/ci/runtest-android.rs | 41 -- vendor/libc/ci/style.rs | 206 --------- vendor/libc/ci/test-runner-linux | 23 - vendor/libc/src/cloudabi/mod.rs | 158 +++++++ vendor/libc/src/dox.rs | 44 +- vendor/libc/src/fuchsia/aarch64.rs | 4 +- vendor/libc/src/fuchsia/mod.rs | 239 +++++++--- vendor/libc/src/fuchsia/powerpc64.rs | 79 ---- vendor/libc/src/lib.rs | 423 +++++++----------- vendor/libc/src/macros.rs | 5 +- vendor/libc/src/redox/mod.rs | 170 ++++++- vendor/libc/src/sgx.rs | 54 +++ vendor/libc/src/switch.rs | 57 +++ vendor/libc/src/unix/bsd/apple/b32.rs | 6 + vendor/libc/src/unix/bsd/apple/b64.rs | 6 + vendor/libc/src/unix/bsd/apple/mod.rs | 99 +++- .../src/unix/bsd/freebsdlike/dragonfly/mod.rs | 17 + .../src/unix/bsd/freebsdlike/freebsd/mod.rs | 120 +++++ vendor/libc/src/unix/bsd/freebsdlike/mod.rs | 303 +++++++------ vendor/libc/src/unix/bsd/mod.rs | 50 +++ vendor/libc/src/unix/bsd/netbsdlike/mod.rs | 26 +- .../src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 11 + .../src/unix/bsd/netbsdlike/netbsd/arm.rs | 11 + .../src/unix/bsd/netbsdlike/netbsd/mod.rs | 124 ++++- .../bsd/netbsdlike/netbsd/other/b32/mod.rs | 2 - .../bsd/netbsdlike/netbsd/other/b64/mod.rs | 2 - .../unix/bsd/netbsdlike/netbsd/other/mod.rs | 14 - .../src/unix/bsd/netbsdlike/netbsd/powerpc.rs | 10 + .../src/unix/bsd/netbsdlike/netbsd/sparc64.rs | 4 + .../src/unix/bsd/netbsdlike/netbsd/x86.rs | 4 + .../src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 12 + .../bsd/netbsdlike/openbsdlike/bitrig/mod.rs | 2 + .../netbsdlike/openbsdlike/bitrig/x86_64.rs | 8 + .../unix/bsd/netbsdlike/openbsdlike/mod.rs | 18 +- .../bsd/netbsdlike/openbsdlike/openbsd/mod.rs | 4 + .../netbsdlike/openbsdlike/openbsd/x86_64.rs | 8 + vendor/libc/src/unix/haiku/mod.rs | 12 + vendor/libc/src/unix/hermit/mod.rs | 6 + vendor/libc/src/unix/mod.rs | 201 ++++++++- vendor/libc/src/unix/newlib/mod.rs | 6 + vendor/libc/src/unix/notbsd/android/mod.rs | 10 +- vendor/libc/src/unix/notbsd/emscripten.rs | 13 +- vendor/libc/src/unix/notbsd/linux/mips/mod.rs | 2 - vendor/libc/src/unix/notbsd/linux/mod.rs | 131 +++++- .../src/unix/notbsd/linux/musl/b32/arm.rs | 3 + .../src/unix/notbsd/linux/musl/b32/mips.rs | 3 + .../src/unix/notbsd/linux/musl/b32/powerpc.rs | 3 + .../src/unix/notbsd/linux/musl/b32/x86.rs | 3 + .../src/unix/notbsd/linux/musl/b64/aarch64.rs | 3 + .../src/unix/notbsd/linux/musl/b64/mod.rs | 11 +- .../unix/notbsd/linux/musl/b64/powerpc64.rs | 91 ++-- vendor/libc/src/unix/notbsd/linux/musl/mod.rs | 11 + .../src/unix/notbsd/linux/other/b32/mod.rs | 4 + .../unix/notbsd/linux/other/b64/aarch64.rs | 6 +- .../unix/notbsd/linux/other/b64/powerpc64.rs | 6 +- .../unix/notbsd/linux/other/b64/sparc64.rs | 5 + .../src/unix/notbsd/linux/other/b64/x86_64.rs | 2 - .../libc/src/unix/notbsd/linux/other/mod.rs | 16 +- vendor/libc/src/unix/notbsd/mod.rs | 43 +- vendor/libc/src/unix/solaris/mod.rs | 11 + vendor/libc/src/unix/uclibc/mips/mod.rs | 4 +- vendor/libc/src/unix/uclibc/mod.rs | 19 +- vendor/libc/src/windows/gnu.rs | 8 + .../libc/src/{windows.rs => windows/mod.rs} | 178 +++++++- vendor/libc/src/windows/msvc.rs | 10 + vendor/tar/.cargo-checksum.json | 2 +- vendor/tar/.cargo_vcs_info.json | 2 +- vendor/tar/Cargo.toml | 2 +- vendor/tar/src/entry.rs | 2 +- vendor/tar/tests/all.rs | 33 ++ version | 2 +- 288 files changed, 4337 insertions(+), 3485 deletions(-) create mode 100644 src/test/codegen/issue-56927.rs create mode 100644 src/test/run-pass/issue-56237.rs create mode 100644 src/test/rustdoc/issue-50159.rs rename src/test/{ui/feature-gates/feature-gate-uniform-paths.rs => rustdoc/issue-56822.rs} (50%) create mode 100644 src/test/rustdoc/synthetic_auto/self-referential.rs create mode 100644 src/test/ui/consts/promoted_regression.rs create mode 100644 src/test/ui/consts/static_mut_containing_mut_ref.rs create mode 100644 src/test/ui/consts/static_mut_containing_mut_ref2.rs create mode 100644 src/test/ui/consts/static_mut_containing_mut_ref2.stderr create mode 100644 src/test/ui/consts/static_mut_containing_mut_ref3.rs create mode 100644 src/test/ui/consts/static_mut_containing_mut_ref3.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-uniform-paths.stderr create mode 100644 src/test/ui/imports/issue-57015.rs create mode 100644 src/test/ui/imports/issue-57015.stderr create mode 100644 src/test/ui/issues/issue-56199.rs create mode 100644 src/test/ui/issues/issue-56199.stderr create mode 100644 src/test/ui/issues/issue-56835.rs create mode 100644 src/test/ui/issues/issue-56835.stderr create mode 100644 src/test/ui/issues/issue-57156.rs create mode 100644 src/test/ui/nll/issue-57265-return-type-wf-check.rs create mode 100644 src/test/ui/nll/issue-57265-return-type-wf-check.stderr create mode 100644 src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs create mode 100644 src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs delete mode 100644 src/test/ui/rust-2018/uniform-paths/issue-54390.rs delete mode 100644 src/test/ui/rust-2018/uniform-paths/issue-54390.stderr create mode 100644 src/test/ui/rust-2018/uniform-paths/issue-56596-2.rs create mode 100644 src/test/ui/rust-2018/uniform-paths/issue-56596.rs create mode 100644 src/test/ui/rust-2018/uniform-paths/issue-56596.stderr create mode 100644 src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs create mode 100644 src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr create mode 100644 src/test/ui/traits/trait-object-with-self-in-projection-output-bad.rs create mode 100644 src/test/ui/traits/trait-object-with-self-in-projection-output-bad.stderr create mode 100644 src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs create mode 100644 src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs create mode 100644 vendor/libc/.cargo_vcs_info.json create mode 100644 vendor/libc/.cirrus.yml delete mode 100644 vendor/libc/.travis.yml delete mode 100644 vendor/libc/appveyor.yml create mode 100644 vendor/libc/build.rs delete mode 100644 vendor/libc/ci/README.md delete mode 100644 vendor/libc/ci/android-install-ndk.sh delete mode 100644 vendor/libc/ci/android-install-sdk.sh delete mode 100644 vendor/libc/ci/android-sysimage.sh delete mode 100644 vendor/libc/ci/docker/aarch64-linux-android/Dockerfile delete mode 100644 vendor/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile delete mode 100644 vendor/libc/ci/docker/arm-linux-androideabi/Dockerfile delete mode 100644 vendor/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile delete mode 100644 vendor/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile delete mode 100644 vendor/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile delete mode 100644 vendor/libc/ci/docker/i686-linux-android/Dockerfile delete mode 100644 vendor/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/i686-unknown-linux-musl/Dockerfile delete mode 100644 vendor/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/mips-unknown-linux-musl/Dockerfile delete mode 100644 vendor/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile delete mode 100644 vendor/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile delete mode 100644 vendor/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile delete mode 100644 vendor/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile delete mode 100755 vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh delete mode 100644 vendor/libc/ci/docker/x86_64-linux-android/Dockerfile delete mode 100644 vendor/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile delete mode 100644 vendor/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs delete mode 100644 vendor/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile delete mode 100644 vendor/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile delete mode 100644 vendor/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile delete mode 100644 vendor/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile delete mode 100644 vendor/libc/ci/dox.sh delete mode 100755 vendor/libc/ci/emscripten-entry.sh delete mode 100644 vendor/libc/ci/emscripten.sh delete mode 100644 vendor/libc/ci/ios/deploy_and_run_on_ios_simulator.rs delete mode 100644 vendor/libc/ci/landing-page-footer.html delete mode 100644 vendor/libc/ci/landing-page-head.html delete mode 100644 vendor/libc/ci/linux-s390x.sh delete mode 100644 vendor/libc/ci/linux-sparc64.sh delete mode 100755 vendor/libc/ci/run-docker.sh delete mode 100644 vendor/libc/ci/run-qemu.sh delete mode 100755 vendor/libc/ci/run.sh delete mode 100644 vendor/libc/ci/runtest-android.rs delete mode 100644 vendor/libc/ci/style.rs delete mode 100755 vendor/libc/ci/test-runner-linux delete mode 100644 vendor/libc/src/fuchsia/powerpc64.rs create mode 100644 vendor/libc/src/sgx.rs create mode 100644 vendor/libc/src/switch.rs create mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs create mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs delete mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs delete mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs delete mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs create mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs create mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs create mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs create mode 100644 vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs create mode 100644 vendor/libc/src/windows/gnu.rs rename vendor/libc/src/{windows.rs => windows/mod.rs} (54%) create mode 100644 vendor/libc/src/windows/msvc.rs diff --git a/Cargo.lock b/Cargo.lock index 69d929e913..4831d03dd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,7 +69,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -81,7 +81,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -92,7 +92,7 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -128,7 +128,7 @@ dependencies = [ "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -205,7 +205,7 @@ dependencies = [ "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -223,7 +223,7 @@ dependencies = [ "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", "shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -392,7 +392,7 @@ name = "commoncrypto-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -412,7 +412,7 @@ dependencies = [ "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -431,7 +431,7 @@ dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -455,7 +455,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -567,7 +567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -581,7 +581,7 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "libnghttp2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", @@ -631,7 +631,7 @@ name = "directories" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -756,7 +756,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -770,7 +770,7 @@ name = "flate2" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -802,7 +802,7 @@ name = "fs2" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -867,7 +867,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1007,7 +1007,7 @@ dependencies = [ "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "xz2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1038,7 +1038,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1046,7 +1046,7 @@ name = "jobserver" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1120,7 +1120,7 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.43" +version = "0.2.45" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1130,7 +1130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1151,7 +1151,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1164,7 +1164,7 @@ version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1213,7 +1213,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1285,7 +1285,7 @@ name = "memchr" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1293,7 +1293,7 @@ name = "memmap" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1316,7 +1316,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1384,7 +1384,7 @@ name = "num_cpus" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1411,7 +1411,7 @@ dependencies = [ "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1434,7 +1434,7 @@ version = "0.9.38" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-src 111.0.1+1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1500,7 +1500,7 @@ name = "parking_lot_core" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1511,7 +1511,7 @@ name = "parking_lot_core" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1737,7 +1737,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1748,7 +1748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1774,7 +1774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2127,7 +2127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2213,7 +2213,7 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2754,7 +2754,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2939,11 +2939,11 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2953,7 +2953,7 @@ name = "tempfile" version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2996,7 +2996,7 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3040,7 +3040,7 @@ name = "time" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3197,7 +3197,7 @@ name = "wait-timeout" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3261,7 +3261,7 @@ name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3377,7 +3377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" "checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" +"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" "checksum libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4916b5addc78ec36cc309acfcdf0b9f9d97ab7b84083118b248709c5b7029356" "checksum libnghttp2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ffbfb81475cc9f625e44f3a8f8b9cf7173815ae1c7cc2fa91853ec009e38198" "checksum libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d" @@ -3506,7 +3506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)" = "816b7af21405b011a23554ea2dc3f6576dc86ca557047c34098c1d741f10f823" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb9b7550d063ea184027c9b8c20ac167cd36d3e06b3a40bceb9d746dc1a7b7" -"checksum tar 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "69e16840a1e0a1f1a880b739ef1cc6a4b85496c99b8aa786ccffce6e0c15624c" +"checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" "checksum tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c4b103c6d08d323b92ff42c8ce62abcd83ca8efa7fd5bf7927efefec75f58c76" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" "checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" diff --git a/RELEASES.md b/RELEASES.md index da09af3edf..83c44774da 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,312 @@ +Version 1.32.0 (2019-01-17) +========================== + +Language +-------- +#### 2018 edition +- [You can now use the `?` operator in macro definitions.][56245] The `?` + operator allows you to specify zero or one repetitions similar to the `*` and + `+` operators. +- [Module paths with no leading keyword like `super`, `self`, or `crate`, will + now always resolve to the item (`enum`, `struct`, etc.) available in the + module if present, before resolving to a external crate or an item the prelude.][56759] + E.g. + ```rust + enum Color { Red, Green, Blue } + + use Color::*; + ``` + +#### All editions +- [You can now match against `PhantomData` types.][55837] +- [You can now match against literals in macros with the `literal` + specifier.][56072] This will match against a literal of any type. + E.g. `1`, `'A'`, `"Hello World"` +- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g. + ```rust + struct Point(i32, i32); + + impl Point { + pub fn new(x: i32, y: i32) -> Self { + Self(x, y) + } + + pub fn is_origin(&self) -> bool { + match self { + Self(0, 0) => true, + _ => false, + } + } + } + ``` +- [Self can also now be used in type definitions.][56366] E.g. + ```rust + enum List + where + Self: PartialOrd // can write `Self` instead of `List` + { + Nil, + Cons(T, Box) // likewise here + } + ``` +- [You can now mark traits with `#[must_use]`.][55663] This provides a warning if + a `impl Trait` or `dyn Trait` is returned and unused in the program. + +Compiler +-------- +- [The default allocator has changed from jemalloc to the default allocator on + your system.][55238] The compiler itself on Linux & macOS will still use + jemalloc, but programs compiled with it will use the system allocator. +- [Added the `aarch64-pc-windows-msvc` target.][55702] + +Libraries +--------- +- [`PathBuf` now implements `FromStr`.][55148] +- [`Box<[T]>` now implements `FromIterator`.][55843] +- [The `dbg!` macro has been stabilized.][56395] This macro enables you to + easily debug expressions in your rust program. E.g. + ```rust + let a = 2; + let b = dbg!(a * 2) + 1; + // ^-- prints: [src/main.rs:4] a * 2 = 4 + assert_eq!(b, 5); + ``` + +The following APIs are now `const` functions and can be used in a +`const` context. + +- [`Cell::as_ptr`] +- [`UnsafeCell::get`] +- [`char::is_ascii`] +- [`iter::empty`] +- [`ManuallyDrop::new`] +- [`ManuallyDrop::into_inner`] +- [`RangeInclusive::start`] +- [`RangeInclusive::end`] +- [`NonNull::as_ptr`] +- [`slice::as_ptr`] +- [`str::as_ptr`] +- [`Duration::as_secs`] +- [`Duration::subsec_millis`] +- [`Duration::subsec_micros`] +- [`Duration::subsec_nanos`] +- [`CStr::as_ptr`] +- [`Ipv4Addr::is_unspecified`] +- [`Ipv6Addr::new`] +- [`Ipv6Addr::octets`] + +Stabilized APIs +--------------- +- [`i8::to_be_bytes`] +- [`i8::to_le_bytes`] +- [`i8::to_ne_bytes`] +- [`i8::from_be_bytes`] +- [`i8::from_le_bytes`] +- [`i8::from_ne_bytes`] +- [`i16::to_be_bytes`] +- [`i16::to_le_bytes`] +- [`i16::to_ne_bytes`] +- [`i16::from_be_bytes`] +- [`i16::from_le_bytes`] +- [`i16::from_ne_bytes`] +- [`i32::to_be_bytes`] +- [`i32::to_le_bytes`] +- [`i32::to_ne_bytes`] +- [`i32::from_be_bytes`] +- [`i32::from_le_bytes`] +- [`i32::from_ne_bytes`] +- [`i64::to_be_bytes`] +- [`i64::to_le_bytes`] +- [`i64::to_ne_bytes`] +- [`i64::from_be_bytes`] +- [`i64::from_le_bytes`] +- [`i64::from_ne_bytes`] +- [`i128::to_be_bytes`] +- [`i128::to_le_bytes`] +- [`i128::to_ne_bytes`] +- [`i128::from_be_bytes`] +- [`i128::from_le_bytes`] +- [`i128::from_ne_bytes`] +- [`isize::to_be_bytes`] +- [`isize::to_le_bytes`] +- [`isize::to_ne_bytes`] +- [`isize::from_be_bytes`] +- [`isize::from_le_bytes`] +- [`isize::from_ne_bytes`] +- [`u8::to_be_bytes`] +- [`u8::to_le_bytes`] +- [`u8::to_ne_bytes`] +- [`u8::from_be_bytes`] +- [`u8::from_le_bytes`] +- [`u8::from_ne_bytes`] +- [`u16::to_be_bytes`] +- [`u16::to_le_bytes`] +- [`u16::to_ne_bytes`] +- [`u16::from_be_bytes`] +- [`u16::from_le_bytes`] +- [`u16::from_ne_bytes`] +- [`u32::to_be_bytes`] +- [`u32::to_le_bytes`] +- [`u32::to_ne_bytes`] +- [`u32::from_be_bytes`] +- [`u32::from_le_bytes`] +- [`u32::from_ne_bytes`] +- [`u64::to_be_bytes`] +- [`u64::to_le_bytes`] +- [`u64::to_ne_bytes`] +- [`u64::from_be_bytes`] +- [`u64::from_le_bytes`] +- [`u64::from_ne_bytes`] +- [`u128::to_be_bytes`] +- [`u128::to_le_bytes`] +- [`u128::to_ne_bytes`] +- [`u128::from_be_bytes`] +- [`u128::from_le_bytes`] +- [`u128::from_ne_bytes`] +- [`usize::to_be_bytes`] +- [`usize::to_le_bytes`] +- [`usize::to_ne_bytes`] +- [`usize::from_be_bytes`] +- [`usize::from_le_bytes`] +- [`usize::from_ne_bytes`] + +Cargo +----- +- [You can now run `cargo c` as an alias for `cargo check`.][cargo/6218] +- [Usernames are now allowed in alt registry URLs.][cargo/6242] + +Misc +---- +- [`libproc_macro` has been added to the `rust-src` distribution.][55280] + +Compatibility Notes +------------------- +- [The argument types for AVX's + `_mm256_stream_si256`, `_mm256_stream_pd`, `_mm256_stream_ps`][55610] have + been changed from `*const` to `*mut` as the previous implementation + was unsound. + + +[55148]: https://github.com/rust-lang/rust/pull/55148/ +[55238]: https://github.com/rust-lang/rust/pull/55238/ +[55280]: https://github.com/rust-lang/rust/pull/55280/ +[55610]: https://github.com/rust-lang/rust/pull/55610/ +[55663]: https://github.com/rust-lang/rust/pull/55663/ +[55702]: https://github.com/rust-lang/rust/pull/55702/ +[55837]: https://github.com/rust-lang/rust/pull/55837/ +[55843]: https://github.com/rust-lang/rust/pull/55843/ +[56072]: https://github.com/rust-lang/rust/pull/56072/ +[56245]: https://github.com/rust-lang/rust/pull/56245/ +[56365]: https://github.com/rust-lang/rust/pull/56365/ +[56366]: https://github.com/rust-lang/rust/pull/56366/ +[56395]: https://github.com/rust-lang/rust/pull/56395/ +[56759]: https://github.com/rust-lang/rust/pull/56759/ +[cargo/6218]: https://github.com/rust-lang/cargo/pull/6218/ +[cargo/6242]: https://github.com/rust-lang/cargo/pull/6242/ +[`CStr::as_ptr`]: https://doc.rust-lang.org/std/ffi/struct.CStr.html#method.as_ptr +[`Cell::as_ptr`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_ptr +[`Duration::as_secs`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs +[`Duration::subsec_micros`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.subsec_micros +[`Duration::subsec_millis`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.subsec_millis +[`Duration::subsec_nanos`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.subsec_nanos +[`Ipv4Addr::is_unspecified`]: https://doc.rust-lang.org/std/net/struct.Ipv4Addr.html#method.is_unspecified +[`Ipv6Addr::new`]: https://doc.rust-lang.org/std/net/struct.Ipv6Addr.html#method.new +[`Ipv6Addr::octets`]: https://doc.rust-lang.org/std/net/struct.Ipv6Addr.html#method.octets +[`ManuallyDrop::into_inner`]: https://doc.rust-lang.org/std/mem/struct.ManuallyDrop.html#method.into_inner +[`ManuallyDrop::new`]: https://doc.rust-lang.org/std/mem/struct.ManuallyDrop.html#method.new +[`NonNull::as_ptr`]: https://doc.rust-lang.org/std/ptr/struct.NonNull.html#method.as_ptr +[`RangeInclusive::end`]: https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html#method.end +[`RangeInclusive::start`]: https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html#method.start +[`UnsafeCell::get`]: https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html#method.get +[`slice::as_ptr`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr +[`char::is_ascii`]: https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii +[`i128::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.from_be_bytes +[`i128::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.from_le_bytes +[`i128::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.from_ne_bytes +[`i128::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.to_be_bytes +[`i128::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.to_le_bytes +[`i128::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.to_ne_bytes +[`i16::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.from_be_bytes +[`i16::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.from_le_bytes +[`i16::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.from_ne_bytes +[`i16::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.to_be_bytes +[`i16::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.to_le_bytes +[`i16::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.to_ne_bytes +[`i32::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.from_be_bytes +[`i32::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.from_le_bytes +[`i32::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.from_ne_bytes +[`i32::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.to_be_bytes +[`i32::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.to_le_bytes +[`i32::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.to_ne_bytes +[`i64::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.from_be_bytes +[`i64::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.from_le_bytes +[`i64::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.from_ne_bytes +[`i64::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.to_be_bytes +[`i64::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.to_le_bytes +[`i64::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.to_ne_bytes +[`i8::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.from_be_bytes +[`i8::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.from_le_bytes +[`i8::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.from_ne_bytes +[`i8::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.to_be_bytes +[`i8::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.to_le_bytes +[`i8::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.to_ne_bytes +[`isize::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.from_be_bytes +[`isize::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.from_le_bytes +[`isize::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.from_ne_bytes +[`isize::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.to_be_bytes +[`isize::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.to_le_bytes +[`isize::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.to_ne_bytes +[`iter::empty`]: https://doc.rust-lang.org/std/iter/fn.empty.html +[`str::as_ptr`]: https://doc.rust-lang.org/std/primitive.str.html#method.as_ptr +[`u128::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.from_be_bytes +[`u128::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.from_le_bytes +[`u128::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.from_ne_bytes +[`u128::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.to_be_bytes +[`u128::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.to_le_bytes +[`u128::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.to_ne_bytes +[`u16::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.from_be_bytes +[`u16::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.from_le_bytes +[`u16::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.from_ne_bytes +[`u16::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.to_be_bytes +[`u16::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.to_le_bytes +[`u16::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.to_ne_bytes +[`u32::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.from_be_bytes +[`u32::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.from_le_bytes +[`u32::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.from_ne_bytes +[`u32::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.to_be_bytes +[`u32::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.to_le_bytes +[`u32::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.to_ne_bytes +[`u64::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.from_be_bytes +[`u64::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.from_le_bytes +[`u64::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.from_ne_bytes +[`u64::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.to_be_bytes +[`u64::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.to_le_bytes +[`u64::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.to_ne_bytes +[`u8::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.from_be_bytes +[`u8::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.from_le_bytes +[`u8::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.from_ne_bytes +[`u8::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_be_bytes +[`u8::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_le_bytes +[`u8::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ne_bytes +[`usize::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.from_be_bytes +[`usize::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.from_le_bytes +[`usize::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.from_ne_bytes +[`usize::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.to_be_bytes +[`usize::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.to_le_bytes +[`usize::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.to_ne_bytes + + +Version 1.31.1 (2018-12-20) +=========================== + +- [Fix Rust failing to build on `powerpc-unknown-netbsd`][56562] +- [Fix broken go-to-definition in RLS][rls/1171] +- [Fix infinite loop on hover in RLS][rls/1170] + +[56562]: https://github.com/rust-lang/rust/pull/56562 +[rls/1171]: https://github.com/rust-lang/rls/issues/1171 +[rls/1170]: https://github.com/rust-lang/rls/pull/1170 + Version 1.31.0 (2018-12-06) ========================== diff --git a/git-commit-hash b/git-commit-hash index 3d87efb416..8ba8d7052d 100644 --- a/git-commit-hash +++ b/git-commit-hash @@ -1 +1 @@ -a01e4761a1507939430d4044a5f0a35fdb2b146c \ No newline at end of file +9fda7c2237db910e41d6a712e9a2139b352e558b \ No newline at end of file diff --git a/src/ci/docker/dist-i686-linux/Dockerfile b/src/ci/docker/dist-i686-linux/Dockerfile index b087ea7899..8df49f364a 100644 --- a/src/ci/docker/dist-i686-linux/Dockerfile +++ b/src/ci/docker/dist-i686-linux/Dockerfile @@ -67,7 +67,7 @@ RUN ./build-gcc.sh COPY dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh -# Now build LLVM+Clang 7, afterwards configuring further compilations to use the +# Now build LLVM+Clang 6, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh diff --git a/src/ci/docker/dist-x86_64-linux/Dockerfile b/src/ci/docker/dist-x86_64-linux/Dockerfile index a1a778c2b2..0a2dae72f7 100644 --- a/src/ci/docker/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/dist-x86_64-linux/Dockerfile @@ -67,7 +67,7 @@ RUN ./build-gcc.sh COPY dist-x86_64-linux/build-python.sh /tmp/ RUN ./build-python.sh -# Now build LLVM+Clang 7, afterwards configuring further compilations to use the +# Now build LLVM+Clang 6, afterwards configuring further compilations to use the # clang/clang++ compilers. COPY dist-x86_64-linux/build-clang.sh /tmp/ RUN ./build-clang.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-clang.sh b/src/ci/docker/dist-x86_64-linux/build-clang.sh index 2762f0bf7e..4595eacb31 100755 --- a/src/ci/docker/dist-x86_64-linux/build-clang.sh +++ b/src/ci/docker/dist-x86_64-linux/build-clang.sh @@ -13,7 +13,7 @@ set -ex source shared.sh -LLVM=7.0.0 +LLVM=6.0.0 mkdir clang cd clang diff --git a/src/ci/docker/mingw-check/Dockerfile b/src/ci/docker/mingw-check/Dockerfile index aab339f399..10aedf6a60 100644 --- a/src/ci/docker/mingw-check/Dockerfile +++ b/src/ci/docker/mingw-check/Dockerfile @@ -20,4 +20,5 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 -ENV SCRIPT python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu +ENV SCRIPT python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ + python2.7 ../x.py build --stage 0 src/tools/build-manifest diff --git a/src/ci/docker/scripts/musl.sh b/src/ci/docker/scripts/musl.sh index 11d85471b7..fcebfb9324 100644 --- a/src/ci/docker/scripts/musl.sh +++ b/src/ci/docker/scripts/musl.sh @@ -51,7 +51,7 @@ hide_output make clean cd .. -LLVM=70 +LLVM=60 # may have been downloaded in a previous run if [ ! -d libunwind-release_$LLVM ]; then diff --git a/src/ci/run.sh b/src/ci/run.sh index 2de80456cd..31fd0a2599 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -52,7 +52,7 @@ fi # # FIXME: need a scheme for changing this `nightly` value to `beta` and `stable` # either automatically or manually. -export RUST_RELEASE_CHANNEL=beta +export RUST_RELEASE_CHANNEL=stable if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL" RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp" diff --git a/src/doc/book/redirects/attributes.md b/src/doc/book/redirects/attributes.md index 2d7b05d065..ee6b23038a 100644 --- a/src/doc/book/redirects/attributes.md +++ b/src/doc/book/redirects/attributes.md @@ -20,5 +20,5 @@ Here are the relevant sections in the new and old books: * [In the first edition: Ch 3.27 — Attributes][1] -[1]: first-edition/attributes.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/attributes.html [2]: ../reference/attributes.html diff --git a/src/doc/book/redirects/bibliography.md b/src/doc/book/redirects/bibliography.md index 740a26b3d3..aca777e397 100644 --- a/src/doc/book/redirects/bibliography.md +++ b/src/doc/book/redirects/bibliography.md @@ -9,6 +9,6 @@ You might be interested in a similar page in [the Rust Reference][3]. * [In the first edition: Section 7 — Bibliography][1] -[1]: first-edition/bibliography.html -[2]: second-edition/index.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/bibliography.html +[2]: index.html [3]: ../reference/influences.html diff --git a/src/doc/book/redirects/borrow-and-asref.md b/src/doc/book/redirects/borrow-and-asref.md index 2b8255bf19..6541e59baf 100644 --- a/src/doc/book/redirects/borrow-and-asref.md +++ b/src/doc/book/redirects/borrow-and-asref.md @@ -20,6 +20,6 @@ The best place to learn more about this is [the Rust documentation][3]. * [In the first edition: Ch 4.10 — Borrow and AsRef][1] -[1]: first-edition/borrow-and-asref.html -[2]: second-edition/index.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/borrow-and-asref.html +[2]: index.html [3]: ../std/convert/trait.AsRef.html diff --git a/src/doc/book/redirects/casting-between-types.md b/src/doc/book/redirects/casting-between-types.md index 9d773149aa..7e1eb7744d 100644 --- a/src/doc/book/redirects/casting-between-types.md +++ b/src/doc/book/redirects/casting-between-types.md @@ -20,13 +20,13 @@ fn average(values: &[f64]) -> f64 { Here are the relevant sections in the new and old books: -* **[In the second edition: Appendix A — Keywords][2]** +* **[in the current edition: Appendix A — Keywords][2]** * [In the Rust Reference: Type Cast Expressions][3] * [In the Rust documentation: `mem::transmute`][4] * [In the first edition: Ch 3.29 — Casting between types][1] -[1]: first-edition/casting-between-types.html -[2]: second-edition/appendix-01-keywords.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/casting-between-types.html +[2]: appendix-01-keywords.html [3]: ../reference/expressions/operator-expr.html#type-cast-expressions [4]: ../std/mem/fn.transmute.html \ No newline at end of file diff --git a/src/doc/book/redirects/choosing-your-guarantees.md b/src/doc/book/redirects/choosing-your-guarantees.md index e2205284b0..3667258c66 100644 --- a/src/doc/book/redirects/choosing-your-guarantees.md +++ b/src/doc/book/redirects/choosing-your-guarantees.md @@ -14,9 +14,9 @@ println!("b = {}", b); Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 15.00 — Smart Pointers][2]** +* **[In the current edition: Ch 15.00 — Smart Pointers][2]** * [In the first edition: Ch 4.8 — Choosing your Guarantees][1] -[1]: first-edition/choosing-your-guarantees.html -[2]: second-edition/ch15-00-smart-pointers.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/choosing-your-guarantees.html +[2]: ch15-00-smart-pointers.html diff --git a/src/doc/book/redirects/closures.md b/src/doc/book/redirects/closures.md index a3c6555e2f..55b88767fb 100644 --- a/src/doc/book/redirects/closures.md +++ b/src/doc/book/redirects/closures.md @@ -20,9 +20,9 @@ let expensive_closure = |num| { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 13.01 — Closures][2]** +* **[in the current edition: Ch 13.01 — Closures][2]** * [In the first edition: Ch 3.23 — Closures][1] -[1]: first-edition/closures.html -[2]: second-edition/ch13-01-closures.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/closures.html +[2]: ch13-01-closures.html diff --git a/src/doc/book/redirects/comments.md b/src/doc/book/redirects/comments.md index 7766940fe7..d8e94f7e93 100644 --- a/src/doc/book/redirects/comments.md +++ b/src/doc/book/redirects/comments.md @@ -15,9 +15,9 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 3.04 — Comments][2]** +* **[in the current edition: Ch 3.04 — Comments][2]** * [In the first edition: Ch 3.4 — Comments][1] -[1]: first-edition/comments.html -[2]: second-edition/ch03-04-comments.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/comments.html +[2]: ch03-04-comments.html diff --git a/src/doc/book/redirects/concurrency.md b/src/doc/book/redirects/concurrency.md index c2b96a55a3..da7fb2fb09 100644 --- a/src/doc/book/redirects/concurrency.md +++ b/src/doc/book/redirects/concurrency.md @@ -9,9 +9,9 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 16.00 — Fearless Concurrency][2]** +* **[in the current edition: Ch 16.00 — Fearless Concurrency][2]** * [In the first edition: Ch 4.6 — Concurrency][1] -[1]: first-edition/concurrency.html -[2]: second-edition/ch16-00-concurrency.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/concurrency.html +[2]: ch16-00-concurrency.html diff --git a/src/doc/book/redirects/conditional-compilation.md b/src/doc/book/redirects/conditional-compilation.md index 4e88da53b4..5182371bde 100644 --- a/src/doc/book/redirects/conditional-compilation.md +++ b/src/doc/book/redirects/conditional-compilation.md @@ -23,6 +23,6 @@ The best place to learn about it is [the Rust Reference][3]. * [In the first edition: Ch 4.3 — Conditional Compilation][1] -[1]: first-edition/conditional-compilation.html -[2]: second-edition/index.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/conditional-compilation.html +[2]: index.html [3]: ../reference/attributes.html#conditional-compilation diff --git a/src/doc/book/redirects/crates-and-modules.md b/src/doc/book/redirects/crates-and-modules.md index 3fbd1edc70..a9fad84149 100644 --- a/src/doc/book/redirects/crates-and-modules.md +++ b/src/doc/book/redirects/crates-and-modules.md @@ -18,11 +18,11 @@ mod network { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 7.01 — `mod` and the Filesystem][2]** -* [In the second edition: Ch 14.02 — Publishing a Crate to Crates.io][3] +* **[in the current edition: Ch 7.01 — `mod` and the Filesystem][2]** +* [in the current edition: Ch 14.02 — Publishing a Crate to Crates.io][3] * [In the first edition: Ch 3.25 — Crates and Modules][1] -[1]: first-edition/crates-and-modules.html -[2]: second-edition/ch07-01-mod-and-the-filesystem.html -[3]: second-edition/ch14-02-publishing-to-crates-io.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/crates-and-modules.html +[2]: ch07-00-packages-crates-and-modules.html +[3]: ch14-02-publishing-to-crates-io.html diff --git a/src/doc/book/redirects/deref-coercions.md b/src/doc/book/redirects/deref-coercions.md index 29de95e66c..61d407e1d5 100644 --- a/src/doc/book/redirects/deref-coercions.md +++ b/src/doc/book/redirects/deref-coercions.md @@ -22,9 +22,9 @@ impl Deref for MyBox { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 15.02 — Treating Smart Pointers like Regular References with the `Deref` Trait][2]** +* **[in the current edition: Ch 15.02 — Treating Smart Pointers like Regular References with the `Deref` Trait][2]** * [In the first edition: Ch 3.33 — Deref coercions][1] -[1]: first-edition/deref-coercions.html -[2]: second-edition/ch15-02-deref.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/deref-coercions.html +[2]: ch15-02-deref.html diff --git a/src/doc/book/redirects/drop.md b/src/doc/book/redirects/drop.md index f5f01e377e..164f1d7459 100644 --- a/src/doc/book/redirects/drop.md +++ b/src/doc/book/redirects/drop.md @@ -26,9 +26,9 @@ fn main() { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 15.03 — The `Drop` Trait Runs Code on Cleanup][2]** +* **[in the current edition: Ch 15.03 — The `Drop` Trait Runs Code on Cleanup][2]** * [In the first edition: Ch 3.20 — Drop][1] -[1]: first-edition/drop.html -[2]: second-edition/ch15-03-drop.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/drop.html +[2]: ch15-03-drop.html diff --git a/src/doc/book/redirects/effective-rust.md b/src/doc/book/redirects/effective-rust.md index 5c93d84b79..30312a3ddb 100644 --- a/src/doc/book/redirects/effective-rust.md +++ b/src/doc/book/redirects/effective-rust.md @@ -10,5 +10,5 @@ It is recommended to start there. * [In the first edition: Ch 4 — Effective Rust][1] -[1]: first-edition/effective-rust.html -[2]: second-edition/index.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/effective-rust.html +[2]: index.html diff --git a/src/doc/book/redirects/enums.md b/src/doc/book/redirects/enums.md index 9b97970909..c770d6b001 100644 --- a/src/doc/book/redirects/enums.md +++ b/src/doc/book/redirects/enums.md @@ -15,9 +15,9 @@ enum IpAddrKind { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 6.01 — Defining an Enum][2]** +* **[in the current edition: Ch 6.01 — Defining an Enum][2]** * [In the first edition: Ch 3.13 — Enums][1] -[1]: first-edition/enums.html -[2]: second-edition/ch06-01-defining-an-enum.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/enums.html +[2]: ch06-01-defining-an-enum.html diff --git a/src/doc/book/redirects/error-handling.md b/src/doc/book/redirects/error-handling.md index e915657ea4..7abc9642b6 100644 --- a/src/doc/book/redirects/error-handling.md +++ b/src/doc/book/redirects/error-handling.md @@ -8,9 +8,9 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 9.00 — Error Handling][2]** +* **[in the current edition: Ch 9.00 — Error Handling][2]** * [In the first edition: Ch 4.7 — Error Handling][1] -[1]: first-edition/error-handling.html -[2]: second-edition/ch09-00-error-handling.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/error-handling.html +[2]: ch09-00-error-handling.html diff --git a/src/doc/book/redirects/functions.md b/src/doc/book/redirects/functions.md index 5c61fe56b3..eecbfd49cd 100644 --- a/src/doc/book/redirects/functions.md +++ b/src/doc/book/redirects/functions.md @@ -23,8 +23,8 @@ fn another_function() { Here are the relevant sections in the new and old books: * **[In the first edition: Ch 3.2 — Functions][1]** -* [In the second edition: Ch 3.03 — Functions][2] +* [in the current edition: Ch 3.03 — Functions][2] -[1]: first-edition/functions.html -[2]: second-edition/ch03-03-how-functions-work.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/functions.html +[2]: ch03-03-how-functions-work.html diff --git a/src/doc/book/redirects/generics.md b/src/doc/book/redirects/generics.md index 8e52802dfa..80700973fb 100644 --- a/src/doc/book/redirects/generics.md +++ b/src/doc/book/redirects/generics.md @@ -21,10 +21,10 @@ fn main() { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 10.00 — Generic Types, Traits, and Lifetimes][2]** +* **[in the current edition: Ch 10.00 — Generic Types, Traits, and Lifetimes][2]** * [In the first edition: Ch 3.18 — Generics][1] -[1]: first-edition/generics.html -[2]: second-edition/ch10-00-generics.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/generics.html +[2]: ch10-00-generics.html diff --git a/src/doc/book/redirects/getting-started.md b/src/doc/book/redirects/getting-started.md index b93a5625ea..1c84cbbaf7 100644 --- a/src/doc/book/redirects/getting-started.md +++ b/src/doc/book/redirects/getting-started.md @@ -5,9 +5,9 @@ You can [continue to the exact older page][1]. If you're trying to learn Rust, checking out [the second edition][2] might be a better choice. -* **[In the second edition: Getting Started][2]** +* **[in the current edition: Getting Started][2]** * [In the first edition: Getting Started][1] -[1]: first-edition/getting-started.html -[2]: second-edition/ch01-00-getting-started.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/getting-started.html +[2]: ch01-00-getting-started.html diff --git a/src/doc/book/redirects/glossary.md b/src/doc/book/redirects/glossary.md index 6891dc1e05..c0f9f8e725 100644 --- a/src/doc/book/redirects/glossary.md +++ b/src/doc/book/redirects/glossary.md @@ -10,5 +10,5 @@ It is recommended to start there. * [In the first edition: Glossary][1] -[1]: first-edition/glossary.html -[2]: second-edition/index.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/glossary.html +[2]: index.html diff --git a/src/doc/book/redirects/guessing-game.md b/src/doc/book/redirects/guessing-game.md index 3a243dd4b8..6abf4023b0 100644 --- a/src/doc/book/redirects/guessing-game.md +++ b/src/doc/book/redirects/guessing-game.md @@ -5,8 +5,8 @@ If you're trying to learn Rust, checking out [the second edition][2] might be a better choice. * **[In the first edition: Tutorial — Guessing Game][1]** -* [In the second edition: Ch 2.00 — Guessing Game tutorial][2] +* [in the current edition: Ch 2.00 — Guessing Game tutorial][2] -[1]: first-edition/guessing-game.html -[2]: second-edition/ch02-00-guessing-game-tutorial.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/guessing-game.html +[2]: ch02-00-guessing-game-tutorial.html diff --git a/src/doc/book/redirects/if-let.md b/src/doc/book/redirects/if-let.md index 95da06a455..edbe5d88b0 100644 --- a/src/doc/book/redirects/if-let.md +++ b/src/doc/book/redirects/if-let.md @@ -15,9 +15,8 @@ if let Some(3) = some_u8_value { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 6.03 — Concise Control Flow with `if let`][2]** +* [In the current edition: Ch 6.03 — Concise Control Flow with `if let`][2] * [In the first edition: Ch 3.21 — if let][1] - -[1]: first-edition/if-let.html -[2]: second-edition/ch06-03-if-let.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/if-let.html +[2]: ch06-03-if-let.html diff --git a/src/doc/book/redirects/iterators.md b/src/doc/book/redirects/iterators.md index 03c7134126..26cb047668 100644 --- a/src/doc/book/redirects/iterators.md +++ b/src/doc/book/redirects/iterators.md @@ -19,9 +19,9 @@ for val in v1_iter { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 13.02 — Iterators][2]** +* **[in the current edition: Ch 13.02 — Iterators][2]** * [In the first edition: Ch 4.5 — Iterators][1] -[1]: first-edition/iterators.html -[2]: second-edition/ch13-02-iterators.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/iterators.html +[2]: ch13-02-iterators.html diff --git a/src/doc/book/redirects/lifetimes.md b/src/doc/book/redirects/lifetimes.md index e9a5492719..c7da13d7a0 100644 --- a/src/doc/book/redirects/lifetimes.md +++ b/src/doc/book/redirects/lifetimes.md @@ -20,11 +20,11 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 10.03 — Lifetimes][2]** -* [In the second edition: Ch 19.02 — Advanced Lifetimes][3] +* **[in the current edition: Ch 10.03 — Lifetimes][2]** +* [in the current edition: Ch 19.02 — Advanced Lifetimes][3] * [In the first edition: Ch 3.10 — Lifetimes][1] -[1]: first-edition/lifetimes.html -[2]: second-edition/ch10-03-lifetime-syntax.html -[3]: second-edition/ch19-02-advanced-lifetimes.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/lifetimes.html +[2]: ch10-03-lifetime-syntax.html +[3]: ch19-02-advanced-lifetimes.html diff --git a/src/doc/book/redirects/macros.md b/src/doc/book/redirects/macros.md index 4d9d29ec95..08217d115d 100644 --- a/src/doc/book/redirects/macros.md +++ b/src/doc/book/redirects/macros.md @@ -18,13 +18,13 @@ fn main() { Here are the relevant sections in the new and old books: -* **[In the second edition: Appendix D — Macros][2]** +* **[In the current edition: Ch 19.06 Macros][2]** * [Rust By Example: Macros][3] * [In the Rust Reference: Ch 3.1 — Macros by Example][4] * [In the first edition: Ch 3.34 — Macros][1] -[1]: first-edition/macros.html -[2]: second-edition/appendix-04-macros.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/macros.html +[2]: ch19-06-macros.html [3]: https://rustbyexample.com/macros.html [4]: ../reference/macros-by-example.html diff --git a/src/doc/book/redirects/match.md b/src/doc/book/redirects/match.md index 5a32215ab4..fd28ba8dea 100644 --- a/src/doc/book/redirects/match.md +++ b/src/doc/book/redirects/match.md @@ -27,12 +27,12 @@ fn value_in_cents(coin: Coin) -> u32 { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 6.02 — The `match` Control Flow Operator][2]** -* [In the second edition: Ch 18.00 — Patterns][3] +* **[in the current edition: Ch 6.02 — The `match` Control Flow Operator][2]** +* [in the current edition: Ch 18.00 — Patterns][3] * [In the first edition: Ch 3.14 — Match][1] -[1]: first-edition/match.html -[2]: second-edition/ch06-02-match.html -[3]: second-edition/ch18-00-patterns.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/match.html +[2]: ch06-02-match.html +[3]: ch18-00-patterns.html diff --git a/src/doc/book/redirects/method-syntax.md b/src/doc/book/redirects/method-syntax.md index a842c9badb..29cd2cd7cd 100644 --- a/src/doc/book/redirects/method-syntax.md +++ b/src/doc/book/redirects/method-syntax.md @@ -21,9 +21,9 @@ impl Rectangle { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 5.03 — Method Syntax][2]** +* **[in the current edition: Ch 5.03 — Method Syntax][2]** * [In the first edition: Ch 3.16 — Method Syntax][1] -[1]: first-edition/method-syntax.html -[2]: second-edition/ch05-03-method-syntax.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/method-syntax.html +[2]: ch05-03-method-syntax.html diff --git a/src/doc/book/redirects/mutability.md b/src/doc/book/redirects/mutability.md index 6f48bc3065..89fc3b6f56 100644 --- a/src/doc/book/redirects/mutability.md +++ b/src/doc/book/redirects/mutability.md @@ -15,9 +15,9 @@ println!("The value of x is: {}", x); Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 3.01 — Variables and Mutability][2]** +* **[in the current edition: Ch 3.01 — Variables and Mutability][2]** * [In the first edition: Ch 3.11 — Mutability][1] -[1]: first-edition/mutability.html -[2]: second-edition/ch03-01-variables-and-mutability.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/mutability.html +[2]: ch03-01-variables-and-mutability.html diff --git a/src/doc/book/redirects/ownership.md b/src/doc/book/redirects/ownership.md index adca776217..3e7ece3b48 100644 --- a/src/doc/book/redirects/ownership.md +++ b/src/doc/book/redirects/ownership.md @@ -12,9 +12,9 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 4.00 — Understanding Ownership][2]** +* **[in the current edition: Ch 4.00 — Understanding Ownership][2]** * [In the first edition: Ch 3.8 — Ownership][1] -[1]: first-edition/ownership.html -[2]: second-edition/ch04-00-understanding-ownership.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/ownership.html +[2]: ch04-00-understanding-ownership.html diff --git a/src/doc/book/redirects/primitive-types.md b/src/doc/book/redirects/primitive-types.md index 7244fbaa60..aff51f782f 100644 --- a/src/doc/book/redirects/primitive-types.md +++ b/src/doc/book/redirects/primitive-types.md @@ -16,9 +16,9 @@ let y: f32 = 3.0; // f32 Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 3.02 — Data Types][2]** +* **[in the current edition: Ch 3.02 — Data Types][2]** * [In the first edition: Ch 3.3 — Primitive Types][1] -[1]: first-edition/primitive-types.html -[2]: second-edition/ch03-02-data-types.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/primitive-types.html +[2]: ch03-02-data-types.html diff --git a/src/doc/book/redirects/procedural-macros.md b/src/doc/book/redirects/procedural-macros.md index 4cf8ec6b65..bf6665f1a6 100644 --- a/src/doc/book/redirects/procedural-macros.md +++ b/src/doc/book/redirects/procedural-macros.md @@ -9,13 +9,13 @@ This chapter does not exist yet in [the second edition][2]. You can check out other resources that describe macros. -* **[In the Rust Reference: Ch 3.2 — Procedural Macros][4]** +* **[In the current edition: Ch 19.06 Macros][2]** +* [In the Rust Reference: Ch 3.2 — Procedural Macros][4] * [The `proc_macro` crate documentation][3] -* [In the second edition: (future) Appendix D — Macros][2] * [In the first edition: Ch 4.13 — Procedural Macros (and custom Derive)][1] -[1]: first-edition/procedural-macros.html -[2]: second-edition/appendix-04-macros.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/procedural-macros.html +[2]: ch19-06-macros.html [3]: ../proc_macro/index.html -[4]: ../reference/procedural-macros.html \ No newline at end of file +[4]: ../reference/procedural-macros.html diff --git a/src/doc/book/redirects/references-and-borrowing.md b/src/doc/book/redirects/references-and-borrowing.md index c3e29d671e..7eb8da2bdf 100644 --- a/src/doc/book/redirects/references-and-borrowing.md +++ b/src/doc/book/redirects/references-and-borrowing.md @@ -16,9 +16,9 @@ fn calculate_length(s: &String) -> usize { // s is a reference to a String Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 4.02 — References and Borrowing][2]** +* **[in the current edition: Ch 4.02 — References and Borrowing][2]** * [In the first edition: Ch 3.9 — References and Borrowing][1] -[1]: first-edition/references-and-borrowing.html -[2]: second-edition/ch04-02-references-and-borrowing.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/references-and-borrowing.html +[2]: ch04-02-references-and-borrowing.html diff --git a/src/doc/book/redirects/release-channels.md b/src/doc/book/redirects/release-channels.md index 62ee6d0845..c38ac413c9 100644 --- a/src/doc/book/redirects/release-channels.md +++ b/src/doc/book/redirects/release-channels.md @@ -16,12 +16,12 @@ You can check out other resources that describe release channels. * **[In the Rustup documentation: Keeping Rust Up-to-date][4]** * [On the website: Install Rust][5] * [In the Rust RFCs: RFC 507 — Release Channels][3] -* [In the second edition: How Rust is Made and “Nightly Rust”][2] +* [in the current edition: How Rust is Made and “Nightly Rust”][2] * [In the first edition: Ch 4.11 — Release Channels][1] -[1]: first-edition/release-channels.html -[2]: second-edition/appendix-07-nightly-rust.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/release-channels.html +[2]: appendix-07-nightly-rust.html [3]: https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md [4]: https://github.com/rust-lang-nursery/rustup.rs/blob/master/README.md#keeping-rust-up-to-date [5]: https://www.rust-lang.org/en-US/install.html diff --git a/src/doc/book/redirects/structs.md b/src/doc/book/redirects/structs.md index eb18820476..5c5427c55a 100644 --- a/src/doc/book/redirects/structs.md +++ b/src/doc/book/redirects/structs.md @@ -21,5 +21,5 @@ Here are the relevant sections in the new and old books: * [In the first edition: Ch 3.12 — Structs][1] -[1]: first-edition/structs.html -[2]: second-edition/ch05-00-structs.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/structs.html +[2]: ch05-00-structs.html diff --git a/src/doc/book/redirects/syntax-and-semantics.md b/src/doc/book/redirects/syntax-and-semantics.md index 293f694fac..b1f4f8acad 100644 --- a/src/doc/book/redirects/syntax-and-semantics.md +++ b/src/doc/book/redirects/syntax-and-semantics.md @@ -5,14 +5,14 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 3.00 — Common Programming Concepts][2]** -* [In the second edition: Appendix A — Keywords][3] -* [In the second edition: Appendix B — Operators][4] +* **[in the current edition: Ch 3.00 — Common Programming Concepts][2]** +* [in the current edition: Appendix A — Keywords][3] +* [in the current edition: Appendix B — Operators][4] * [In the first edition: Ch 3 — Syntax and Semantics][1] -[1]: first-edition/syntax-and-semantics.html -[2]: second-edition/ch03-00-common-programming-concepts.html -[3]: second-edition/appendix-01-keywords.html -[4]: second-edition/appendix-02-operators.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/syntax-and-semantics.html +[2]: ch03-00-common-programming-concepts.html +[3]: appendix-01-keywords.html +[4]: appendix-02-operators.html diff --git a/src/doc/book/redirects/syntax-index.md b/src/doc/book/redirects/syntax-index.md index cd03b67205..c9513bf0e5 100644 --- a/src/doc/book/redirects/syntax-index.md +++ b/src/doc/book/redirects/syntax-index.md @@ -4,11 +4,10 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Appendix A — Keywords][2]** -* **[In the second edition: Appendix B — Operators][3]** +* **[In the current edition: Appendix A — Keywords][2]** +* **[In the current edition: Appendix B — Operators][3]** * [In the first edition: Ch 6 — Syntax Index][1] - -[1]: first-edition/syntax-index.html -[2]: second-edition/appendix-01-keywords.html -[3]: second-edition/appendix-02-operators.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/syntax-index.html +[2]: appendix-01-keywords.html +[3]: appendix-02-operators.html diff --git a/src/doc/book/redirects/testing.md b/src/doc/book/redirects/testing.md index 79b325b8ed..f2030654fd 100644 --- a/src/doc/book/redirects/testing.md +++ b/src/doc/book/redirects/testing.md @@ -17,9 +17,9 @@ mod tests { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 11.00 — Testing][2]** +* **[in the current edition: Ch 11.00 — Testing][2]** * [In the first edition: Ch 4.2 — Testing][1] -[1]: first-edition/testing.html -[2]: second-edition/ch11-00-testing.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/testing.html +[2]: ch11-00-testing.html diff --git a/src/doc/book/redirects/trait-objects.md b/src/doc/book/redirects/trait-objects.md index 869df02062..3200e26a15 100644 --- a/src/doc/book/redirects/trait-objects.md +++ b/src/doc/book/redirects/trait-objects.md @@ -60,9 +60,9 @@ fn main() { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 17.02 — Trait Objects][2]** +* **[in the current edition: Ch 17.02 — Trait Objects][2]** * [In the first edition: Ch 3.22 — Trait Objects][1] -[1]: first-edition/trait-objects.html -[2]: second-edition/ch17-02-trait-objects.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/trait-objects.html +[2]: ch17-02-trait-objects.html diff --git a/src/doc/book/redirects/traits.md b/src/doc/book/redirects/traits.md index baffad4a43..dcb577e97b 100644 --- a/src/doc/book/redirects/traits.md +++ b/src/doc/book/redirects/traits.md @@ -14,11 +14,11 @@ pub trait Summarizable { Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 10.02 — Traits][2]** -* [In the second edition: Ch 19.03 — Advanced Traits][3] +* **[in the current edition: Ch 10.02 — Traits][2]** +* [in the current edition: Ch 19.03 — Advanced Traits][3] * [In the first edition: Ch 3.19 — Traits][1] -[1]: first-edition/traits.html -[2]: second-edition/ch10-02-traits.html -[3]: second-edition/ch19-03-advanced-traits.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/traits.html +[2]: ch10-02-traits.html +[3]: ch19-03-advanced-traits.html diff --git a/src/doc/book/redirects/unsafe.md b/src/doc/book/redirects/unsafe.md index 73685fc83d..8628c7aa95 100644 --- a/src/doc/book/redirects/unsafe.md +++ b/src/doc/book/redirects/unsafe.md @@ -8,11 +8,11 @@ Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 19.01 — Unsafe Rust][2]** +* **[in the current edition: Ch 19.01 — Unsafe Rust][2]** * [The Rustonomicon, The Dark Arts of Advanced and Unsafe Rust Programming][3] * [In the first edition: Ch 3.36 — `unsafe`][1] -[1]: first-edition/unsafe.html -[2]: second-edition/ch19-01-unsafe-rust.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/unsafe.html +[2]: ch19-01-unsafe-rust.html [3]: ../nomicon/index.html diff --git a/src/doc/book/redirects/using-rust-without-the-standard-library.md b/src/doc/book/redirects/using-rust-without-the-standard-library.md index 06deb6ee46..75145429d4 100644 --- a/src/doc/book/redirects/using-rust-without-the-standard-library.md +++ b/src/doc/book/redirects/using-rust-without-the-standard-library.md @@ -13,5 +13,5 @@ This particular chapter has moved to [the Unstable Book][2]. * [In the first edition: Ch 4.12 — Using Rust without the Standard Library][1] -[1]: first-edition/using-rust-without-the-standard-library.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/using-rust-without-the-standard-library.html [2]: ../unstable-book/language-features/lang-items.html#writing-an-executable-without-stdlib diff --git a/src/doc/book/redirects/vectors.md b/src/doc/book/redirects/vectors.md index ac05844842..1359f9da84 100644 --- a/src/doc/book/redirects/vectors.md +++ b/src/doc/book/redirects/vectors.md @@ -14,10 +14,10 @@ let numbers = vec![1, 2, 3]; Here are the relevant sections in the new and old books: -* **[In the second edition: Ch 8.01 — Vectors][2]** +* **[in the current edition: Ch 8.01 — Vectors][2]** * [In the first edition: Ch 3.7 — Vectors][1] -[1]: first-edition/vectors.html -[2]: second-edition/ch08-01-vectors.html +[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/vectors.html +[2]: ch08-01-vectors.html diff --git a/src/doc/book/src/appendix-03-derivable-traits.md b/src/doc/book/src/appendix-03-derivable-traits.md index 5619a93c21..767069b8f9 100644 --- a/src/doc/book/src/appendix-03-derivable-traits.md +++ b/src/doc/book/src/appendix-03-derivable-traits.md @@ -15,7 +15,7 @@ library that you can use with `derive`. Each section covers: * Examples of operations that require the trait If you want different behavior than that provided by the `derive` attribute, -consult the [standard library documentation](../std/index.html) +consult the [standard library documentation](../std/index.html) for each trait for details of how to manually implement them. The rest of the traits defined in the standard library can’t be implemented on diff --git a/src/doc/book/src/ch00-00-introduction.md b/src/doc/book/src/ch00-00-introduction.md index 0e86defd5f..0fea85ccab 100644 --- a/src/doc/book/src/ch00-00-introduction.md +++ b/src/doc/book/src/ch00-00-introduction.md @@ -188,4 +188,4 @@ doesn’t compile. The source files from which this book is generated can be found on [GitHub][book]. -[book]: https://github.com/rust-lang/book/tree/master/2018-edition/src +[book]: https://github.com/rust-lang/book/tree/master/src diff --git a/src/doc/book/src/ch02-00-guessing-game-tutorial.md b/src/doc/book/src/ch02-00-guessing-game-tutorial.md index f96d51e998..e5a39eee63 100644 --- a/src/doc/book/src/ch02-00-guessing-game-tutorial.md +++ b/src/doc/book/src/ch02-00-guessing-game-tutorial.md @@ -35,6 +35,7 @@ Look at the generated *Cargo.toml* file: name = "guessing_game" version = "0.1.0" authors = ["Your Name "] +edition = "2018" [dependencies] ``` @@ -169,12 +170,12 @@ let mut bar = 5; // mutable > line. Rust ignores everything in comments, which are discussed in more detail > in Chapter 3. -Now you know that `let mut guess` will introduce a mutable variable named -`guess`. On the other side of the equal sign (`=`) is the value that `guess` is -bound to, which is the result of calling `String::new`, a function that returns -a new instance of a `String`. [`String`][string] is a string -type provided by the standard library that is a growable, UTF-8 encoded bit of -text. +Let's return to the guessing game program. You now know that `let mut guess` +will introduce a mutable variable named `guess`. On the other side of the equal +sign (`=`) is the value that `guess` is bound to, which is the result of +calling `String::new`, a function that returns a new instance of a `String`. +[`String`][string] is a string type provided by the standard +library that is a growable, UTF-8 encoded bit of text. [string]: ../std/string/struct.String.html @@ -271,14 +272,14 @@ The `Err` variant means the operation failed, and `Err` contains information about how or why the operation failed. The purpose of these `Result` types is to encode error-handling information. -Values of the `Result` type, like any type, have methods defined on them. An -instance of `io::Result` has an [`expect` method][expect] that -you can call. If this instance of `io::Result` is an `Err` value, `expect` will -cause the program to crash and display the message that you passed as an -argument to `expect`. If the `read_line` method returns an `Err`, it would -likely be the result of an error coming from the underlying operating system. -If this instance of `io::Result` is an `Ok` value, `expect` will take the -return value that `Ok` is holding and return just that value to you so you +Values of the `Result` type, like values of any type, have methods defined on +them. An instance of `io::Result` has an [`expect` method][expect] that you can call. If this instance of `io::Result` is an `Err` value, +`expect` will cause the program to crash and display the message that you +passed as an argument to `expect`. If the `read_line` method returns an `Err`, +it would likely be the result of an error coming from the underlying operating +system. If this instance of `io::Result` is an `Ok` value, `expect` will take +the return value that `Ok` is holding and return just that value to you so you can use it. In this case, that value is the number of bytes in what the user entered into standard input. @@ -302,7 +303,7 @@ Rust warns that you haven’t used the `Result` value returned from `read_line`, indicating that the program hasn’t handled a possible error. The right way to suppress the warning is to actually write error handling, but -since you just want to crash this program when a problem occurs, you can use +because you just want to crash this program when a problem occurs, you can use `expect`. You’ll learn about recovering from errors in Chapter 9. ### Printing Values with `println!` Placeholders @@ -392,7 +393,7 @@ version 0.3.14.” [semver]: http://semver.org Now, without changing any of the code, let’s build the project, as shown in -Listing 2-2: +Listing 2-2. ```text $ cargo build @@ -450,7 +451,7 @@ your part of the code. Cargo has a mechanism that ensures you can rebuild the same artifact every time you or anyone else builds your code: Cargo will use only the versions of the dependencies you specified until you indicate otherwise. For example, what -happens if next week version `v0.3.15` of the `rand` crate comes out and +happens if next week version 0.3.15 of the `rand` crate comes out and contains an important bug fix but also contains a regression that will break your code? @@ -510,7 +511,7 @@ from a number of packages. ### Generating a Random Number Now that you’ve added the `rand` crate to *Cargo.toml*, let’s start using -`rand`. The next step is to update *src/main.rs*, as shown in Listing 2-3: +`rand`. The next step is to update *src/main.rs*, as shown in Listing 2-3. Filename: src/main.rs @@ -608,6 +609,7 @@ use std::cmp::Ordering; use rand::Rng; fn main() { + // ---snip--- println!("You guessed: {}", guess); @@ -629,9 +631,8 @@ The first new bit here is another `use` statement, bringing a type called `Greater`, and `Equal`. These are the three outcomes that are possible when you compare two values. -Then we add five new lines at the bottom that use the `Ordering` type. - -The `cmp` method compares two values and can be called on anything that can be +Then we add five new lines at the bottom that use the `Ordering` type. The +`cmp` method compares two values and can be called on anything that can be compared. It takes a reference to whatever you want to compare with: here it’s comparing the `guess` to the `secret_number`. Then it returns a variant of the `Ordering` enum we brought into scope with the `use` statement. We use a @@ -729,7 +730,7 @@ a variable named `guess`? It does, but Rust allows us to *shadow* the previous value of `guess` with a new one. This feature is often used in situations in which you want to convert a value from one type to another type. Shadowing lets us reuse the `guess` variable name rather than forcing us to create two unique -variables, like `guess_str` and `guess` for example. (Chapter 3 covers +variables, such as `guess_str` and `guess` for example. (Chapter 3 covers shadowing in more detail.) We bind `guess` to the expression `guess.trim().parse()`. The `guess` in the @@ -774,7 +775,7 @@ Let’s run the program now! $ cargo run Compiling guessing_game v0.1.0 (file:///projects/guessing_game) Finished dev [unoptimized + debuginfo] target(s) in 0.43 secs - Running `target/guessing_game` + Running `target/debug/guessing_game` Guess the number! The secret number is: 58 Please input your guess. @@ -834,7 +835,7 @@ shown here: $ cargo run Compiling guessing_game v0.1.0 (file:///projects/guessing_game) Finished dev [unoptimized + debuginfo] target(s) in 1.50 secs - Running `target/guessing_game` + Running `target/debug/guessing_game` Guess the number! The secret number is: 59 Please input your guess. @@ -890,15 +891,29 @@ exiting the program, because the loop is the last part of `main`. To further refine the game’s behavior, rather than crashing the program when the user inputs a non-number, let’s make the game ignore a non-number so the user can continue guessing. We can do that by altering the line where `guess` -is converted from a `String` to a `u32`: +is converted from a `String` to a `u32`, as shown in Listing 2-5. + +Filename: src/main.rs ```rust,ignore +// --snip-- + +io::stdin().read_line(&mut guess) + .expect("Failed to read line"); + let guess: u32 = match guess.trim().parse() { Ok(num) => num, Err(_) => continue, }; + +println!("You guessed: {}", guess); + +// --snip-- ``` +Listing 2-5: Ignoring a non-number guess and asking for +another guess instead of crashing the program + Switching from an `expect` call to a `match` expression is how you generally move from crashing on an error to handling the error. Remember that `parse` returns a `Result` type and `Result` is an enum that has the variants `Ok` or @@ -917,16 +932,16 @@ does not match the `Ok(num)` pattern in the first `match` arm, but it does match the `Err(_)` pattern in the second arm. The underscore, `_`, is a catchall value; in this example, we’re saying we want to match all `Err` values, no matter what information they have inside them. So the program will -execute the second arm’s code, `continue`, which means to go to the next -iteration of the `loop` and ask for another guess. So effectively, the program -ignores all errors that `parse` might encounter! +execute the second arm’s code, `continue`, which tells the program to go to the +next iteration of the `loop` and ask for another guess. So effectively, the +program ignores all errors that `parse` might encounter! Now everything in the program should work as expected. Let’s try it: ```text $ cargo run Compiling guessing_game v0.1.0 (file:///projects/guessing_game) - Running `target/guessing_game` + Running `target/debug/guessing_game` Guess the number! The secret number is: 61 Please input your guess. @@ -948,7 +963,7 @@ You win! Awesome! With one tiny final tweak, we will finish the guessing game. Recall that the program is still printing the secret number. That worked well for testing, but it ruins the game. Let’s delete the `println!` that outputs the -secret number. Listing 2-5 shows the final code: +secret number. Listing 2-6 shows the final code. Filename: src/main.rs @@ -989,11 +1004,11 @@ fn main() { } ``` -Listing 2-5: Complete guessing game code +Listing 2-6: Complete guessing game code ## Summary -At this point, you’ve successfully built the guessing game! Congratulations! +At this point, you’ve successfully built the guessing game. Congratulations! This project was a hands-on way to introduce you to many new Rust concepts: `let`, `match`, methods, associated functions, the use of external crates, and diff --git a/src/doc/book/src/ch03-01-variables-and-mutability.md b/src/doc/book/src/ch03-01-variables-and-mutability.md index 903dbb9c95..d92d1f441d 100644 --- a/src/doc/book/src/ch03-01-variables-and-mutability.md +++ b/src/doc/book/src/ch03-01-variables-and-mutability.md @@ -44,9 +44,9 @@ Even though compiler errors can be frustrating, they only mean your program isn’t safely doing what you want it to do yet; they do *not* mean that you’re not a good programmer! Experienced Rustaceans still get compiler errors. -The error indicates that the cause of the error is that you `cannot assign twice -to immutable variable x`, because you tried to assign a second value to the -immutable `x` variable. +The error message indicates that the cause of the error is that you `cannot +assign twice to immutable variable x`, because you tried to assign a second +value to the immutable `x` variable. It’s important that we get compile-time errors when we attempt to change a value that we previously designated as immutable because this very situation @@ -126,9 +126,9 @@ not the result of a function call or any other value that could only be computed at runtime. Here’s an example of a constant declaration where the constant’s name is -`MAX_POINTS` and its value is set to 100,000. (Rust’s constant naming -convention is to use all uppercase with underscores between words, -and underscores can be inserted in numeric literals to improve readability): +`MAX_POINTS` and its value is set to 100,000. (Rust’s naming convention for +constants is to use all uppercase with underscores between words, and +underscores can be inserted in numeric literals to improve readability): ```rust const MAX_POINTS: u32 = 100_000; @@ -147,13 +147,13 @@ hardcoded value needed to be updated in the future. ### Shadowing -As you saw in the “Comparing the Guess to the Secret Number” section in Chapter -2, you can declare a new variable with the same name as a previous variable, -and the new variable shadows the previous variable. Rustaceans say that the -first variable is *shadowed* by the second, which means that the second -variable’s value is what appears when the variable is used. We can shadow a -variable by using the same variable’s name and repeating the use of the `let` -keyword as follows: +As you saw in the guessing game tutorial in the “Comparing the Guess to the +Secret Number” section in Chapter 2, you can declare a new variable with the +same name as a previous variable, and the new variable shadows the previous +variable. Rustaceans say that the first variable is *shadowed* by the second, +which means that the second variable’s value is what appears when the variable +is used. We can shadow a variable by using the same variable’s name and +repeating the use of the `let` keyword as follows: Filename: src/main.rs diff --git a/src/doc/book/src/ch03-02-data-types.md b/src/doc/book/src/ch03-02-data-types.md index b078ac4ff6..7a6305923c 100644 --- a/src/doc/book/src/ch03-02-data-types.md +++ b/src/doc/book/src/ch03-02-data-types.md @@ -184,7 +184,7 @@ fn main() { } ``` -The main way to consume Boolean values is through conditionals, such as an `if` +The main way to use Boolean values is through conditionals, such as an `if` expression. We’ll cover how `if` expressions work in Rust in the “Control Flow” section. @@ -302,7 +302,7 @@ fn main() { ``` Arrays are useful when you want your data allocated on the stack rather than -the heap (we will discuss the stack and the heap more in Chapter 4), or when +the heap (we will discuss the stack and the heap more in Chapter 4) or when you want to ensure you always have a fixed number of elements. An array isn’t as flexible as the vector type, though. A vector is a similar collection type provided by the standard library that *is* allowed to grow or shrink in size. diff --git a/src/doc/book/src/ch03-03-how-functions-work.md b/src/doc/book/src/ch03-03-how-functions-work.md index 1c526504da..1f6b082b00 100644 --- a/src/doc/book/src/ch03-03-how-functions-work.md +++ b/src/doc/book/src/ch03-03-how-functions-work.md @@ -133,24 +133,22 @@ The value of y is: 6 Because we called the function with `5` as the value for `x` and `6` is passed as the value for `y`, the two strings are printed with these values. -### Function Bodies +### Function Bodies Contain Statements and Expressions Function bodies are made up of a series of statements optionally ending in an expression. So far, we’ve only covered functions without an ending expression, -but you have seen an expression as part of statements. Because Rust is an +but you have seen an expression as part of a statement. Because Rust is an expression-based language, this is an important distinction to understand. Other languages don’t have the same distinctions, so let’s look at what statements and expressions are and how their differences affect the bodies of functions. -### Statements and Expressions - We’ve actually already used statements and expressions. *Statements* are instructions that perform some action and do not return a value. *Expressions* evaluate to a resulting value. Let’s look at some examples. Creating a variable and assigning a value to it with the `let` keyword is a -statement. In Listing 3-1, `let y = 6;` is a statement: +statement. In Listing 3-1, `let y = 6;` is a statement. Filename: src/main.rs diff --git a/src/doc/book/src/ch03-04-comments.md b/src/doc/book/src/ch03-04-comments.md index 389e8552fd..7d6281e9cf 100644 --- a/src/doc/book/src/ch03-04-comments.md +++ b/src/doc/book/src/ch03-04-comments.md @@ -8,7 +8,7 @@ reading the source code may find useful. Here’s a simple comment: ```rust -// Hello, world. +// hello, world ``` In Rust, comments must start with two slashes and continue until the end of the @@ -27,7 +27,7 @@ Comments can also be placed at the end of lines containing code: ```rust fn main() { - let lucky_number = 7; // I’m feeling lucky today. + let lucky_number = 7; // I’m feeling lucky today } ``` @@ -38,7 +38,7 @@ separate line above the code it’s annotating: ```rust fn main() { - // I’m feeling lucky today. + // I’m feeling lucky today let lucky_number = 7; } ``` diff --git a/src/doc/book/src/ch03-05-control-flow.md b/src/doc/book/src/ch03-05-control-flow.md index 7874ae3c1e..504fc54707 100644 --- a/src/doc/book/src/ch03-05-control-flow.md +++ b/src/doc/book/src/ch03-05-control-flow.md @@ -74,7 +74,8 @@ condition was false ``` It’s also worth noting that the condition in this code *must* be a `bool`. If -the condition isn’t a `bool`, we’ll get an error. For example: +the condition isn’t a `bool`, we’ll get an error. For example, try running the +following code: Filename: src/main.rs @@ -171,7 +172,7 @@ Rust branching construct called `match` for these cases. #### Using `if` in a `let` Statement Because `if` is an expression, we can use it on the right side of a `let` -statement, as in Listing 3-2: +statement, as in Listing 3-2. Filename: src/main.rs @@ -226,9 +227,9 @@ fn main() { } ``` -When we try to compile this code, we’ll get an error. The `if` and `else` arms have -value types that are incompatible, and Rust indicates exactly where to find the -problem in the program: +When we try to compile this code, we’ll get an error. The `if` and `else` arms +have value types that are incompatible, and Rust indicates exactly where to +find the problem in the program: ```text error[E0308]: if and else have incompatible types @@ -306,9 +307,8 @@ depending on where the code was in the loop when it received the halt signal. Fortunately, Rust provides another, more reliable way to break out of a loop. You can place the `break` keyword within the loop to tell the program when to stop executing the loop. Recall that we did this in the guessing game in the -“Quitting After a Correct Guess” section of Chapter 2 to exit the -program when the user won the game by guessing the correct number. - +“Quitting After a Correct Guess” section of Chapter 2 to exit the program when +the user won the game by guessing the correct number. #### Returning from loops @@ -372,7 +372,7 @@ true, the code runs; otherwise, it exits the loop. #### Looping Through a Collection with `for` You could use the `while` construct to loop over the elements of a collection, -such as an array. For example, let’s look at Listing 3-4: +such as an array. For example, let’s look at Listing 3-4. Filename: src/main.rs @@ -419,7 +419,7 @@ code to perform the conditional check on every element on every iteration through the loop. As a more concise alternative, you can use a `for` loop and execute some code -for each item in a collection. A `for` loop looks like this code in Listing 3-5: +for each item in a collection. A `for` loop looks like the code in Listing 3-5. Filename: src/main.rs @@ -480,7 +480,7 @@ programs to do the following: * Convert temperatures between Fahrenheit and Celsius. * Generate the nth Fibonacci number. * Print the lyrics to the Christmas carol “The Twelve Days of Christmas,” -taking advantage of the repetition in the song. + taking advantage of the repetition in the song. When you’re ready to move on, we’ll talk about a concept in Rust that *doesn’t* commonly exist in other programming languages: ownership. diff --git a/src/doc/book/src/ch04-01-what-is-ownership.md b/src/doc/book/src/ch04-01-what-is-ownership.md index 74d4029209..ec6db2b67a 100644 --- a/src/doc/book/src/ch04-01-what-is-ownership.md +++ b/src/doc/book/src/ch04-01-what-is-ownership.md @@ -87,9 +87,9 @@ strings. First, let’s take a look at the ownership rules. Keep these rules in mind as we work through the examples that illustrate them: -> 1. Each value in Rust has a variable that’s called its *owner*. -> 2. There can only be one owner at a time. -> 3. When the owner goes out of scope, the value will be dropped. +* Each value in Rust has a variable that’s called its *owner*. +* There can only be one owner at a time. +* When the owner goes out of scope, the value will be dropped. ### Variable Scope @@ -111,7 +111,7 @@ let s = "hello"; The variable `s` refers to a string literal, where the value of the string is hardcoded into the text of our program. The variable is valid from the point at which it’s declared until the end of the current *scope*. Listing 4-1 has -comments annotating where the variable `s` is valid: +comments annotating where the variable `s` is valid. ```rust { // s is not valid here, it’s not yet declared @@ -226,7 +226,7 @@ There is a natural point at which we can return the memory our `String` needs to the operating system: when `s` goes out of scope. When a variable goes out of scope, Rust calls a special function for us. This function is called `drop`, and it’s where the author of `String` can put the code to return the memory. -Rust calls `drop` automatically at the closing `}`. +Rust calls `drop` automatically at the closing curly bracket. > Note: In C++, this pattern of deallocating resources at the end of an item’s > lifetime is sometimes called *Resource Acquisition Is Initialization (RAII)*. @@ -241,7 +241,7 @@ we’ve allocated on the heap. Let’s explore some of those situations now. #### Ways Variables and Data Interact: Move Multiple variables can interact with the same data in different ways in Rust. -Let’s look at an example using an integer in Listing 4-2: +Let’s look at an example using an integer in Listing 4-2. ```rust let x = 5; @@ -347,7 +347,7 @@ If you’ve heard the terms *shallow copy* and *deep copy* while working with other languages, the concept of copying the pointer, length, and capacity without copying the data probably sounds like making a shallow copy. But because Rust also invalidates the first variable, instead of being called a -shallow copy, it’s known as a *move*. Here we would read this by saying that +shallow copy, it’s known as a *move*. In this example, we would say that `s1` was *moved* into `s2`. So what actually happens is shown in Figure 4-4. s1 moved to s2 @@ -388,7 +388,7 @@ different is going on. #### Stack-Only Data: Copy There’s another wrinkle we haven’t talked about yet. This code using integers, -part of which was shown earlier in Listing 4-2, works and is valid: +part of which was shown in Listing 4-2, works and is valid: ```rust let x = 5; @@ -413,7 +413,7 @@ in Chapter 10). If a type has the `Copy` trait, an older variable is still usable after assignment. Rust won’t let us annotate a type with the `Copy` trait if the type, or any of its parts, has implemented the `Drop` trait. If the type needs something special to happen when the value goes out of scope and -we add the `Copy` annotation to that type, we’ll get a compile time error. To +we add the `Copy` annotation to that type, we’ll get a compile-time error. To learn about how to add the `Copy` annotation to your type, see “Derivable Traits” in Appendix C. @@ -434,7 +434,7 @@ be sure, but as a general rule, any group of simple scalar values can be The semantics for passing a value to a function are similar to those for assigning a value to a variable. Passing a variable to a function will move or copy, just as assignment does. Listing 4-3 has an example with some annotations -showing where variables go into and out of scope: +showing where variables go into and out of scope. Filename: src/main.rs @@ -468,14 +468,14 @@ fn makes_copy(some_integer: i32) { // some_integer comes into scope annotated If we tried to use `s` after the call to `takes_ownership`, Rust would throw a -compile time error. These static checks protect us from mistakes. Try adding +compile-time error. These static checks protect us from mistakes. Try adding code to `main` that uses `s` and `x` to see where you can use them and where the ownership rules prevent you from doing so. ### Return Values and Scope Returning values can also transfer ownership. Listing 4-4 is an example with -similar annotations to those in Listing 4-3: +similar annotations to those in Listing 4-3. Filename: src/main.rs @@ -500,10 +500,10 @@ fn gives_ownership() -> String { // gives_ownership will move its some_string // some_string is returned and // moves out to the calling - // function. + // function } -// takes_and_gives_back will take a String and return one. +// takes_and_gives_back will take a String and return one fn takes_and_gives_back(a_string: String) -> String { // a_string comes into // scope @@ -525,7 +525,7 @@ It’s quite annoying that anything we pass in also needs to be passed back if w want to use it again, in addition to any data resulting from the body of the function that we might want to return as well. -It’s possible to return multiple values using a tuple, as shown in Listing 4-5: +It’s possible to return multiple values using a tuple, as shown in Listing 4-5. Filename: src/main.rs diff --git a/src/doc/book/src/ch04-02-references-and-borrowing.md b/src/doc/book/src/ch04-02-references-and-borrowing.md index cf37e1aca4..5f572832f6 100644 --- a/src/doc/book/src/ch04-02-references-and-borrowing.md +++ b/src/doc/book/src/ch04-02-references-and-borrowing.md @@ -134,7 +134,7 @@ First, we had to change `s` to be `mut`. Then we had to create a mutable reference with `&mut s` and accept a mutable reference with `some_string: &mut String`. -But mutable references have one big restriction: you can only have one mutable +But mutable references have one big restriction: you can have only one mutable reference to a particular piece of data in a particular scope. This code will fail: @@ -217,7 +217,7 @@ error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immuta 5 | let r2 = &s; // no problem 6 | let r3 = &mut s; // BIG PROBLEM | ^^^^^^ mutable borrow occurs here -7 | +7 | 8 | println!("{}, {}, and {}", r1, r2, r3); | -- borrow later used here ``` @@ -264,7 +264,7 @@ Here’s the error: ```text error[E0106]: missing lifetime specifier - --> dangle.rs:5:16 + --> main.rs:5:16 | 5 | fn dangle() -> &String { | ^ expected lifetime parameter @@ -274,10 +274,9 @@ error[E0106]: missing lifetime specifier = help: consider giving it a 'static lifetime ``` -This error message refers to a feature we haven’t covered yet: *lifetimes*. -We’ll discuss lifetimes in detail in Chapter 10. But, if you disregard the -parts about lifetimes, the message does contain the key to why this code is a -problem: +This error message refers to a feature we haven’t covered yet: lifetimes. We’ll +discuss lifetimes in detail in Chapter 10. But, if you disregard the parts +about lifetimes, the message does contain the key to why this code is a problem: ```text this function's return type contains a borrowed value, but there is no value @@ -319,8 +318,8 @@ deallocated. Let’s recap what we’ve discussed about references: -* At any given time, you can have *either* (but not both of) one mutable - reference or any number of immutable references. +* At any given time, you can have *either* one mutable reference *or* any + number of immutable references. * References must always be valid. Next, we’ll look at a different kind of reference: slices. diff --git a/src/doc/book/src/ch04-03-slices.md b/src/doc/book/src/ch04-03-slices.md index 429bd187d8..9ab0e833a3 100644 --- a/src/doc/book/src/ch04-03-slices.md +++ b/src/doc/book/src/ch04-03-slices.md @@ -18,7 +18,7 @@ fn first_word(s: &String) -> ? This function, `first_word`, has a `&String` as a parameter. We don’t want ownership, so this is fine. But what should we return? We don’t really have a way to talk about *part* of a string. However, we could return the index of the -end of the word. Let’s try that, as shown in Listing 4-7: +end of the word. Let’s try that, as shown in Listing 4-7. Filename: src/main.rs @@ -75,6 +75,7 @@ Otherwise, we return the length of the string by using `s.len()`: return i; } } + s.len() ``` @@ -83,7 +84,7 @@ string, but there’s a problem. We’re returning a `usize` on its own, but it only a meaningful number in the context of the `&String`. In other words, because it’s a separate value from the `String`, there’s no guarantee that it will still be valid in the future. Consider the program in Listing 4-8 that -uses the `first_word` function from Listing 4-7: +uses the `first_word` function from Listing 4-7. Filename: src/main.rs @@ -105,7 +106,7 @@ fn main() { let word = first_word(&s); // word will get the value 5 - s.clear(); // This empties the String, making it equal to "" + s.clear(); // this empties the String, making it equal to "" // word still has the value 5 here, but there's no more string that // we could meaningfully use the value 5 with. word is now totally invalid! @@ -169,7 +170,7 @@ in the slice and `ending_index` is one more than the last position in the slice. Internally, the slice data structure stores the starting position and the length of the slice, which corresponds to `ending_index` minus `starting_index`. So in the case of `let world = &s[6..11];`, `world` would be -a slice that contains a pointer to the 7th byte of `s` and a length value of 5. +a slice that contains a pointer to the 7th byte of `s` with a length value of 5. Figure 4-6 shows this in a diagram. @@ -216,8 +217,8 @@ let slice = &s[..]; > boundaries. If you attempt to create a string slice in the middle of a > multibyte character, your program will exit with an error. For the purposes > of introducing string slices, we are assuming ASCII only in this section; a -> more thorough discussion of UTF-8 handling is in the “Strings” section of -> Chapter 8. +> more thorough discussion of UTF-8 handling is in the “Storing UTF-8 Encoded +> Text with Strings” section of Chapter 8. With all this information in mind, let’s rewrite `first_word` to return a slice. The type that signifies “string slice” is written as `&str`: @@ -261,7 +262,7 @@ logically incorrect but didn’t show any immediate errors. The problems would show up later if we kept trying to use the first word index with an emptied string. Slices make this bug impossible and let us know we have a problem with our code much sooner. Using the slice version of `first_word` will throw a -compile time error: +compile-time error: Filename: src/main.rs @@ -271,7 +272,7 @@ fn main() { let word = first_word(&s); - s.clear(); // Error! + s.clear(); // error! println!("the first word is: {}", word); } @@ -285,10 +286,10 @@ error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immuta | 8 | let word = first_word(&s); | -- immutable borrow occurs here -9 | -10 | s.clear(); // Error! +9 | +10 | s.clear(); // error! | ^^^^^^^^^ mutable borrow occurs here -11 | +11 | 12 | println!("the first word is: {}", word); | ---- borrow later used here ``` @@ -314,20 +315,24 @@ immutable reference. #### String Slices as Parameters -Knowing that you can take slices of literals and `String`s leads us to one more -improvement on `first_word`, and that’s its signature: +Knowing that you can take slices of literals and `String` values leads us to +one more improvement on `first_word`, and that’s its signature: ```rust,ignore fn first_word(s: &String) -> &str { ``` -A more experienced Rustacean would write the following line instead because it -allows us to use the same function on both `String`s and `&str`s: +A more experienced Rustacean would write the signature shown in Listing 4-9 +instead because it allows us to use the same function on both `String` values +and `&str` values. ```rust,ignore fn first_word(s: &str) -> &str { ``` +Listing 4-9: Improving the `first_word` function by using +a string slice for the type of the `s` parameter + If we have a string slice, we can pass that directly. If we have a `String`, we can pass a slice of the entire `String`. Defining a function to take a string slice instead of a reference to a `String` makes our API more general and useful diff --git a/src/doc/book/src/ch05-01-defining-structs.md b/src/doc/book/src/ch05-01-defining-structs.md index ae177b238f..f08b45bde7 100644 --- a/src/doc/book/src/ch05-01-defining-structs.md +++ b/src/doc/book/src/ch05-01-defining-structs.md @@ -10,7 +10,7 @@ To define a struct, we enter the keyword `struct` and name the entire struct. A struct’s name should describe the significance of the pieces of data being grouped together. Then, inside curly brackets, we define the names and types of the pieces of data, which we call *fields*. For example, Listing 5-1 shows a -struct that stores information about a user account: +struct that stores information about a user account. ```rust struct User { @@ -31,7 +31,7 @@ data we want to store in those fields. We don’t have to specify the fields in the same order in which we declared them in the struct. In other words, the struct definition is like a general template for the type, and instances fill in that template with particular data to create values of the type. For -example, we can declare a particular user as shown in Listing 5-2: +example, we can declare a particular user as shown in Listing 5-2. ```rust # struct User { @@ -56,7 +56,7 @@ To get a specific value from a struct, we can use dot notation. If we wanted just this user’s email address, we could use `user1.email` wherever we wanted to use this value. If the instance is mutable, we can change a value by using the dot notation and assigning into a particular field. Listing 5-3 shows how -to change the value in the `email` field of a mutable `User` instance: +to change the value in the `email` field of a mutable `User` instance. ```rust # struct User { @@ -80,10 +80,10 @@ user1.email = String::from("anotheremail@example.com"); `User` instance Note that the entire instance must be mutable; Rust doesn’t allow us to mark -only certain fields as mutable. +only certain fields as mutable. As with any expression, we can construct a new +instance of the struct as the last expression in the function body to +implicitly return that new instance. -As with any expression, we can construct a new instance of the struct as the -last expression in the function body to implicitly return that new instance. Listing 5-4 shows a `build_user` function that returns a `User` instance with the given email and username. The `active` field gets the value of `true`, and the `sign_in_count` gets a value of `1`. @@ -119,7 +119,7 @@ would get even more annoying. Luckily, there’s a convenient shorthand! Because the parameter names and the struct field names are exactly the same in Listing 5-4, we can use the *field init shorthand* syntax to rewrite `build_user` so that it behaves exactly the same but doesn’t have the -repetition of `email` and `username` as shown in Listing 5-5. +repetition of `email` and `username`, as shown in Listing 5-5. ```rust # struct User { @@ -156,7 +156,7 @@ instance’s values but changes some. You’ll do this using *struct update synt First, Listing 5-6 shows how we create a new `User` instance in `user2` without the update syntax. We set new values for `email` and `username` but otherwise -use the same values from `user1` that we created in Listing 5-2: +use the same values from `user1` that we created in Listing 5-2. ```rust # struct User { @@ -218,7 +218,7 @@ The code in Listing 5-7 also creates an instance in `user2` that has a different value for `email` and `username` but has the same values for the `active` and `sign_in_count` fields from `user1`. -### Tuple Structs without Named Fields to Create Different Types +### Using Tuple Structs without Named Fields to Create Different Types You can also define structs that look similar to tuples, called *tuple structs*. Tuple structs have the added meaning the struct name provides but @@ -227,7 +227,7 @@ of the fields. Tuple structs are useful when you want to give the whole tuple a name and make the tuple be a different type than other tuples, and naming each field as in a regular struct would be verbose or redundant. -To define a tuple struct start with the `struct` keyword and the struct name +To define a tuple struct, start with the `struct` keyword and the struct name followed by the types in the tuple. For example, here are definitions and usages of two tuple structs named `Color` and `Point`: diff --git a/src/doc/book/src/ch05-02-example-structs.md b/src/doc/book/src/ch05-02-example-structs.md index 55eeb84fe2..6f4d9c5710 100644 --- a/src/doc/book/src/ch05-02-example-structs.md +++ b/src/doc/book/src/ch05-02-example-structs.md @@ -7,7 +7,7 @@ refactor the program until we’re using structs instead. Let’s make a new binary project with Cargo called *rectangles* that will take the width and height of a rectangle specified in pixels and calculate the area of the rectangle. Listing 5-8 shows a short program with one way of doing -exactly that in our project’s *src/main.rs*: +exactly that in our project’s *src/main.rs*. Filename: src/main.rs @@ -55,7 +55,7 @@ we might do that in “The Tuple Type” section of Chapter 3: by using tuples. ### Refactoring with Tuples -Listing 5-9 shows another version of our program that uses tuples: +Listing 5-9 shows another version of our program that uses tuples. Filename: src/main.rs @@ -94,7 +94,7 @@ our code. We use structs to add meaning by labeling the data. We can transform the tuple we’re using into a data type with a name for the whole as well as names for the -parts, as shown in Listing 5-10: +parts, as shown in Listing 5-10. Filename: src/main.rs @@ -144,7 +144,7 @@ and `1`. This is a win for clarity. It’d be nice to be able to print an instance of `Rectangle` while we’re debugging our program and see the values for all its fields. Listing 5-11 tries using the `println!` macro as we have used in previous chapters. This won’t -work, however: +work, however. Filename: src/main.rs @@ -170,7 +170,7 @@ When we run this code, we get an error with this core message: error[E0277]: the trait bound `Rectangle: std::fmt::Display` is not satisfied ``` -The `println!` macro can do many kinds of formatting, and by default, curly +The `println!` macro can do many kinds of formatting, and by default, the curly brackets tell `println!` to use formatting known as `Display`: output intended for direct end user consumption. The primitive types we’ve seen so far implement `Display` by default, because there’s only one way you’d want to show @@ -190,9 +190,9 @@ If we continue reading the errors, we’ll find this helpful note: Let’s try it! The `println!` macro call will now look like `println!("rect1 is {:?}", rect1);`. Putting the specifier `:?` inside the curly brackets tells -`println!` we want to use an output format called `Debug`. `Debug` is a trait -that enables us to print our struct in a way that is useful for developers so -we can see its value while we’re debugging our code. +`println!` we want to use an output format called `Debug`. The `Debug` trait +enables us to print our struct in a way that is useful for developers so we can +see its value while we’re debugging our code. Run the code with this change. Drat! We still get an error: @@ -210,7 +210,7 @@ crate, add `#[derive(Debug)]` or manually implement it Rust *does* include functionality to print out debugging information, but we have to explicitly opt in to make that functionality available for our struct. To do that, we add the annotation `#[derive(Debug)]` just before the struct -definition, as shown in Listing 5-12: +definition, as shown in Listing 5-12. Filename: src/main.rs @@ -253,9 +253,8 @@ rect1 is Rectangle { Rust has provided a number of traits for us to use with the `derive` annotation that can add useful behavior to our custom types. Those traits and their -behaviors are listed in Appendix C, “Derivable Traits.” We’ll cover how to -implement these traits with custom behavior as well as how to create your own -traits in Chapter 10. +behaviors are listed in Appendix C. We’ll cover how to implement these traits +with custom behavior as well as how to create your own traits in Chapter 10. Our `area` function is very specific: it only computes the area of rectangles. It would be helpful to tie this behavior more closely to our `Rectangle` diff --git a/src/doc/book/src/ch05-03-method-syntax.md b/src/doc/book/src/ch05-03-method-syntax.md index 0a3f0e1077..d8a338c9b6 100644 --- a/src/doc/book/src/ch05-03-method-syntax.md +++ b/src/doc/book/src/ch05-03-method-syntax.md @@ -12,7 +12,7 @@ instance of the struct the method is being called on. Let’s change the `area` function that has a `Rectangle` instance as a parameter and instead make an `area` method defined on the `Rectangle` struct, as shown -in Listing 5-13: +in Listing 5-13. Filename: src/main.rs @@ -125,7 +125,7 @@ struct. This time, we want an instance of `Rectangle` to take another instance of `Rectangle` and return `true` if the second `Rectangle` can fit completely within `self`; otherwise it should return `false`. That is, we want to be able to write the program shown in Listing 5-14, once we’ve defined the `can_hold` -method: +method. Filename: src/main.rs @@ -164,7 +164,7 @@ calling the `can_hold` method. The return value of `can_hold` will be a Boolean, and the implementation will check whether the width and height of `self` are both greater than the width and height of the other `Rectangle`, respectively. Let’s add the new `can_hold` method to the `impl` block from -Listing 5-13, shown in Listing 5-15: +Listing 5-13, shown in Listing 5-15. Filename: src/main.rs @@ -234,7 +234,7 @@ namespaces created by modules. We’ll discuss modules in Chapter 7. Each struct is allowed to have multiple `impl` blocks. For example, Listing 5-15 is equivalent to the code shown in Listing 5-16, which has each method -in its own `impl` block: +in its own `impl` block. ```rust # #[derive(Debug)] @@ -261,7 +261,7 @@ blocks There’s no reason to separate these methods into multiple `impl` blocks here, but this is valid syntax. We’ll see a case in which multiple `impl` blocks are -useful in Chapter 10 where we discuss generic types and traits. +useful in Chapter 10, where we discuss generic types and traits. ## Summary diff --git a/src/doc/book/src/ch06-01-defining-an-enum.md b/src/doc/book/src/ch06-01-defining-an-enum.md index cfac530e10..45317a0a2c 100644 --- a/src/doc/book/src/ch06-01-defining-an-enum.md +++ b/src/doc/book/src/ch06-01-defining-an-enum.md @@ -73,7 +73,7 @@ route(IpAddrKind::V6); Using enums has even more advantages. Thinking more about our IP address type, at the moment we don’t have a way to store the actual IP address *data*; we only know what *kind* it is. Given that you just learned about structs in -Chapter 5, you might tackle this problem as shown in Listing 6-1: +Chapter 5, you might tackle this problem as shown in Listing 6-1. ```rust enum IpAddrKind { @@ -183,7 +183,7 @@ haven’t brought the standard library’s definition into our scope. We’ll ta more about bringing types into scope in Chapter 7. Let’s look at another example of an enum in Listing 6-2: this one has a wide -variety of types embedded in its variants: +variety of types embedded in its variants. ```rust enum Message { @@ -204,7 +204,7 @@ This enum has four variants with different types: * `Write` includes a single `String`. * `ChangeColor` includes three `i32` values. -Defining an enum with variants like the ones in Listing 6-2 is similar to +Defining an enum with variants such as the ones in Listing 6-2 is similar to defining different kinds of struct definitions, except the enum doesn’t use the `struct` keyword and all the variants are grouped together under the `Message` type. The following structs could hold the same data that the preceding enum diff --git a/src/doc/book/src/ch06-02-match.md b/src/doc/book/src/ch06-02-match.md index 00a3382f9d..92668b6ae1 100644 --- a/src/doc/book/src/ch06-02-match.md +++ b/src/doc/book/src/ch06-02-match.md @@ -17,7 +17,7 @@ the value falls into the associated code block to be used during execution. Because we just mentioned coins, let’s use them as an example using `match`! We can write a function that can take an unknown United States coin and, in a similar way as the counting machine, determine which coin it is and return its -value in cents, as shown here in Listing 6-3: +value in cents, as shown here in Listing 6-3. ```rust enum Coin { @@ -100,10 +100,10 @@ From 1999 through 2008, the United States minted quarters with different designs for each of the 50 states on one side. No other coins got state designs, so only quarters have this extra value. We can add this information to our `enum` by changing the `Quarter` variant to include a `UsState` value stored -inside it, which we’ve done here in Listing 6-4: +inside it, which we’ve done here in Listing 6-4. ```rust -#[derive(Debug)] // So we can inspect the state in a minute +#[derive(Debug)] // so we can inspect the state in a minute enum UsState { Alabama, Alaska, @@ -179,7 +179,7 @@ the function should return the `None` value and not attempt to perform any operations. This function is very easy to write, thanks to `match`, and will look like -Listing 6-5: +Listing 6-5. ```rust fn plus_one(x: Option) -> Option { @@ -292,4 +292,4 @@ can say that we want to do nothing for all the possible values that we don’t list before the `_` placeholder. However, the `match` expression can be a bit wordy in a situation in which we -only care about *one* of the cases. For this situation, Rust provides `if let`. +care about only *one* of the cases. For this situation, Rust provides `if let`. diff --git a/src/doc/book/src/ch06-03-if-let.md b/src/doc/book/src/ch06-03-if-let.md index 033d339388..6583546387 100644 --- a/src/doc/book/src/ch06-03-if-let.md +++ b/src/doc/book/src/ch06-03-if-let.md @@ -3,7 +3,7 @@ The `if let` syntax lets you combine `if` and `let` into a less verbose way to handle values that match one pattern while ignoring the rest. Consider the program in Listing 6-6 that matches on an `Option` value but only wants to -execute code if the value is 3: +execute code if the value is 3. ```rust let some_u8_value = Some(0u8); @@ -31,15 +31,15 @@ if let Some(3) = some_u8_value { } ``` -The syntax `if let` takes a pattern and an expression separated by an `=`. It -works the same way as a `match`, where the expression is given to the `match` -and the pattern is its first arm. +The syntax `if let` takes a pattern and an expression separated by an equal +sign. It works the same way as a `match`, where the expression is given to the +`match` and the pattern is its first arm. -Using `if let` means you have less typing, less indentation, and less -boilerplate code. However, you lose the exhaustive checking that `match` -enforces. Choosing between `match` and `if let` depends on what you’re doing in -your particular situation and whether gaining conciseness is an appropriate -trade-off for losing exhaustive checking. +Using `if let` means less typing, less indentation, and less boilerplate code. +However, you lose the exhaustive checking that `match` enforces. Choosing +between `match` and `if let` depends on what you’re doing in your particular +situation and whether gaining conciseness is an appropriate trade-off for +losing exhaustive checking. In other words, you can think of `if let` as syntax sugar for a `match` that runs code when the value matches one pattern and then ignores all other values. diff --git a/src/doc/book/src/ch08-01-vectors.md b/src/doc/book/src/ch08-01-vectors.md index 16dc72fb37..c80c718b0f 100644 --- a/src/doc/book/src/ch08-01-vectors.md +++ b/src/doc/book/src/ch08-01-vectors.md @@ -9,7 +9,7 @@ lines of text in a file or the prices of items in a shopping cart. ### Creating a New Vector To create a new, empty vector, we can call the `Vec::new` function, as shown in -Listing 8-1: +Listing 8-1. ```rust let v: Vec = Vec::new(); @@ -32,7 +32,7 @@ store once you insert values, so you rarely need to do this type annotation. It’s more common to create a `Vec` that has initial values, and Rust provides the `vec!` macro for convenience. The macro will create a new vector that holds the values you give it. Listing 8-2 creates a new `Vec` that -holds the values `1`, `2`, and `3`: +holds the values `1`, `2`, and `3`. ```rust let v = vec![1, 2, 3]; @@ -48,7 +48,7 @@ to modify a vector. ### Updating a Vector To create a vector and then add elements to it, we can use the `push` method, -as shown in Listing 8-3: +as shown in Listing 8-3. ```rust let mut v = Vec::new(); @@ -70,7 +70,7 @@ we don’t need the `Vec` annotation. ### Dropping a Vector Drops Its Elements Like any other `struct`, a vector is freed when it goes out of scope, as -annotated in Listing 8-4: +annotated in Listing 8-4. ```rust { @@ -96,32 +96,22 @@ read their contents is a good next step. There are two ways to reference a value stored in a vector. In the examples, we’ve annotated the types of the values that are returned from these functions for extra clarity. -Listing 8-5 shows the method of accessing a value in a vector with -indexing syntax: +Listing 8-5 shows both methods of accessing a value in a vector, either with +indexing syntax or the `get` method. ```rust let v = vec![1, 2, 3, 4, 5]; let third: &i32 = &v[2]; -``` +println!("The third element is {}", third); -Listing 8-5: Using indexing syntax to -access an item in a vector - -Listing 8-6 shows the method of accessing a value in a vector, with -the `get` method: - -```rust -let v = vec![1, 2, 3, 4, 5]; -let v_index = 2; - -match v.get(v_index) { - Some(_) => { println!("Reachable element at index: {}", v_index); }, - None => { println!("Unreachable element at index: {}", v_index); } +match v.get(2) { + Some(third) => println!("The third element is {}", third), + None => println!("There is no third element."), } ``` -Listing 8-6: Using the `get` method to +Listing 8-5: Using indexing syntax or the `get` method to access an item in a vector Note two details here. First, we use the index value of `2` to get the third @@ -134,7 +124,7 @@ Rust has two ways to reference an element so you can choose how the program behaves when you try to use an index value that the vector doesn’t have an element for. As an example, let’s see what a program will do if it has a vector that holds five elements and then tries to access an element at index 100, as -shown in Listing 8-7: +shown in Listing 8-6. ```rust,should_panic,panics let v = vec![1, 2, 3, 4, 5]; @@ -143,7 +133,7 @@ let does_not_exist = &v[100]; let does_not_exist = v.get(100); ``` -Listing 8-7: Attempting to access the element at index +Listing 8-6: Attempting to access the element at index 100 in a vector containing five elements When we run this code, the first `[]` method will cause the program to panic @@ -165,9 +155,9 @@ When the program has a valid reference, the borrow checker enforces the ownership and borrowing rules (covered in Chapter 4) to ensure this reference and any other references to the contents of the vector remain valid. Recall the rule that states you can’t have mutable and immutable references in the same -scope. That rule applies in Listing 8-8, where we hold an immutable reference to +scope. That rule applies in Listing 8-7, where we hold an immutable reference to the first element in a vector and try to add an element to the end, which won’t -work: +work. ```rust,ignore,does_not_compile let mut v = vec![1, 2, 3, 4, 5]; @@ -179,7 +169,7 @@ v.push(6); println!("The first element is: {}", first); ``` -Listing 8-8: Attempting to add an element to a vector +Listing 8-7: Attempting to add an element to a vector while holding a reference to an item Compiling this code will result in this error: @@ -198,7 +188,7 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immuta | ----- borrow later used here ``` -The code in Listing 8-8 might look like it should work: why should a reference +The code in Listing 8-7 might look like it should work: why should a reference to the first element care about what changes at the end of the vector? This error is due to the way vectors work: adding a new element onto the end of the vector might require allocating new memory and copying the old elements to the @@ -214,8 +204,8 @@ programs from ending up in that situation. If we want to access each element in a vector in turn, we can iterate through all of the elements rather than use indexes to access one at a time. Listing -8-9 shows how to use a `for` loop to get immutable references to each element -in a vector of `i32` values and print them: +8-8 shows how to use a `for` loop to get immutable references to each element +in a vector of `i32` values and print them. ```rust let v = vec![100, 32, 57]; @@ -224,12 +214,12 @@ for i in &v { } ``` -Listing 8-9: Printing each element in a vector by +Listing 8-8: Printing each element in a vector by iterating over the elements using a `for` loop We can also iterate over mutable references to each element in a mutable vector -in order to make changes to all the elements. The `for` loop in Listing 8-10 -will add `50` to each element: +in order to make changes to all the elements. The `for` loop in Listing 8-9 +will add `50` to each element. ```rust let mut v = vec![100, 32, 57]; @@ -238,12 +228,12 @@ for i in &mut v { } ``` -Listing 8-10: Iterating over mutable references to +Listing 8-9: Iterating over mutable references to elements in a vector To change the value that the mutable reference refers to, we have to use the dereference operator (`*`) to get to the value in `i` before we can use the -`+=` operator . We’ll talk more about `*` in Chapter 15. +`+=` operator. We’ll talk more about `*` in Chapter 15. ### Using an Enum to Store Multiple Types @@ -258,7 +248,7 @@ some of the columns in the row contain integers, some floating-point numbers, and some strings. We can define an enum whose variants will hold the different value types, and then all the enum variants will be considered the same type: that of the enum. Then we can create a vector that holds that enum and so, -ultimately, holds different types. We’ve demonstrated this in Listing 8-11: +ultimately, holds different types. We’ve demonstrated this in Listing 8-10. ```rust enum SpreadsheetCell { @@ -274,7 +264,7 @@ let row = vec![ ]; ``` -Listing 8-11: Defining an `enum` to store values of +Listing 8-10: Defining an `enum` to store values of different types in one vector Rust needs to know what types will be in the vector at compile time so it knows diff --git a/src/doc/book/src/ch08-02-strings.md b/src/doc/book/src/ch08-02-strings.md index d5872512a7..63832bfcfb 100644 --- a/src/doc/book/src/ch08-02-strings.md +++ b/src/doc/book/src/ch08-02-strings.md @@ -1,7 +1,7 @@ ## Storing UTF-8 Encoded Text with Strings We talked about strings in Chapter 4, but we’ll look at them in more depth now. -New Rustaceans commonly get stuck on strings due to a combination of three +New Rustaceans commonly get stuck on strings for a combination of three reasons: Rust’s propensity for exposing possible errors, strings being a more complicated data structure than many programmers give them credit for, and UTF-8. These factors combine in a way that can seem difficult when you’re @@ -45,7 +45,7 @@ API documentation for more about how to use them and when each is appropriate. Many of the same operations available with `Vec` are available with `String` as well, starting with the `new` function to create a string, shown in Listing -8-11: +8-11. ```rust let mut s = String::new(); @@ -57,7 +57,7 @@ This line creates a new empty string called `s`, which we can then load data into. Often, we’ll have some initial data that we want to start the string with. For that, we use the `to_string` method, which is available on any type that implements the `Display` trait, as string literals do. Listing 8-12 shows -two examples: +two examples. ```rust let data = "initial contents"; @@ -75,7 +75,7 @@ This code creates a string containing `initial contents`. We can also use the function `String::from` to create a `String` from a string literal. The code in Listing 8-13 is equivalent to the code from Listing 8-12 -that uses `to_string`: +that uses `to_string`. ```rust let s = String::from("initial contents"); @@ -90,7 +90,7 @@ redundant, but they all have their place! In this case, `String::from` and `to_string` do the same thing, so which you choose is a matter of style. Remember that strings are UTF-8 encoded, so we can include any properly encoded -data in them, as shown in Listing 8-14: +data in them, as shown in Listing 8-14. ```rust let hello = String::from("السلام عليكم"); @@ -120,7 +120,7 @@ use the `+` operator or the `format!` macro to concatenate `String` values. #### Appending to a String with `push_str` and `push` We can grow a `String` by using the `push_str` method to append a string slice, -as shown in Listing 8-15: +as shown in Listing 8-15. ```rust let mut s = String::from("foo"); @@ -133,7 +133,7 @@ using the `push_str` method After these two lines, `s` will contain `foobar`. The `push_str` method takes a string slice because we don’t necessarily want to take ownership of the parameter. For example, the code in Listing 8-16 shows that it would be -unfortunate if we weren’t able to use `s2` after appending its contents to `s1`: +unfortunate if we weren’t able to use `s2` after appending its contents to `s1`. ```rust let mut s1 = String::from("foo"); @@ -149,8 +149,8 @@ If the `push_str` method took ownership of `s2`, we wouldn’t be able to print its value on the last line. However, this code works as we’d expect! The `push` method takes a single character as a parameter and adds it to the -`String`. Listing 8-17 shows code that adds the letter l to a `String` using -the `push` method: +`String`. Listing 8-17 shows code that adds the letter *l* to a `String` using +the `push` method. ```rust let mut s = String::from("lo"); @@ -165,12 +165,12 @@ As a result of this code, `s` will contain `lol`. #### Concatenation with the `+` Operator or the `format!` Macro Often, you’ll want to combine two existing strings. One way is to use the `+` -operator, as shown in Listing 8-18: +operator, as shown in Listing 8-18. ```rust let s1 = String::from("Hello, "); let s2 = String::from("world!"); -let s3 = s1 + &s2; // Note s1 has been moved here and can no longer be used +let s3 = s1 + &s2; // note s1 has been moved here and can no longer be used ``` Listing 8-18: Using the `+` operator to combine two @@ -248,7 +248,7 @@ easier to read and doesn’t take ownership of any of its parameters. In many other programming languages, accessing individual characters in a string by referencing them by index is a valid and common operation. However, if you try to access parts of a `String` using indexing syntax in Rust, you’ll -get an error. Consider the invalid code in Listing 8-19: +get an error. Consider the invalid code in Listing 8-19. ```rust,ignore,does_not_compile let s1 = String::from("hello"); @@ -285,7 +285,7 @@ let len = String::from("Hola").len(); In this case, `len` will be 4, which means the vector storing the string “Hola” is 4 bytes long. Each of these letters takes 1 byte when encoded in UTF-8. But -what about the following line? (Note that this line begins with the capital +what about the following line? (Note that this string begins with the capital Cyrillic letter Ze, not the Arabic number 3.) ```rust @@ -393,7 +393,7 @@ Fortunately, you can access elements in a string in other ways. If you need to perform operations on individual Unicode scalar values, the best way to do so is to use the `chars` method. Calling `chars` on “नमस्ते” separates out and returns six values of type `char`, and you can iterate over the result -in order to access each element: +to access each element: ```rust for c in "नमस्ते".chars() { diff --git a/src/doc/book/src/ch08-03-hash-maps.md b/src/doc/book/src/ch08-03-hash-maps.md index 8fff3666e3..53f250d903 100644 --- a/src/doc/book/src/ch08-03-hash-maps.md +++ b/src/doc/book/src/ch08-03-hash-maps.md @@ -22,7 +22,7 @@ As always, check the standard library documentation for more information. You can create an empty hash map with `new` and add elements with `insert`. In Listing 8-20, we’re keeping track of the scores of two teams whose names are Blue and Yellow. The Blue team starts with 10 points, and the Yellow team -starts with 50: +starts with 50. ```rust use std::collections::HashMap; @@ -53,7 +53,7 @@ vector of tuples, where each tuple consists of a key and its value. The `HashMap`. For example, if we had the team names and initial scores in two separate vectors, we could use the `zip` method to create a vector of tuples where “Blue” is paired with 10, and so forth. Then we could use the `collect` -method to turn that vector of tuples into a hash map, as shown in Listing 8-21: +method to turn that vector of tuples into a hash map, as shown in Listing 8-21. ```rust use std::collections::HashMap; @@ -77,7 +77,7 @@ contains based on the types of the data in the vectors. For types that implement the `Copy` trait, like `i32`, the values are copied into the hash map. For owned values like `String`, the values will be moved and -the hash map will be the owner of those values, as demonstrated in Listing 8-22: +the hash map will be the owner of those values, as demonstrated in Listing 8-22. ```rust use std::collections::HashMap; @@ -105,7 +105,7 @@ the “Validating References with Lifetimes” section in Chapter 10. ### Accessing Values in a Hash Map We can get a value out of the hash map by providing its key to the `get` -method, as shown in Listing 8-23: +method, as shown in Listing 8-23. ```rust use std::collections::HashMap; @@ -168,7 +168,7 @@ If we insert a key and a value into a hash map and then insert that same key with a different value, the value associated with that key will be replaced. Even though the code in Listing 8-24 calls `insert` twice, the hash map will only contain one key/value pair because we’re inserting the value for the Blue -team’s key both times: +team’s key both times. ```rust use std::collections::HashMap; @@ -192,11 +192,11 @@ overwritten. It’s common to check whether a particular key has a value and, if it doesn’t, insert a value for it. Hash maps have a special API for this called `entry` that takes the key you want to check as a parameter. The return value of the -`entry` function is an enum called `Entry` that represents a value that might -or might not exist. Let’s say we want to check whether the key for the Yellow -team has a value associated with it. If it doesn’t, we want to insert the value -50, and the same for the Blue team. Using the `entry` API, the code looks like -Listing 8-25: +`entry` method is an enum called `Entry` that represents a value that might or +might not exist. Let’s say we want to check whether the key for the Yellow team +has a value associated with it. If it doesn’t, we want to insert the value 50, +and the same for the Blue team. Using the `entry` API, the code looks like +Listing 8-25. ```rust use std::collections::HashMap; @@ -221,9 +221,9 @@ logic ourselves and, in addition, plays more nicely with the borrow checker. Running the code in Listing 8-25 will print `{"Yellow": 50, "Blue": 10}`. The first call to `entry` will insert the key for the Yellow team with the value -`50` because the Yellow team doesn’t have a value already. The second call to +50 because the Yellow team doesn’t have a value already. The second call to `entry` will not change the hash map because the Blue team already has the -value `10`. +value 10. #### Updating a Value Based on the Old Value @@ -232,7 +232,7 @@ update it based on the old value. For instance, Listing 8-26 shows code that counts how many times each word appears in some text. We use a hash map with the words as keys and increment the value to keep track of how many times we’ve seen that word. If it’s the first time we’ve seen a word, we’ll first insert -the value `0`: +the value 0. ```rust use std::collections::HashMap; @@ -261,17 +261,17 @@ loop, so all of these changes are safe and allowed by the borrowing rules. ### Hashing Functions -By default, `HashMap` uses a “cryptographically strong”[^siphash] hashing function that can -provide resistance to Denial of Service (DoS) attacks. This is not the fastest -hashing algorithm available, but the trade-off for better security that comes -with the drop in performance is worth it. If you profile your code and find -that the default hash function is too slow for your purposes, you can switch to -another function by specifying a different *hasher*. A hasher is a type that -implements the `BuildHasher` trait. We’ll talk about traits and how to -implement them in Chapter 10. You don’t necessarily have to implement your own -hasher from scratch; [crates.io](https://crates.io) has libraries shared by -other Rust users that provide hashers implementing many common hashing -algorithms. +By default, `HashMap` uses a “cryptographically strong”[^siphash] hashing +function that can provide resistance to Denial of Service (DoS) attacks. This +is not the fastest hashing algorithm available, but the trade-off for better +security that comes with the drop in performance is worth it. If you profile +your code and find that the default hash function is too slow for your +purposes, you can switch to another function by specifying a different +*hasher*. A hasher is a type that implements the `BuildHasher` trait. We’ll +talk about traits and how to implement them in Chapter 10. You don’t +necessarily have to implement your own hasher from scratch; +[crates.io](https://crates.io) has libraries shared by other Rust users that +provide hashers implementing many common hashing algorithms. [^siphash]: [https://www.131002.net/siphash/siphash.pdf](https://www.131002.net/siphash/siphash.pdf) diff --git a/src/doc/book/src/ch09-01-unrecoverable-errors-with-panic.md b/src/doc/book/src/ch09-01-unrecoverable-errors-with-panic.md index 132e4fae88..85ddf7f654 100644 --- a/src/doc/book/src/ch09-01-unrecoverable-errors-with-panic.md +++ b/src/doc/book/src/ch09-01-unrecoverable-errors-with-panic.md @@ -45,10 +45,10 @@ thread 'main' panicked at 'crash and burn', src/main.rs:2:4 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` -The call to `panic!` causes the error message contained in the last two -lines. The first line shows our panic message and the place in our source code -where the panic occurred: *src/main.rs:2:4* indicates that it’s the second -line, fourth character of our *src/main.rs* file. +The call to `panic!` causes the error message contained in the last two lines. +The first line shows our panic message and the place in our source code where +the panic occurred: *src/main.rs:2:4* indicates that it’s the second line, +fourth character of our *src/main.rs* file. In this case, the line indicated is part of our code, and if we go to that line, we see the `panic!` macro call. In other cases, the `panic!` call might @@ -64,7 +64,7 @@ backtrace is in more detail next. Let’s look at another example to see what it’s like when a `panic!` call comes from a library because of a bug in our code instead of from our code calling the macro directly. Listing 9-1 has some code that attempts to access an -element by index in a vector: +element by index in a vector. Filename: src/main.rs @@ -77,13 +77,13 @@ fn main() { ``` Listing 9-1: Attempting to access an element beyond the -end of a vector, which will cause a `panic!` +end of a vector, which will cause a call to `panic!` -Here, we’re attempting to access the hundredth element of our vector (which is -at index 99 because indexing starts at zero), but it has only three elements. -In this situation, Rust will panic. Using `[]` is supposed to return an -element, but if you pass an invalid index, there’s no element that Rust could -return here that would be correct. +Here, we’re attempting to access the 100th element of our vector (which is at +index 99 because indexing starts at zero), but it has only 3 elements. In this +situation, Rust will panic. Using `[]` is supposed to return an element, but if +you pass an invalid index, there’s no element that Rust could return here that +would be correct. Other languages, like C, will attempt to give you exactly what you asked for in this situation, even though it isn’t what you want: you’ll get whatever is at @@ -122,7 +122,7 @@ mentioning your files are code that your code called; the lines below are code that called your code. These lines might include core Rust code, standard library code, or crates that you’re using. Let’s try getting a backtrace by setting the `RUST_BACKTRACE` environment variable to any value except 0. -Listing 9-2 shows output similar to what you’ll see: +Listing 9-2 shows output similar to what you’ll see. ```text $ RUST_BACKTRACE=1 cargo run diff --git a/src/doc/book/src/ch09-02-recoverable-errors-with-result.md b/src/doc/book/src/ch09-02-recoverable-errors-with-result.md index b98d2e366e..e56b2ac0db 100644 --- a/src/doc/book/src/ch09-02-recoverable-errors-with-result.md +++ b/src/doc/book/src/ch09-02-recoverable-errors-with-result.md @@ -29,7 +29,7 @@ library has defined on it in many different situations where the successful value and error value we want to return may differ. Let’s call a function that returns a `Result` value because the function could -fail. In Listing 9-3 we try to open a file: +fail. In Listing 9-3 we try to open a file. Filename: src/main.rs @@ -43,14 +43,13 @@ fn main() { Listing 9-3: Opening a file -How do we know `File::open` returns a `Result`? We could look at the -[standard library API documentation](../std/index.html), -or we could ask the compiler! If we give `f` a type -annotation that we know is *not* the return type of the function and then try -to compile the code, the compiler will tell us that the types don’t match. The -error message will then tell us what the type of `f` *is*. Let’s try it! We -know that the return type of `File::open` isn’t of type `u32`, so let’s change -the `let f` statement to this: +How do we know `File::open` returns a `Result`? We could look at the [standard +library API documentation](../std/index.html), or we could ask +the compiler! If we give `f` a type annotation that we know is *not* the return +type of the function and then try to compile the code, the compiler will tell +us that the types don’t match. The error message will then tell us what the +type of `f` *is*. Let’s try it! We know that the return type of `File::open` +isn’t of type `u32`, so let’s change the `let f` statement to this: ```rust,ignore let f: u32 = File::open("hello.txt"); @@ -142,7 +141,7 @@ if `File::open` failed because the file doesn’t exist, we want to create the file and return the handle to the new file. If `File::open` failed for any other reason—for example, because we didn’t have permission to open the file—we still want the code to `panic!` in the same way as it did in Listing 9-4. Look -at Listing 9-5, which adds another arm to the `match`: +at Listing 9-5, which adds another arm to the `match`. Filename: src/main.rs @@ -178,21 +177,21 @@ has a method `kind` that we can call to get an `io::ErrorKind` value. The enum `io::ErrorKind` is provided by the standard library and has variants representing the different kinds of errors that might result from an `io` operation. The variant we want to use is `ErrorKind::NotFound`, which indicates -the file we’re trying to open doesn’t exist yet. So, we `match` on `f`, but we -also then have an inner `match` on `error.kind()`. +the file we’re trying to open doesn’t exist yet. So we `match` on `f`, but we +also have an inner `match` on `error.kind()`. The condition we want to check in the match guard is whether the value returned by `error.kind()` is the `NotFound` variant of the `ErrorKind` enum. If it is, we try to create the file with `File::create`. However, because `File::create` -could also fail, we need to add another inner `match` statement as well. When +could also fail, we need to add another inner `match` expression as well. When the file can’t be opened, a different error message will be printed. The last arm of the outer `match` stays the same so the program panics on any error besides the missing file error. -That’s a lot of `match`! `match` is very powerful, but also very much a primitive. -In Chapter 13, we’ll learn about closures. The `Result` type has many -methods that accept a closure, and are implemented as `match` statements. A more -seasoned Rustacean might write this: +That’s a lot of `match`! `match` is very powerful, but also very much a +primitive. In Chapter 13, we’ll learn about closures. The `Result` type +has many methods that accept a closure, and are implemented as `match` +expressions. A more seasoned Rustacean might write this: ```rust,ignore use std::fs::File; @@ -213,16 +212,15 @@ fn main() { Come back to this example after you’ve read Chapter 13, and look up what the `map_err` and `unwrap_or_else` methods do in the standard library -documentation. There’s many more of these methods that can clean up huge -nested `match`es when dealing with errors. We’ll be looking at some other -strategies shortly! +documentation. There’s many more of these methods that can clean up huge nested +`match` expressions when dealing with errors. ### Shortcuts for Panic on Error: `unwrap` and `expect` Using `match` works well enough, but it can be a bit verbose and doesn’t always communicate intent well. The `Result` type has many helper methods defined on it to do various tasks. One of those methods, called `unwrap`, is a -shortcut method that is implemented just like the `match` statement we wrote in +shortcut method that is implemented just like the `match` expression we wrote in Listing 9-4. If the `Result` value is the `Ok` variant, `unwrap` will return the value inside the `Ok`. If the `Result` is the `Err` variant, `unwrap` will call the `panic!` macro for us. Here is an example of `unwrap` in action: diff --git a/src/doc/book/src/ch14-02-publishing-to-crates-io.md b/src/doc/book/src/ch14-02-publishing-to-crates-io.md index ce6e180b88..1a34a5ace1 100644 --- a/src/doc/book/src/ch14-02-publishing-to-crates-io.md +++ b/src/doc/book/src/ch14-02-publishing-to-crates-io.md @@ -429,6 +429,7 @@ when you created the crate, your description, and a license added, the name = "guessing_game" version = "0.1.0" authors = ["Your Name "] +edition = "2018" description = "A fun game where you guess what number the computer has chosen." license = "MIT OR Apache-2.0" diff --git a/src/doc/book/src/ch15-05-interior-mutability.md b/src/doc/book/src/ch15-05-interior-mutability.md index 80856495b5..247ff1d5a9 100644 --- a/src/doc/book/src/ch15-05-interior-mutability.md +++ b/src/doc/book/src/ch15-05-interior-mutability.md @@ -161,12 +161,12 @@ impl<'a, T> LimitTracker<'a, T> let percentage_of_max = self.value as f64 / self.max as f64; - if percentage_of_max >= 0.75 && percentage_of_max < 0.9 { - self.messenger.send("Warning: You've used up over 75% of your quota!"); - } else if percentage_of_max >= 0.9 && percentage_of_max < 1.0 { - self.messenger.send("Urgent warning: You've used up over 90% of your quota!"); - } else if percentage_of_max >= 1.0 { + if percentage_of_max >= 1.0 { self.messenger.send("Error: You are over your quota!"); + } else if percentage_of_max >= 0.9 { + self.messenger.send("Urgent warning: You've used up over 90% of your quota!"); + } else if percentage_of_max >= 0.75 { + self.messenger.send("Warning: You've used up over 75% of your quota!"); } } } diff --git a/src/doc/book/src/ch18-03-pattern-syntax.md b/src/doc/book/src/ch18-03-pattern-syntax.md index 7edf279ca1..aa9c8e6621 100644 --- a/src/doc/book/src/ch18-03-pattern-syntax.md +++ b/src/doc/book/src/ch18-03-pattern-syntax.md @@ -175,7 +175,7 @@ fn main() { separate variables This code creates the variables `a` and `b` that match the values of the `x` -and `y` fields of the `p` variable. This example shows that the names of the +and `y` fields of the `p` struct. This example shows that the names of the variables in the pattern don’t have to match the field names of the struct. But it’s common to want the variable names to match the field names to make it easier to remember which variables came from which fields. diff --git a/src/doc/book/src/ch19-06-macros.md b/src/doc/book/src/ch19-06-macros.md index c1c1698dff..fb4480e314 100644 --- a/src/doc/book/src/ch19-06-macros.md +++ b/src/doc/book/src/ch19-06-macros.md @@ -327,12 +327,10 @@ won’t compile until we add a definition for the `impl_hello_macro` function. Filename: hello_macro_derive/src/lib.rs ```rust,ignore diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index 50922ee601..c5c3e07353 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -248,7 +248,7 @@ impl CtorKind { } impl NonMacroAttrKind { - fn descr(self) -> &'static str { + pub fn descr(self) -> &'static str { match self { NonMacroAttrKind::Builtin => "built-in attribute", NonMacroAttrKind::Tool => "tool attribute", diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index c3cca149c2..c590b34e6b 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -334,7 +334,12 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { continue; } - let result = select.select(&Obligation::new(dummy_cause.clone(), new_env, pred)); + // Call infcx.resolve_type_vars_if_possible to see if we can + // get rid of any inference variables. + let obligation = infcx.resolve_type_vars_if_possible( + &Obligation::new(dummy_cause.clone(), new_env, pred) + ); + let result = select.select(&obligation); match &result { &Ok(Some(ref vtable)) => { @@ -369,7 +374,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } &Ok(None) => {} &Err(SelectionError::Unimplemented) => { - if self.is_of_param(pred.skip_binder().trait_ref.substs) { + if self.is_param_no_infer(pred.skip_binder().trait_ref.substs) { already_visited.remove(&pred); self.add_user_pred( &mut user_computed_preds, @@ -631,18 +636,28 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { finished_map } - pub fn is_of_param(&self, substs: &Substs<'_>) -> bool { - if substs.is_noop() { - return false; - } + fn is_param_no_infer(&self, substs: &Substs<'_>) -> bool { + return self.is_of_param(substs.type_at(0)) && + !substs.types().any(|t| t.has_infer_types()); + } - return match substs.type_at(0).sty { + pub fn is_of_param(&self, ty: Ty<'_>) -> bool { + return match ty.sty { ty::Param(_) => true, - ty::Projection(p) => self.is_of_param(p.substs), + ty::Projection(p) => self.is_of_param(p.self_ty()), _ => false, }; } + fn is_self_referential_projection(&self, p: ty::PolyProjectionPredicate<'_>) -> bool { + match p.ty().skip_binder().sty { + ty::Projection(proj) if proj == p.skip_binder().projection_ty => { + true + }, + _ => false + } + } + pub fn evaluate_nested_obligations< 'b, 'c, @@ -661,28 +676,77 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { ) -> bool { let dummy_cause = ObligationCause::misc(DUMMY_SP, ast::DUMMY_NODE_ID); - for (obligation, predicate) in nested - .filter(|o| o.recursion_depth == 1) + for (obligation, mut predicate) in nested .map(|o| (o.clone(), o.predicate.clone())) { let is_new_pred = fresh_preds.insert(self.clean_pred(select.infcx(), predicate.clone())); + // Resolve any inference variables that we can, to help selection succeed + predicate = select.infcx().resolve_type_vars_if_possible(&predicate); + + // We only add a predicate as a user-displayable bound if + // it involves a generic parameter, and doesn't contain + // any inference variables. + // + // Displaying a bound involving a concrete type (instead of a generic + // parameter) would be pointless, since it's always true + // (e.g. u8: Copy) + // Displaying an inference variable is impossible, since they're + // an internal compiler detail without a defined visual representation + // + // We check this by calling is_of_param on the relevant types + // from the various possible predicates match &predicate { &ty::Predicate::Trait(ref p) => { - let substs = &p.skip_binder().trait_ref.substs; + if self.is_param_no_infer(p.skip_binder().trait_ref.substs) + && !only_projections + && is_new_pred { - if self.is_of_param(substs) && !only_projections && is_new_pred { self.add_user_pred(computed_preds, predicate); } predicates.push_back(p.clone()); } &ty::Predicate::Projection(p) => { - // If the projection isn't all type vars, then - // we don't want to add it as a bound - if self.is_of_param(p.skip_binder().projection_ty.substs) && is_new_pred { - self.add_user_pred(computed_preds, predicate); - } else { + debug!("evaluate_nested_obligations: examining projection predicate {:?}", + predicate); + + // As described above, we only want to display + // bounds which include a generic parameter but don't include + // an inference variable. + // Additionally, we check if we've seen this predicate before, + // to avoid rendering duplicate bounds to the user. + if self.is_param_no_infer(p.skip_binder().projection_ty.substs) + && !p.ty().skip_binder().is_ty_infer() + && is_new_pred { + debug!("evaluate_nested_obligations: adding projection predicate\ + to computed_preds: {:?}", predicate); + + // Under unusual circumstances, we can end up with a self-refeential + // projection predicate. For example: + // ::Value == ::Value + // Not only is displaying this to the user pointless, + // having it in the ParamEnv will cause an issue if we try to call + // poly_project_and_unify_type on the predicate, since this kind of + // predicate will normally never end up in a ParamEnv. + // + // For these reasons, we ignore these weird predicates, + // ensuring that we're able to properly synthesize an auto trait impl + if self.is_self_referential_projection(p) { + debug!("evaluate_nested_obligations: encountered a projection + predicate equating a type with itself! Skipping"); + + } else { + self.add_user_pred(computed_preds, predicate); + } + } + + // We can only call poly_project_and_unify_type when our predicate's + // Ty contains an inference variable - otherwise, there won't be anything to + // unify + if p.ty().skip_binder().has_infer_types() { + debug!("Projecting and unifying projection predicate {:?}", + predicate); match poly_project_and_unify_type(select, &obligation.with(p.clone())) { Err(e) => { debug!( diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 2909daf22b..756d8fcc34 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -190,7 +190,26 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { // In the case of a trait predicate, we can skip the "self" type. data.skip_binder().input_types().skip(1).any(|t| t.has_self_ty()) } - ty::Predicate::Projection(..) | + ty::Predicate::Projection(ref data) => { + // And similarly for projections. This should be redundant with + // the previous check because any projection should have a + // matching `Trait` predicate with the same inputs, but we do + // the check to be safe. + // + // Note that we *do* allow projection *outputs* to contain + // `self` (i.e., `trait Foo: Bar { type Result; }`), + // we just require the user to specify *both* outputs + // in the object type (i.e., `dyn Foo`). + // + // This is ALT2 in issue #56288, see that for discussion of the + // possible alternatives. + data.skip_binder() + .projection_ty + .trait_ref(self) + .input_types() + .skip(1) + .any(|t| t.has_self_ty()) + } ty::Predicate::WellFormed(..) | ty::Predicate::ObjectSafe(..) | ty::Predicate::TypeOutlives(..) | @@ -243,6 +262,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { method: &ty::AssociatedItem) -> Option { + debug!("object_safety_violation_for_method({:?}, {:?})", trait_def_id, method); // Any method that has a `Self : Sized` requisite is otherwise // exempt from the regulations. if self.generics_require_sized_self(method.def_id) { @@ -261,6 +281,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { method: &ty::AssociatedItem) -> bool { + debug!("is_vtable_safe_method({:?}, {:?})", trait_def_id, method); // Any method that has a `Self : Sized` requisite can't be called. if self.generics_require_sized_self(method.def_id) { return false; @@ -380,6 +401,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { fn receiver_for_self_ty( self, receiver_ty: Ty<'tcx>, self_ty: Ty<'tcx>, method_def_id: DefId ) -> Ty<'tcx> { + debug!("receiver_for_self_ty({:?}, {:?}, {:?})", receiver_ty, self_ty, method_def_id); let substs = Substs::for_item(self, method_def_id, |param, _| { if param.index == 0 { self_ty.into() @@ -388,7 +410,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } }); - receiver_ty.subst(self, substs) + let result = receiver_ty.subst(self, substs); + debug!("receiver_for_self_ty({:?}, {:?}, {:?}) = {:?}", + receiver_ty, self_ty, method_def_id, result); + result } /// creates the object type for the current trait. For example, @@ -404,18 +429,26 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { ); let mut associated_types = traits::supertraits(self, ty::Binder::dummy(trait_ref)) - .flat_map(|trait_ref| self.associated_items(trait_ref.def_id())) - .filter(|item| item.kind == ty::AssociatedKind::Type) + .flat_map(|super_trait_ref| { + self.associated_items(super_trait_ref.def_id()) + .map(move |item| (super_trait_ref, item)) + }) + .filter(|(_, item)| item.kind == ty::AssociatedKind::Type) .collect::>(); // existential predicates need to be in a specific order - associated_types.sort_by_cached_key(|item| self.def_path_hash(item.def_id)); + associated_types.sort_by_cached_key(|(_, item)| self.def_path_hash(item.def_id)); - let projection_predicates = associated_types.into_iter().map(|item| { + let projection_predicates = associated_types.into_iter().map(|(super_trait_ref, item)| { + // We *can* get bound lifetimes here in cases like + // `trait MyTrait: for<'s> OtherTrait<&'s T, Output=bool>`. + // + // binder moved to (*)... + let super_trait_ref = super_trait_ref.skip_binder(); ty::ExistentialPredicate::Projection(ty::ExistentialProjection { - ty: self.mk_projection(item.def_id, trait_ref.substs), + ty: self.mk_projection(item.def_id, super_trait_ref.substs), item_def_id: item.def_id, - substs: trait_ref.substs, + substs: super_trait_ref.substs, }) }); @@ -424,7 +457,8 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { ); let object_ty = self.mk_dynamic( - ty::Binder::dummy(existential_predicates), + // (*) ... binder re-introduced here + ty::Binder::bind(existential_predicates), lifetime, ); diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 4633ab1166..3adb7f1c5f 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1754,17 +1754,19 @@ bitflags! { pub struct AdtFlags: u32 { const NO_ADT_FLAGS = 0; const IS_ENUM = 1 << 0; - const IS_PHANTOM_DATA = 1 << 1; - const IS_FUNDAMENTAL = 1 << 2; - const IS_UNION = 1 << 3; - const IS_BOX = 1 << 4; + const IS_UNION = 1 << 1; + const IS_STRUCT = 1 << 2; + const HAS_CTOR = 1 << 3; + const IS_PHANTOM_DATA = 1 << 4; + const IS_FUNDAMENTAL = 1 << 5; + const IS_BOX = 1 << 6; /// Indicates whether the type is an `Arc`. - const IS_ARC = 1 << 5; + const IS_ARC = 1 << 7; /// Indicates whether the type is an `Rc`. - const IS_RC = 1 << 6; + const IS_RC = 1 << 8; /// Indicates whether the variant list of this ADT is `#[non_exhaustive]`. /// (i.e., this flag is never set unless this ADT is an enum). - const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 7; + const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 9; } } @@ -2079,31 +2081,43 @@ impl<'a, 'gcx, 'tcx> AdtDef { repr: ReprOptions) -> Self { debug!("AdtDef::new({:?}, {:?}, {:?}, {:?})", did, kind, variants, repr); let mut flags = AdtFlags::NO_ADT_FLAGS; - let attrs = tcx.get_attrs(did); - if attr::contains_name(&attrs, "fundamental") { - flags = flags | AdtFlags::IS_FUNDAMENTAL; - } - if Some(did) == tcx.lang_items().phantom_data() { - flags = flags | AdtFlags::IS_PHANTOM_DATA; - } - if Some(did) == tcx.lang_items().owned_box() { - flags = flags | AdtFlags::IS_BOX; - } - if Some(did) == tcx.lang_items().arc() { - flags = flags | AdtFlags::IS_ARC; - } - if Some(did) == tcx.lang_items().rc() { - flags = flags | AdtFlags::IS_RC; - } + if kind == AdtKind::Enum && tcx.has_attr(did, "non_exhaustive") { debug!("found non-exhaustive variant list for {:?}", did); flags = flags | AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE; } - match kind { - AdtKind::Enum => flags = flags | AdtFlags::IS_ENUM, - AdtKind::Union => flags = flags | AdtFlags::IS_UNION, - AdtKind::Struct => {} + flags |= match kind { + AdtKind::Enum => AdtFlags::IS_ENUM, + AdtKind::Union => AdtFlags::IS_UNION, + AdtKind::Struct => AdtFlags::IS_STRUCT, + }; + + if let AdtKind::Struct = kind { + let variant_def = &variants[VariantIdx::new(0)]; + let def_key = tcx.def_key(variant_def.did); + match def_key.disambiguated_data.data { + DefPathData::StructCtor => flags |= AdtFlags::HAS_CTOR, + _ => (), + } } + + let attrs = tcx.get_attrs(did); + if attr::contains_name(&attrs, "fundamental") { + flags |= AdtFlags::IS_FUNDAMENTAL; + } + if Some(did) == tcx.lang_items().phantom_data() { + flags |= AdtFlags::IS_PHANTOM_DATA; + } + if Some(did) == tcx.lang_items().owned_box() { + flags |= AdtFlags::IS_BOX; + } + if Some(did) == tcx.lang_items().arc() { + flags |= AdtFlags::IS_ARC; + } + if Some(did) == tcx.lang_items().rc() { + flags |= AdtFlags::IS_RC; + } + AdtDef { did, variants, @@ -2114,25 +2128,25 @@ impl<'a, 'gcx, 'tcx> AdtDef { #[inline] pub fn is_struct(&self) -> bool { - !self.is_union() && !self.is_enum() + self.flags.contains(AdtFlags::IS_STRUCT) } #[inline] pub fn is_union(&self) -> bool { - self.flags.intersects(AdtFlags::IS_UNION) + self.flags.contains(AdtFlags::IS_UNION) } #[inline] pub fn is_enum(&self) -> bool { - self.flags.intersects(AdtFlags::IS_ENUM) + self.flags.contains(AdtFlags::IS_ENUM) } #[inline] pub fn is_variant_list_non_exhaustive(&self) -> bool { - self.flags.intersects(AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE) + self.flags.contains(AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE) } - /// Returns the kind of the ADT - Struct or Enum. + /// Returns the kind of the ADT. #[inline] pub fn adt_kind(&self) -> AdtKind { if self.is_enum() { @@ -2161,33 +2175,39 @@ impl<'a, 'gcx, 'tcx> AdtDef { } } - /// Returns whether this type is #[fundamental] for the purposes + /// If this function returns `true`, it implies that `is_struct` must return `true`. + #[inline] + pub fn has_ctor(&self) -> bool { + self.flags.contains(AdtFlags::HAS_CTOR) + } + + /// Returns whether this type is `#[fundamental]` for the purposes /// of coherence checking. #[inline] pub fn is_fundamental(&self) -> bool { - self.flags.intersects(AdtFlags::IS_FUNDAMENTAL) + self.flags.contains(AdtFlags::IS_FUNDAMENTAL) } /// Returns `true` if this is PhantomData. #[inline] pub fn is_phantom_data(&self) -> bool { - self.flags.intersects(AdtFlags::IS_PHANTOM_DATA) + self.flags.contains(AdtFlags::IS_PHANTOM_DATA) } /// Returns `true` if this is `Arc`. pub fn is_arc(&self) -> bool { - self.flags.intersects(AdtFlags::IS_ARC) + self.flags.contains(AdtFlags::IS_ARC) } /// Returns `true` if this is `Rc`. pub fn is_rc(&self) -> bool { - self.flags.intersects(AdtFlags::IS_RC) + self.flags.contains(AdtFlags::IS_RC) } /// Returns `true` if this is Box. #[inline] pub fn is_box(&self) -> bool { - self.flags.intersects(AdtFlags::IS_BOX) + self.flags.contains(AdtFlags::IS_BOX) } /// Returns whether this type has a destructor. diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index 7b1c7cfb56..50994497c2 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -16,7 +16,7 @@ num_cpus = "1.0" rustc-demangle = "0.1.4" memmap = "0.6" log = "0.4.5" -libc = "0.2.43" +libc = "0.2.44" jobserver = "0.1.11" serialize = { path = "../libserialize" } diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 1aba53255e..0a9fbcbfdd 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -335,11 +335,20 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { bx: &mut Bx, llindex: V ) -> Self { + // Statically compute the offset if we can, otherwise just use the element size, + // as this will yield the lowest alignment. + let layout = self.layout.field(bx, 0); + let offset = if bx.is_const_integral(llindex) { + layout.size.checked_mul(bx.const_to_uint(llindex), bx).unwrap_or(layout.size) + } else { + layout.size + }; + PlaceRef { llval: bx.inbounds_gep(self.llval, &[bx.cx().const_usize(0), llindex]), llextra: None, - layout: self.layout.field(bx.cx(), 0), - align: self.align + layout, + align: self.align.restrict_for_offset(offset), } } diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index dc7b1ec37b..a94ee27b7e 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -131,8 +131,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let keep_going = header_bx.icmp(IntPredicate::IntNE, current, end); header_bx.cond_br(keep_going, body_bx.llbb(), next_bx.llbb()); + let align = dest.align.restrict_for_offset(dest.layout.field(bx.cx(), 0).size); cg_elem.val.store(&mut body_bx, - PlaceRef::new_sized(current, cg_elem.layout, dest.align)); + PlaceRef::new_sized(current, cg_elem.layout, align)); let next = body_bx.inbounds_gep(current, &[bx.cx().const_usize(1)]); body_bx.br(header_bx.llbb()); diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 5f64dfd931..2dec217bec 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -1415,7 +1415,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { self.check_call_dest(mir, term, &sig, destination, term_location); self.prove_predicates( - sig.inputs().iter().map(|ty| ty::Predicate::WellFormed(ty)), + sig.inputs_and_output.iter().map(|ty| ty::Predicate::WellFormed(ty)), term_location.to_locations(), ConstraintCategory::Boring, ); diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index d7a3a27bbe..39e816c303 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -86,7 +86,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { type MemoryExtra: Default; /// Extra data stored in every allocation. - type AllocExtra: AllocationExtra; + type AllocExtra: AllocationExtra + 'static; /// Memory's allocation map type MemoryMap: diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 97d7e1586b..1260fdab64 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -708,8 +708,13 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { relocations .iter() .map(|&(offset, reloc)| { - (offset + dest.offset - src.offset + (i * size * relocations.len() as u64), - reloc) + // compute offset for current repetition + let dest_offset = dest.offset + (i * size); + ( + // shift offsets from source allocation to destination allocation + offset + dest_offset - src.offset, + reloc, + ) }) ); } diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index bcee6d75b5..bc0feb166a 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -517,7 +517,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { // Only allow statics (not consts) to refer to other statics. if self.mode == Mode::Static || self.mode == Mode::StaticMut { - if context.is_mutating_use() { + if self.mode == Mode::Static && context.is_mutating_use() { // this is not strictly necessary as miri will also bail out // For interior mutability we can't really catch this statically as that // goes through raw pointers and intermediate temporaries, so miri has diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 0fa41cb484..b9de05f7d6 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -230,13 +230,18 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } let subclass = SingleImport { - target: ident, source: source.ident, - result: PerNS { + target: ident, + source_bindings: PerNS { type_ns: Cell::new(Err(Undetermined)), value_ns: Cell::new(Err(Undetermined)), macro_ns: Cell::new(Err(Undetermined)), }, + target_bindings: PerNS { + type_ns: Cell::new(None), + value_ns: Cell::new(None), + macro_ns: Cell::new(None), + }, type_ns_only, }; self.add_import_directive( diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index fdac1e3b81..5f571dc71e 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -75,7 +75,7 @@ use syntax_pos::{Span, DUMMY_SP, MultiSpan}; use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; use std::cell::{Cell, RefCell}; -use std::{cmp, fmt, iter, ptr}; +use std::{cmp, fmt, iter, mem, ptr}; use std::collections::BTreeSet; use std::mem::replace; use rustc_data_structures::ptr_key::PtrKey; @@ -1022,11 +1022,11 @@ enum ModuleOrUniformRoot<'a> { CurrentScope, } -impl<'a> PartialEq for ModuleOrUniformRoot<'a> { - fn eq(&self, other: &Self) -> bool { - match (*self, *other) { +impl ModuleOrUniformRoot<'_> { + fn same_def(lhs: Self, rhs: Self) -> bool { + match (lhs, rhs) { (ModuleOrUniformRoot::Module(lhs), - ModuleOrUniformRoot::Module(rhs)) => ptr::eq(lhs, rhs), + ModuleOrUniformRoot::Module(rhs)) => lhs.def() == rhs.def(), (ModuleOrUniformRoot::CrateRootAndExternPrelude, ModuleOrUniformRoot::CrateRootAndExternPrelude) | (ModuleOrUniformRoot::ExternPrelude, ModuleOrUniformRoot::ExternPrelude) | @@ -1521,6 +1521,7 @@ pub struct Resolver<'a, 'b: 'a> { /// FIXME: Refactor things so that this is passed through arguments and not resolver. last_import_segment: bool, + blacklisted_binding: Option<&'a NameBinding<'a>>, /// The idents for the primitive types. primitive_type_table: PrimitiveTypeTable, @@ -1871,6 +1872,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { current_self_type: None, current_self_item: None, last_import_segment: false, + blacklisted_binding: None, primitive_type_table: PrimitiveTypeTable::new(), @@ -2392,11 +2394,27 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { ast::UseTreeKind::Simple(..) if segments.len() == 1 => &[TypeNS, ValueNS][..], _ => &[TypeNS], }; + let report_error = |this: &Self, ns| { + let what = if ns == TypeNS { "type parameters" } else { "local variables" }; + this.session.span_err(ident.span, &format!("imports cannot refer to {}", what)); + }; + for &ns in nss { - if let Some(LexicalScopeBinding::Def(..)) = - self.resolve_ident_in_lexical_scope(ident, ns, None, use_tree.prefix.span) { - let what = if ns == TypeNS { "type parameters" } else { "local variables" }; - self.session.span_err(ident.span, &format!("imports cannot refer to {}", what)); + match self.resolve_ident_in_lexical_scope(ident, ns, None, use_tree.prefix.span) { + Some(LexicalScopeBinding::Def(..)) => { + report_error(self, ns); + } + Some(LexicalScopeBinding::Item(binding)) => { + let orig_blacklisted_binding = + mem::replace(&mut self.blacklisted_binding, Some(binding)); + if let Some(LexicalScopeBinding::Def(..)) = + self.resolve_ident_in_lexical_scope(ident, ns, None, + use_tree.prefix.span) { + report_error(self, ns); + } + self.blacklisted_binding = orig_blacklisted_binding; + } + None => {} } } } else if let ast::UseTreeKind::Nested(use_trees) = &use_tree.kind { @@ -3858,6 +3876,13 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { module = Some(ModuleOrUniformRoot::Module(next_module)); record_segment_def(self, def); } else if def == Def::ToolMod && i + 1 != path.len() { + if binding.is_import() { + self.session.struct_span_err( + ident.span, "cannot use a tool module through an import" + ).span_note( + binding.span, "the tool module imported here" + ).emit(); + } let def = Def::NonMacroAttr(NonMacroAttrKind::Tool); return PathResult::NonModule(PathResolution::new(def)); } else if def == Def::Err { diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 5db3efee9f..31c2db5d86 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -499,6 +499,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { .push((path, path_span, kind, parent_scope.clone(), def.ok())); } + self.prohibit_imported_non_macro_attrs(None, def.ok(), path_span); def } else { let binding = self.early_resolve_ident_in_lexical_scope( @@ -515,7 +516,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> { .push((path[0].ident, kind, parent_scope.clone(), binding.ok())); } - binding.map(|binding| binding.def_ignoring_ambiguity()) + let def = binding.map(|binding| binding.def_ignoring_ambiguity()); + self.prohibit_imported_non_macro_attrs(binding.ok(), def.ok(), path_span); + def } } @@ -953,36 +956,34 @@ impl<'a, 'cl> Resolver<'a, 'cl> { // but its `Def` should coincide with a crate passed with `--extern` // (otherwise there would be ambiguity) and we can skip feature error in this case. 'ok: { - if !is_import || self.session.features_untracked().uniform_paths { + if !is_import || !rust_2015 { break 'ok; } if ns == TypeNS && use_prelude && self.extern_prelude_get(ident, true).is_some() { break 'ok; } - if rust_2015 { - let root_ident = Ident::new(keywords::CrateRoot.name(), orig_ident.span); - let root_module = self.resolve_crate_root(root_ident); - if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module), - orig_ident, ns, None, false, path_span) - .is_ok() { - break 'ok; - } + let root_ident = Ident::new(keywords::CrateRoot.name(), orig_ident.span); + let root_module = self.resolve_crate_root(root_ident); + if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module), + orig_ident, ns, None, false, path_span) + .is_ok() { + break 'ok; } - let msg = "imports can only refer to extern crate names \ - passed with `--extern` on stable channel"; - let mut err = feature_err(&self.session.parse_sess, "uniform_paths", - ident.span, GateIssue::Language, msg); - + let msg = "imports can only refer to extern crate names passed with \ + `--extern` in macros originating from 2015 edition"; + let mut err = self.session.struct_span_err(ident.span, msg); let what = self.binding_description(binding, ident, flags.contains(Flags::MISC_FROM_PRELUDE)); let note_msg = format!("this import refers to {what}", what = what); - if binding.span.is_dummy() { + let label_span = if binding.span.is_dummy() { err.note(¬e_msg); + ident.span } else { err.span_note(binding.span, ¬e_msg); - err.span_label(binding.span, "not an extern crate passed with `--extern`"); - } + binding.span + }; + err.span_label(label_span, "not an extern crate passed with `--extern`"); err.emit(); } @@ -1091,6 +1092,20 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } } + fn prohibit_imported_non_macro_attrs(&self, binding: Option<&'a NameBinding<'a>>, + def: Option, span: Span) { + if let Some(Def::NonMacroAttr(kind)) = def { + if kind != NonMacroAttrKind::Tool && binding.map_or(true, |b| b.is_import()) { + let msg = format!("cannot use a {} through an import", kind.descr()); + let mut err = self.session.struct_span_err(span, &msg); + if let Some(binding) = binding { + err.span_note(binding.span, &format!("the {} imported here", kind.descr())); + } + err.emit(); + } + } + } + fn suggest_macro_name(&mut self, name: &str, kind: MacroKind, err: &mut DiagnosticBuilder<'a>, span: Span) { // First check if this is a locally-defined bang macro. @@ -1187,7 +1202,12 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let ident = ident.modern(); self.macro_names.insert(ident); let def = Def::Macro(def_id, MacroKind::Bang); - let vis = ty::Visibility::Invisible; // Doesn't matter for legacy bindings + let is_macro_export = attr::contains_name(&item.attrs, "macro_export"); + let vis = if is_macro_export { + ty::Visibility::Public + } else { + ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)) + }; let binding = (def, vis, item.span, expansion).to_name_binding(self.arenas); self.set_binding_parent_module(binding, self.current_module); let legacy_binding = self.arenas.alloc_legacy_binding(LegacyBinding { @@ -1195,9 +1215,8 @@ impl<'a, 'cl> Resolver<'a, 'cl> { }); *current_legacy_scope = LegacyScope::Binding(legacy_binding); self.all_macros.insert(ident.name, def); - if attr::contains_name(&item.attrs, "macro_export") { + if is_macro_export { let module = self.graph_root; - let vis = ty::Visibility::Public; self.define(module, ident, MacroNS, (def, vis, item.span, expansion, IsMacroExport)); } else { diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index e7cd32f4e8..3fa07cbf23 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -42,9 +42,10 @@ use std::{mem, ptr}; #[derive(Clone, Debug)] pub enum ImportDirectiveSubclass<'a> { SingleImport { - target: Ident, source: Ident, - result: PerNS, Determinacy>>>, + target: Ident, + source_bindings: PerNS, Determinacy>>>, + target_bindings: PerNS>>>, type_ns_only: bool, }, GlobImport { @@ -227,6 +228,11 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { } let check_usable = |this: &mut Self, binding: &'a NameBinding<'a>| { + if let Some(blacklisted_binding) = this.blacklisted_binding { + if ptr::eq(binding, blacklisted_binding) { + return Err((Determined, Weak::No)); + } + } // `extern crate` are always usable for backwards compatibility, see issue #37020, // remove this together with `PUB_USE_OF_PRIVATE_EXTERN_CRATE`. let usable = this.is_accessible(binding.vis) || binding.is_extern_crate(); @@ -234,7 +240,18 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { }; if record_used { - return resolution.binding.ok_or((Determined, Weak::No)).and_then(|binding| { + return resolution.binding.and_then(|binding| { + // If the primary binding is blacklisted, search further and return the shadowed + // glob binding if it exists. What we really want here is having two separate + // scopes in a module - one for non-globs and one for globs, but until that's done + // use this hack to avoid inconsistent resolution ICEs during import validation. + if let Some(blacklisted_binding) = self.blacklisted_binding { + if ptr::eq(binding, blacklisted_binding) { + return resolution.shadowed_glob; + } + } + Some(binding) + }).ok_or((Determined, Weak::No)).and_then(|binding| { if self.last_import_segment && check_usable(self, binding).is_err() { Err((Determined, Weak::No)) } else { @@ -465,6 +482,10 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { self.set_binding_parent_module(binding, module); self.update_resolution(module, ident, ns, |this, resolution| { if let Some(old_binding) = resolution.binding { + if binding.def() == Def::Err { + // Do not override real bindings with `Def::Err`s from error recovery. + return Ok(()); + } match (old_binding.is_glob_import(), binding.is_glob_import()) { (true, true) => { if binding.def() != old_binding.def() { @@ -642,10 +663,10 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { if let Some((span, err, note)) = self.finalize_import(import) { errors = true; - if let SingleImport { source, ref result, .. } = import.subclass { + if let SingleImport { source, ref source_bindings, .. } = import.subclass { if source.name == "self" { // Silence `unresolved import` error if E0429 is already emitted - if let Err(Determined) = result.value_ns.get() { + if let Err(Determined) = source_bindings.value_ns.get() { continue; } } @@ -765,9 +786,11 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { }; directive.imported_module.set(Some(module)); - let (source, target, result, type_ns_only) = match directive.subclass { - SingleImport { source, target, ref result, type_ns_only } => - (source, target, result, type_ns_only), + let (source, target, source_bindings, target_bindings, type_ns_only) = + match directive.subclass { + SingleImport { source, target, ref source_bindings, + ref target_bindings, type_ns_only } => + (source, target, source_bindings, target_bindings, type_ns_only), GlobImport { .. } => { self.resolve_glob_import(directive); return true; @@ -777,7 +800,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut indeterminate = false; self.per_ns(|this, ns| if !type_ns_only || ns == TypeNS { - if let Err(Undetermined) = result[ns].get() { + if let Err(Undetermined) = source_bindings[ns].get() { // For better failure detection, pretend that the import will // not define any names while resolving its module path. let orig_vis = directive.vis.replace(ty::Visibility::Invisible); @@ -786,13 +809,13 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { ); directive.vis.set(orig_vis); - result[ns].set(binding); + source_bindings[ns].set(binding); } else { return }; let parent = directive.parent_scope.module; - match result[ns].get() { + match source_bindings[ns].get() { Err(Undetermined) => indeterminate = true, Err(Determined) => { this.update_resolution(parent, target, ns, |_, resolution| { @@ -810,6 +833,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { } Ok(binding) => { let imported_binding = this.import(binding, directive); + target_bindings[ns].set(Some(imported_binding)); let conflict = this.try_define(parent, target, ns, imported_binding); if let Err(old_binding) = conflict { this.report_conflict(parent, target, ns, imported_binding, old_binding); @@ -836,7 +860,9 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { PathResult::Module(module) => { // Consistency checks, analogous to `finalize_current_module_macro_resolutions`. if let Some(initial_module) = directive.imported_module.get() { - if module != initial_module && self.ambiguity_errors.is_empty() { + if !ModuleOrUniformRoot::same_def(module, initial_module) + && self.ambiguity_errors.is_empty() + { span_bug!(directive.span, "inconsistent resolution for an import"); } } else { @@ -879,8 +905,9 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { PathResult::Indeterminate | PathResult::NonModule(..) => unreachable!(), }; - let (ident, result, type_ns_only) = match directive.subclass { - SingleImport { source, ref result, type_ns_only, .. } => (source, result, type_ns_only), + let (ident, source_bindings, target_bindings, type_ns_only) = match directive.subclass { + SingleImport { source, ref source_bindings, ref target_bindings, type_ns_only, .. } => + (source, source_bindings, target_bindings, type_ns_only), GlobImport { is_prelude, ref max_vis } => { if directive.module_path.len() <= 1 { // HACK(eddyb) `lint_if_path_starts_with_module` needs at least @@ -919,17 +946,20 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut all_ns_err = true; self.per_ns(|this, ns| if !type_ns_only || ns == TypeNS { let orig_vis = directive.vis.replace(ty::Visibility::Invisible); + let orig_blacklisted_binding = + mem::replace(&mut this.blacklisted_binding, target_bindings[ns].get()); let orig_last_import_segment = mem::replace(&mut this.last_import_segment, true); let binding = this.resolve_ident_in_module( module, ident, ns, Some(&directive.parent_scope), true, directive.span ); this.last_import_segment = orig_last_import_segment; + this.blacklisted_binding = orig_blacklisted_binding; directive.vis.set(orig_vis); match binding { Ok(binding) => { // Consistency checks, analogous to `finalize_current_module_macro_resolutions`. - let initial_def = result[ns].get().map(|initial_binding| { + let initial_def = source_bindings[ns].get().map(|initial_binding| { all_ns_err = false; this.record_use(ident, ns, initial_binding, directive.module_path.is_empty()); @@ -1034,7 +1064,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut reexport_error = None; let mut any_successful_reexport = false; self.per_ns(|this, ns| { - if let Ok(binding) = result[ns].get() { + if let Ok(binding) = source_bindings[ns].get() { let vis = directive.vis.get(); if !binding.pseudo_vis().is_at_least(vis, &*this) { reexport_error = Some((ns, binding)); @@ -1078,7 +1108,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut full_path = directive.module_path.clone(); full_path.push(Segment::from_ident(ident)); self.per_ns(|this, ns| { - if let Ok(binding) = result[ns].get() { + if let Ok(binding) = source_bindings[ns].get() { this.lint_if_path_starts_with_module( directive.crate_lint(), &full_path, @@ -1092,7 +1122,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { // Record what this import resolves to for later uses in documentation, // this may resolve to either a value or a type, but for documentation // purposes it's good enough to just favor one over the other. - self.per_ns(|this, ns| if let Some(binding) = result[ns].get().ok() { + self.per_ns(|this, ns| if let Some(binding) = source_bindings[ns].get().ok() { let mut def = binding.def(); if let Def::Macro(def_id, _) = def { // `DefId`s from the "built-in macro crate" should not leak from resolve because diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 4fbbe58445..dd9b9cea61 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1013,6 +1013,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { let mut associated_types = BTreeSet::default(); for tr in traits::elaborate_trait_ref(tcx, principal) { + debug!("conv_object_ty_poly_trait_ref: observing object predicate `{:?}`", tr); match tr { ty::Predicate::Trait(pred) => { associated_types.extend(tcx.associated_items(pred.def_id()) @@ -1020,8 +1021,31 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { .map(|item| item.def_id)); } ty::Predicate::Projection(pred) => { - // Include projections defined on supertraits. - projection_bounds.push((pred, DUMMY_SP)) + // A `Self` within the original bound will be substituted with a + // `TRAIT_OBJECT_DUMMY_SELF`, so check for that. + let references_self = + pred.skip_binder().ty.walk().any(|t| t == dummy_self); + + // If the projection output contains `Self`, force the user to + // elaborate it explicitly to avoid a bunch of complexity. + // + // The "classicaly useful" case is the following: + // ``` + // trait MyTrait: FnMut() -> ::MyOutput { + // type MyOutput; + // } + // ``` + // + // Here, the user could theoretically write `dyn MyTrait`, + // but actually supporting that would "expand" to an infinitely-long type + // `fix $ τ → dyn MyTrait::MyOutput`. + // + // Instead, we force the user to write `dyn MyTrait`, + // which is uglier but works. See the discussion in #56288 for alternatives. + if !references_self { + // Include projections defined on supertraits, + projection_bounds.push((pred, DUMMY_SP)) + } } _ => () } diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 7a71cf57a2..3ed1ab21e8 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -280,7 +280,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Def::Local(id) | Def::Upvar(id, ..) => { Some(self.tcx.hir.span(id)) } - _ => self.tcx.hir.span_if_local(def.def_id()) + _ => def.opt_def_id().and_then(|did| self.tcx.hir.span_if_local(did)), }; if let Some(span) = def_span { let label = match (unit_variant, inner_callee_path) { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index e30a79b25d..c7e923967b 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -98,7 +98,8 @@ use rustc::mir::interpret::{ConstValue, GlobalId}; use rustc::ty::subst::{CanonicalUserSubsts, UnpackedKind, Subst, Substs, UserSelfTy, UserSubsts}; use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine}; -use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind, Visibility, ToPredicate, RegionKind}; +use rustc::ty::{self, AdtKind, Ty, TyCtxt, GenericParamDefKind, Visibility, ToPredicate, + RegionKind}; use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; use rustc::ty::query::Providers; @@ -914,6 +915,7 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fcx.resolve_generator_interiors(def_id); for (ty, span, code) in fcx.deferred_sized_obligations.borrow_mut().drain(..) { + let ty = fcx.normalize_ty(span, ty); fcx.require_type_is_sized(ty, span, code); } fcx.select_all_obligations_or_error(); @@ -3221,8 +3223,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { return_expr_ty); } - // A generic function for checking the then and else in an if - // or if-else. + // A generic function for checking the 'then' and 'else' clauses in an 'if' + // or 'if-else' expression. fn check_then_else(&self, cond_expr: &'gcx hir::Expr, then_expr: &'gcx hir::Expr, @@ -3547,8 +3549,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // we don't look at stability attributes on // struct-like enums (yet...), but it's definitely not - // a bug to have construct one. - if adt_kind != ty::AdtKind::Enum { + // a bug to have constructed one. + if adt_kind != AdtKind::Enum { tcx.check_stability(v_field.did, Some(expr_id), field.span); } @@ -3969,7 +3971,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // // to work in stable even if the Sized bound on `drop` is relaxed. for i in 0..fn_sig.inputs().skip_binder().len() { - let input = tcx.erase_late_bound_regions(&fn_sig.input(i)); + // We just want to check sizedness, so instead of introducing + // placeholder lifetimes with probing, we just replace higher lifetimes + // with fresh vars. + let input = self.replace_bound_vars_with_fresh_vars( + expr.span, + infer::LateBoundRegionConversionTime::FnCall, + &fn_sig.input(i)).0; self.require_type_is_sized_deferred(input, expr.span, traits::SizedArgumentType); } @@ -3977,7 +3985,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Here we want to prevent struct constructors from returning unsized types. // There were two cases this happened: fn pointer coercion in stable // and usual function call in presense of unsized_locals. - let output = tcx.erase_late_bound_regions(&fn_sig.output()); + // Also, as we just want to check sizedness, instead of introducing + // placeholder lifetimes with probing, we just replace higher lifetimes + // with fresh vars. + let output = self.replace_bound_vars_with_fresh_vars( + expr.span, + infer::LateBoundRegionConversionTime::FnCall, + &fn_sig.output()).0; self.require_type_is_sized_deferred(output, expr.span, traits::SizedReturnType); } @@ -5148,26 +5162,48 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }).unwrap_or(false); let mut new_def = def; - let (def_id, ty) = if let Def::SelfCtor(impl_def_id) = def { - let ty = self.impl_self_ty(span, impl_def_id).ty; + let (def_id, ty) = match def { + Def::SelfCtor(impl_def_id) => { + let ty = self.impl_self_ty(span, impl_def_id).ty; + let adt_def = ty.ty_adt_def(); - match ty.ty_adt_def() { - Some(adt_def) if adt_def.is_struct() => { - let variant = adt_def.non_enum_variant(); - new_def = Def::StructCtor(variant.did, variant.ctor_kind); - (variant.did, self.tcx.type_of(variant.did)) - } - _ => { - (impl_def_id, self.tcx.types.err) + match adt_def { + Some(adt_def) if adt_def.has_ctor() => { + let variant = adt_def.non_enum_variant(); + new_def = Def::StructCtor(variant.did, variant.ctor_kind); + (variant.did, self.tcx.type_of(variant.did)) + } + _ => { + let mut err = self.tcx.sess.struct_span_err(span, + "the `Self` constructor can only be used with tuple or unit structs"); + if let Some(adt_def) = adt_def { + match adt_def.adt_kind() { + AdtKind::Enum => { + err.note("did you mean to use one of the enum's variants?"); + }, + AdtKind::Struct | + AdtKind::Union => { + err.span_label( + span, + format!("did you mean `Self {{ /* fields */ }}`?"), + ); + } + } + } + err.emit(); + + (impl_def_id, self.tcx.types.err) + } } } - } else { - let def_id = def.def_id(); + _ => { + let def_id = def.def_id(); - // The things we are substituting into the type should not contain - // escaping late-bound regions, and nor should the base type scheme. - let ty = self.tcx.type_of(def_id); - (def_id, ty) + // The things we are substituting into the type should not contain + // escaping late-bound regions, and nor should the base type scheme. + let ty = self.tcx.type_of(def_id); + (def_id, ty) + } }; let substs = AstConv::create_substs_for_generic_args( diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index b6242457ae..df4ced794f 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -283,7 +283,7 @@ nav.sub { padding-left: 0; } -:not(.source) .example-wrap { +.rustdoc:not(.source) .example-wrap { display: inline-flex; margin-bottom: 10px; } @@ -301,11 +301,11 @@ nav.sub { text-align: right; } -:not(.source) .example-wrap > pre.rust { +.rustdoc:not(.source) .example-wrap > pre.rust { width: 100%; } -body:not(.source) .example-wrap > pre { +.rustdoc:not(.source) .example-wrap > pre { margin: 0; } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index d9bab91fd0..2aff128d75 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -395,7 +395,7 @@ pub fn make_test(s: &str, // Uses libsyntax to parse the doctest and find if there's a main fn and the extern // crate already is included. - let (already_has_main, already_has_extern_crate) = crate::syntax::with_globals(|| { + let (already_has_main, already_has_extern_crate, found_macro) = crate::syntax::with_globals(|| { use crate::syntax::{ast, parse::{self, ParseSess}, source_map::FilePathMapping}; use crate::syntax_pos::FileName; use errors::emitter::EmitterWriter; @@ -415,6 +415,7 @@ pub fn make_test(s: &str, let mut found_main = false; let mut found_extern_crate = cratename.is_none(); + let mut found_macro = false; let mut parser = match parse::maybe_new_parser_from_source_str(&sess, filename, source) { Ok(p) => p, @@ -423,7 +424,7 @@ pub fn make_test(s: &str, err.cancel(); } - return (found_main, found_extern_crate); + return (found_main, found_extern_crate, found_macro); } }; @@ -451,6 +452,12 @@ pub fn make_test(s: &str, } } + if !found_macro { + if let ast::ItemKind::Mac(..) = item.node { + found_macro = true; + } + } + if found_main && found_extern_crate { break; } @@ -463,9 +470,28 @@ pub fn make_test(s: &str, } } - (found_main, found_extern_crate) + (found_main, found_extern_crate, found_macro) }); + // If a doctest's `fn main` is being masked by a wrapper macro, the parsing loop above won't + // see it. In that case, run the old text-based scan to see if they at least have a main + // function written inside a macro invocation. See + // https://github.com/rust-lang/rust/issues/56898 + let already_has_main = if found_macro && !already_has_main { + s.lines() + .map(|line| { + let comment = line.find("//"); + if let Some(comment_begins) = comment { + &line[0..comment_begins] + } else { + line + } + }) + .any(|code| code.contains("fn main")) + } else { + already_has_main + }; + // Don't inject `extern crate std` because it's already injected by the // compiler. if !already_has_extern_crate && !opts.no_crate_inject && cratename != Some("std") { @@ -1106,4 +1132,23 @@ assert_eq!(asdf::foo, 4); let output = make_test(input, Some("asdf"), false, &opts); assert_eq!(output, (expected, 3)); } + + #[test] + fn make_test_main_in_macro() { + let opts = TestOptions::default(); + let input = +"#[macro_use] extern crate my_crate; +test_wrapper! { + fn main() {} +}"; + let expected = +"#![allow(unused)] +#[macro_use] extern crate my_crate; +test_wrapper! { + fn main() {} +}".to_string(); + + let output = make_test(input, Some("my_crate"), false, &opts); + assert_eq!(output, (expected, 1)); + } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index fac7ff2bf3..8fd36a125c 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -459,10 +459,7 @@ declare_features! ( // Support for arbitrary delimited token streams in non-macro attributes (active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None), - // Allows `use x::y;` to resolve through `self::x`, not just `::x` - (active, uniform_paths, "1.30.0", Some(53130), None), - - // Allows unsized rvalues at arguments and parameters + // Allows unsized rvalues at arguments and parameters. (active, unsized_locals, "1.30.0", Some(48055), None), // #![test_runner] @@ -689,6 +686,8 @@ declare_features! ( (accepted, self_struct_ctor, "1.32.0", Some(51994), None), // `Self` in type definitions (RFC 2300) (accepted, self_in_typedefs, "1.32.0", Some(49303), None), + // Allows `use x::y;` to search `x` in the current scope. + (accepted, uniform_paths, "1.32.0", Some(53130), None), ); // If you change this, please modify `src/doc/unstable-book` as well. You must diff --git a/src/rustllvm/llvm-rebuild-trigger b/src/rustllvm/llvm-rebuild-trigger index 9cf17c45e8..a268838de4 100644 --- a/src/rustllvm/llvm-rebuild-trigger +++ b/src/rustllvm/llvm-rebuild-trigger @@ -1,4 +1,4 @@ # If this file is modified, then llvm will be (optionally) cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. -2018-11-28 +2018-12-13 diff --git a/src/stage0.txt b/src/stage0.txt index b0ef7b6d04..2b089c0ddf 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,8 +12,8 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.x.0` for Cargo where they were released on `date`. -date: 2018-12-06 -rustc: 1.31.0 +date: 2018-12-20 +rustc: 1.31.1 cargo: 0.32.0 # When making a stable release the process currently looks like: diff --git a/src/test/codegen/issue-56927.rs b/src/test/codegen/issue-56927.rs new file mode 100644 index 0000000000..0544ff86aa --- /dev/null +++ b/src/test/codegen/issue-56927.rs @@ -0,0 +1,44 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type="rlib"] +use std::usize; + +#[repr(align(16))] +pub struct S { + arr: [u32; 4], +} + +// CHECK-LABEL: @test1 +// CHECK: store i32 0, i32* %{{.+}}, align 16 +// CHECK: store i32 1, i32* %{{.+}}, align 4 +// CHECK: store i32 2, i32* %{{.+}}, align 8 +// CHECK: store i32 3, i32* %{{.+}}, align 4 +#[no_mangle] +pub fn test1(s: &mut S) { + s.arr[0] = 0; + s.arr[1] = 1; + s.arr[2] = 2; + s.arr[3] = 3; +} + +// CHECK-LABEL: @test2 +// CHECK: store i32 4, i32* %{{.+}}, align 4 +#[allow(const_err)] +#[no_mangle] +pub fn test2(s: &mut S) { + s.arr[usize::MAX / 4 + 1] = 4; +} + +// CHECK-LABEL: @test3 +// CHECK: store i32 5, i32* %{{.+}}, align 4 +#[no_mangle] +pub fn test3(s: &mut S, i: usize) { + s.arr[i] = 5; +} + +// CHECK-LABEL: @test4 +// CHECK: store i32 6, i32* %{{.+}}, align 4 +#[no_mangle] +pub fn test4(s: &mut S) { + s.arr = [6; 4]; +} diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index b50f5b6f16..e60051de55 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -84,6 +84,42 @@ pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 { BigPacked2 { dealign: 0, data: f() } } +// CHECK-LABEL: @write_packed_array1 +// CHECK: store i32 0, i32* %{{.+}}, align 1 +// CHECK: store i32 1, i32* %{{.+}}, align 1 +// CHECK: store i32 2, i32* %{{.+}}, align 1 +#[no_mangle] +pub fn write_packed_array1(p: &mut BigPacked1) { + p.data.0[0] = 0; + p.data.0[1] = 1; + p.data.0[2] = 2; +} + +// CHECK-LABEL: @write_packed_array2 +// CHECK: store i32 0, i32* %{{.+}}, align 2 +// CHECK: store i32 1, i32* %{{.+}}, align 2 +// CHECK: store i32 2, i32* %{{.+}}, align 2 +#[no_mangle] +pub fn write_packed_array2(p: &mut BigPacked2) { + p.data.0[0] = 0; + p.data.0[1] = 1; + p.data.0[2] = 2; +} + +// CHECK-LABEL: @repeat_packed_array1 +// CHECK: store i32 42, i32* %{{.+}}, align 1 +#[no_mangle] +pub fn repeat_packed_array1(p: &mut BigPacked1) { + p.data.0 = [42; 8]; +} + +// CHECK-LABEL: @repeat_packed_array2 +// CHECK: store i32 42, i32* %{{.+}}, align 2 +#[no_mangle] +pub fn repeat_packed_array2(p: &mut BigPacked2) { + p.data.0 = [42; 8]; +} + #[repr(packed)] #[derive(Copy, Clone)] pub struct Packed1Pair(u8, u32); diff --git a/src/test/run-pass/issue-56237.rs b/src/test/run-pass/issue-56237.rs new file mode 100644 index 0000000000..87e10e8361 --- /dev/null +++ b/src/test/run-pass/issue-56237.rs @@ -0,0 +1,11 @@ +use std::ops::Deref; + +fn foo

(_value:

::Target) +where + P: Deref, +

::Target: Sized, +{} + +fn main() { + foo::>(2); +} diff --git a/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs b/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs index 5845afd72f..86d0244cbc 100644 --- a/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs +++ b/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs @@ -10,8 +10,6 @@ // edition:2018 -#![feature(uniform_paths)] - mod m { pub fn f() {} } mod n { pub fn g() {} } diff --git a/src/test/run-pass/uniform-paths/basic-nested.rs b/src/test/run-pass/uniform-paths/basic-nested.rs index a0256187db..bccd3eace8 100644 --- a/src/test/run-pass/uniform-paths/basic-nested.rs +++ b/src/test/run-pass/uniform-paths/basic-nested.rs @@ -1,22 +1,12 @@ -// Copyright 2018 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. +// This test is similar to `basic.rs`, but nested in modules. // run-pass -#![allow(unused_imports)] -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(decl_macro, uniform_paths)] +#![feature(decl_macro)] -// This test is similar to `basic.rs`, but nested in modules. +#![allow(unused_imports)] +#![allow(non_camel_case_types)] mod foo { // Test that ambiguity errors are not emitted between `self::test` and diff --git a/src/test/run-pass/uniform-paths/basic.rs b/src/test/run-pass/uniform-paths/basic.rs index b957b24d62..be74359752 100644 --- a/src/test/run-pass/uniform-paths/basic.rs +++ b/src/test/run-pass/uniform-paths/basic.rs @@ -9,12 +9,10 @@ // except according to those terms. // run-pass -#![allow(unused_imports)] -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(uniform_paths)] +#![allow(unused_imports)] +#![allow(non_camel_case_types)] // Test that ambiguity errors are not emitted between `self::test` and // `::test`, assuming the latter (crate) is not in `extern_prelude`. diff --git a/src/test/run-pass/uniform-paths/macros-nested.rs b/src/test/run-pass/uniform-paths/macros-nested.rs index 373734345f..275105c5b3 100644 --- a/src/test/run-pass/uniform-paths/macros-nested.rs +++ b/src/test/run-pass/uniform-paths/macros-nested.rs @@ -1,21 +1,9 @@ -// Copyright 2018 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. +// This test is similar to `macros.rs`, but nested in modules. // run-pass -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(uniform_paths)] - -// This test is similar to `macros.rs`, but nested in modules. +#![allow(non_camel_case_types)] mod foo { // Test that ambiguity errors are not emitted between `self::test` and diff --git a/src/test/run-pass/uniform-paths/macros.rs b/src/test/run-pass/uniform-paths/macros.rs index 20984eb13d..31b809f0cf 100644 --- a/src/test/run-pass/uniform-paths/macros.rs +++ b/src/test/run-pass/uniform-paths/macros.rs @@ -1,21 +1,9 @@ -// Copyright 2018 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. +// This test is similar to `basic.rs`, but with macros defining local items. // run-pass -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(uniform_paths)] - -// This test is similar to `basic.rs`, but with macros defining local items. +#![allow(non_camel_case_types)] // Test that ambiguity errors are not emitted between `self::test` and // `::test`, assuming the latter (crate) is not in `extern_prelude`. diff --git a/src/test/run-pass/uniform-paths/same-crate.rs b/src/test/run-pass/uniform-paths/same-crate.rs index bb15d6d53a..307a80ac99 100644 --- a/src/test/run-pass/uniform-paths/same-crate.rs +++ b/src/test/run-pass/uniform-paths/same-crate.rs @@ -9,11 +9,8 @@ // except according to those terms. // run-pass - // edition:2018 -#![feature(uniform_paths)] - pub const A: usize = 0; pub mod foo { diff --git a/src/test/rustdoc/issue-50159.rs b/src/test/rustdoc/issue-50159.rs new file mode 100644 index 0000000000..3055c72162 --- /dev/null +++ b/src/test/rustdoc/issue-50159.rs @@ -0,0 +1,31 @@ +// Copyright 2018 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. + + +pub trait Signal { + type Item; +} + +pub trait Signal2 { + type Item2; +} + +impl Signal2 for B where B: Signal { + type Item2 = C; +} + +// @has issue_50159/struct.Switch.html +// @has - '//code' 'impl Send for Switch where ::Item: Send' +// @has - '//code' 'impl Sync for Switch where ::Item: Sync' +// @count - '//*[@id="implementations-list"]/*[@class="impl"]' 0 +// @count - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]' 2 +pub struct Switch { + pub inner: ::Item2, +} diff --git a/src/test/ui/feature-gates/feature-gate-uniform-paths.rs b/src/test/rustdoc/issue-56822.rs similarity index 50% rename from src/test/ui/feature-gates/feature-gate-uniform-paths.rs rename to src/test/rustdoc/issue-56822.rs index ca1cc1d2fd..41aba1a007 100644 --- a/src/test/ui/feature-gates/feature-gate-uniform-paths.rs +++ b/src/test/rustdoc/issue-56822.rs @@ -8,22 +8,27 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// edition:2018 +struct Wrapper(T); -pub mod foo { - pub use bar::Bar; //~ ERROR imports can only refer to extern crate names - - pub mod bar { - pub struct Bar; - } +trait MyTrait { + type Output; } -use inline; //~ ERROR imports can only refer to extern crate names - -use Vec; //~ ERROR imports can only refer to extern crate names - -use vec; //~ ERROR imports can only refer to extern crate names - -fn main() { - let _ = foo::Bar; +impl<'a, I, T: 'a> MyTrait for Wrapper + where I: MyTrait +{ + type Output = T; +} + +struct Inner<'a, T>(&'a T); + +impl<'a, T> MyTrait for Inner<'a, T> { + type Output = &'a T; +} + +// @has issue_56822/struct.Parser.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'a> Send for \ +// Parser<'a>" +pub struct Parser<'a> { + field: > as MyTrait>::Output } diff --git a/src/test/rustdoc/synthetic_auto/self-referential.rs b/src/test/rustdoc/synthetic_auto/self-referential.rs new file mode 100644 index 0000000000..516a3c9a51 --- /dev/null +++ b/src/test/rustdoc/synthetic_auto/self-referential.rs @@ -0,0 +1,40 @@ +// Copyright 2018 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. + +// Some unusual code minimized from +// https://github.com/sile/handy_async/tree/7b619b762c06544fc67792c8ff8ebc24a88fdb98 + +pub trait Pattern { + type Value; +} + +pub struct Constrain(A, B, C); + +impl Pattern for Constrain + where A: Pattern, + B: Pattern, + C: Pattern, +{ + type Value = A::Value; +} + +pub struct Wrapper(T); + +impl Pattern for Wrapper { + type Value = T; +} + + +// @has self_referential/struct.WriteAndThen.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \ +// WriteAndThen where ::Value: Send" +pub struct WriteAndThen(pub P1::Value,pub > as Pattern>::Value) + where P1: Pattern; + diff --git a/src/test/ui/consts/promoted_regression.rs b/src/test/ui/consts/promoted_regression.rs new file mode 100644 index 0000000000..68b9a20ecf --- /dev/null +++ b/src/test/ui/consts/promoted_regression.rs @@ -0,0 +1,9 @@ +// compile-pass + +fn main() { + let _ = &[("", ""); 3]; +} + +const FOO: &[(&str, &str)] = &[("", ""); 3]; +const BAR: &[(&str, &str); 5] = &[("", ""); 5]; +const BAA: &[[&str; 12]; 11] = &[[""; 12]; 11]; diff --git a/src/test/ui/consts/static_mut_containing_mut_ref.rs b/src/test/ui/consts/static_mut_containing_mut_ref.rs new file mode 100644 index 0000000000..27e1a11116 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref.rs @@ -0,0 +1,7 @@ +// compile-pass + +static mut STDERR_BUFFER_SPACE: [u8; 42] = [0u8; 42]; + +pub static mut STDERR_BUFFER: *mut [u8] = unsafe { &mut STDERR_BUFFER_SPACE }; + +fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.rs b/src/test/ui/consts/static_mut_containing_mut_ref2.rs new file mode 100644 index 0000000000..aeb69b2652 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.rs @@ -0,0 +1,8 @@ +#![feature(const_let)] + +static mut STDERR_BUFFER_SPACE: u8 = 0; + +pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; +//~^ ERROR references in statics may only refer to immutable values + +fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.stderr new file mode 100644 index 0000000000..72923431c9 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.stderr @@ -0,0 +1,9 @@ +error[E0017]: references in statics may only refer to immutable values + --> $DIR/static_mut_containing_mut_ref2.rs:5:46 + | +LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ statics require immutable values + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0017`. diff --git a/src/test/ui/consts/static_mut_containing_mut_ref3.rs b/src/test/ui/consts/static_mut_containing_mut_ref3.rs new file mode 100644 index 0000000000..0bc7faa9af --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref3.rs @@ -0,0 +1,8 @@ +#![feature(const_let)] + +static mut FOO: (u8, u8) = (42, 43); + +static mut BAR: () = unsafe { FOO.0 = 99; }; +//~^ ERROR could not evaluate static initializer + +fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref3.stderr b/src/test/ui/consts/static_mut_containing_mut_ref3.stderr new file mode 100644 index 0000000000..cae53c6fee --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref3.stderr @@ -0,0 +1,9 @@ +error[E0080]: could not evaluate static initializer + --> $DIR/static_mut_containing_mut_ref3.rs:5:31 + | +LL | static mut BAR: () = unsafe { FOO.0 = 99; }; + | ^^^^^^^^^^ tried to modify a static's initial value from another static's initializer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/editions/edition-imports-2015.rs b/src/test/ui/editions/edition-imports-2015.rs index b89ca28e27..5ba45b19dd 100644 --- a/src/test/ui/editions/edition-imports-2015.rs +++ b/src/test/ui/editions/edition-imports-2015.rs @@ -3,8 +3,6 @@ // aux-build:edition-imports-2018.rs // aux-build:absolute.rs -#![feature(uniform_paths)] - #[macro_use] extern crate edition_imports_2018; diff --git a/src/test/ui/editions/edition-imports-2015.stderr b/src/test/ui/editions/edition-imports-2015.stderr index fb6b2e64ef..816ab21d81 100644 --- a/src/test/ui/editions/edition-imports-2015.stderr +++ b/src/test/ui/editions/edition-imports-2015.stderr @@ -1,5 +1,5 @@ error: cannot glob-import all possible crates - --> $DIR/edition-imports-2015.rs:25:5 + --> $DIR/edition-imports-2015.rs:23:5 | LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates | ^^^^^^^^^^^^ diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr index 7c1837e3f5..7c78fbb26a 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr @@ -1,4 +1,4 @@ -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) +error: imports can only refer to extern crate names passed with `--extern` in macros originating from 2015 edition --> <::edition_imports_2015::gen_gated macros>:1:50 | LL | ( ) => { fn check_gated ( ) { enum E { A } use E :: * ; } } @@ -9,7 +9,6 @@ LL | ( ) => { fn check_gated ( ) { enum E { A } use E :: * ; } } LL | gen_gated!(); | ------------- not an extern crate passed with `--extern` | - = help: add #![feature(uniform_paths)] to the crate attributes to enable note: this import refers to the enum defined here --> $DIR/edition-imports-virtual-2015-gated.rs:9:5 | @@ -19,4 +18,3 @@ LL | gen_gated!(); error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-uniform-paths.stderr b/src/test/ui/feature-gates/feature-gate-uniform-paths.stderr deleted file mode 100644 index ec8937bbc5..0000000000 --- a/src/test/ui/feature-gates/feature-gate-uniform-paths.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:14:13 - | -LL | pub use bar::Bar; //~ ERROR imports can only refer to extern crate names - | ^^^ -LL | -LL | / pub mod bar { -LL | | pub struct Bar; -LL | | } - | |_____- not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the module defined here - --> $DIR/feature-gate-uniform-paths.rs:16:5 - | -LL | / pub mod bar { -LL | | pub struct Bar; -LL | | } - | |_____^ - -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:21:5 - | -LL | use inline; //~ ERROR imports can only refer to extern crate names - | ^^^^^^ not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the built-in attribute imported here - --> $DIR/feature-gate-uniform-paths.rs:21:5 - | -LL | use inline; //~ ERROR imports can only refer to extern crate names - | ^^^^^^ - -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:23:5 - | -LL | use Vec; //~ ERROR imports can only refer to extern crate names - | ^^^ not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the struct imported here - --> $DIR/feature-gate-uniform-paths.rs:23:5 - | -LL | use Vec; //~ ERROR imports can only refer to extern crate names - | ^^^ - -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:25:5 - | -LL | use vec; //~ ERROR imports can only refer to extern crate names - | ^^^ not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the macro imported here - --> $DIR/feature-gate-uniform-paths.rs:25:5 - | -LL | use vec; //~ ERROR imports can only refer to extern crate names - | ^^^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/imports/duplicate.rs b/src/test/ui/imports/duplicate.rs index dd2dcbe2e6..aad5529851 100644 --- a/src/test/ui/imports/duplicate.rs +++ b/src/test/ui/imports/duplicate.rs @@ -43,7 +43,7 @@ mod g { fn main() { e::foo(); f::foo(); //~ ERROR `foo` is ambiguous - g::foo(); //~ ERROR `foo` is ambiguous + g::foo(); } mod ambiguous_module_errors { diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr index f53ba9cd5d..b4b3fc2eca 100644 --- a/src/test/ui/imports/duplicate.stderr +++ b/src/test/ui/imports/duplicate.stderr @@ -50,25 +50,6 @@ LL | pub use b::*; | ^^^^ = help: consider adding an explicit import of `foo` to disambiguate -error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) - --> $DIR/duplicate.rs:46:8 - | -LL | g::foo(); //~ ERROR `foo` is ambiguous - | ^^^ ambiguous name - | -note: `foo` could refer to the function imported here - --> $DIR/duplicate.rs:39:13 - | -LL | pub use a::*; - | ^^^^ - = help: consider adding an explicit import of `foo` to disambiguate -note: `foo` could also refer to the unresolved item imported here - --> $DIR/duplicate.rs:40:13 - | -LL | pub use f::*; - | ^^^^ - = help: consider adding an explicit import of `foo` to disambiguate - error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:59:9 | @@ -88,7 +69,7 @@ LL | use self::m2::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0252, E0659. For more information about an error, try `rustc --explain E0252`. diff --git a/src/test/ui/imports/issue-56125.rs b/src/test/ui/imports/issue-56125.rs index 843b52f184..b4963e480a 100644 --- a/src/test/ui/imports/issue-56125.rs +++ b/src/test/ui/imports/issue-56125.rs @@ -2,8 +2,6 @@ // compile-flags:--extern issue_56125 // aux-build:issue-56125.rs -#![feature(uniform_paths)] - mod m1 { use issue_56125::last_segment::*; //~^ ERROR `issue_56125` is ambiguous diff --git a/src/test/ui/imports/issue-56125.stderr b/src/test/ui/imports/issue-56125.stderr index b1292ef8f7..a6e45a5655 100644 --- a/src/test/ui/imports/issue-56125.stderr +++ b/src/test/ui/imports/issue-56125.stderr @@ -1,23 +1,23 @@ error[E0433]: failed to resolve: could not find `non_last_segment` in `issue_56125` - --> $DIR/issue-56125.rs:14:22 + --> $DIR/issue-56125.rs:12:22 | LL | use issue_56125::non_last_segment::non_last_segment::*; | ^^^^^^^^^^^^^^^^ could not find `non_last_segment` in `issue_56125` error[E0432]: unresolved import `issue_56125::last_segment` - --> $DIR/issue-56125.rs:8:22 + --> $DIR/issue-56125.rs:6:22 | LL | use issue_56125::last_segment::*; | ^^^^^^^^^^^^ could not find `last_segment` in `issue_56125` error[E0432]: unresolved import `empty::issue_56125` - --> $DIR/issue-56125.rs:21:9 + --> $DIR/issue-56125.rs:19:9 | LL | use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125` | ^^^^^^^^^^^^^^^^^^ no `issue_56125` in `m3::empty` error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) - --> $DIR/issue-56125.rs:8:9 + --> $DIR/issue-56125.rs:6:9 | LL | use issue_56125::last_segment::*; | ^^^^^^^^^^^ ambiguous name @@ -25,14 +25,14 @@ LL | use issue_56125::last_segment::*; = note: `issue_56125` could refer to an extern crate passed with `--extern` = help: use `::issue_56125` to refer to this extern crate unambiguously note: `issue_56125` could also refer to the module imported here - --> $DIR/issue-56125.rs:8:9 + --> $DIR/issue-56125.rs:6:9 | LL | use issue_56125::last_segment::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: use `self::issue_56125` to refer to this module unambiguously error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) - --> $DIR/issue-56125.rs:14:9 + --> $DIR/issue-56125.rs:12:9 | LL | use issue_56125::non_last_segment::non_last_segment::*; | ^^^^^^^^^^^ ambiguous name @@ -40,26 +40,26 @@ LL | use issue_56125::non_last_segment::non_last_segment::*; = note: `issue_56125` could refer to an extern crate passed with `--extern` = help: use `::issue_56125` to refer to this extern crate unambiguously note: `issue_56125` could also refer to the module imported here - --> $DIR/issue-56125.rs:14:9 + --> $DIR/issue-56125.rs:12:9 | LL | use issue_56125::non_last_segment::non_last_segment::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: use `self::issue_56125` to refer to this module unambiguously error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) - --> $DIR/issue-56125.rs:22:9 + --> $DIR/issue-56125.rs:20:9 | LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous | ^^^^^^^^^^^ ambiguous name | = note: `issue_56125` could refer to an extern crate passed with `--extern` = help: use `::issue_56125` to refer to this extern crate unambiguously -note: `issue_56125` could also refer to the unresolved item imported here - --> $DIR/issue-56125.rs:21:9 +note: `issue_56125` could also refer to the module imported here + --> $DIR/issue-56125.rs:20:9 | -LL | use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125` - | ^^^^^^^^^^^^^^^^^^ - = help: use `self::issue_56125` to refer to this unresolved item unambiguously +LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous + | ^^^^^^^^^^^^^^ + = help: use `self::issue_56125` to refer to this module unambiguously error: aborting due to 6 previous errors diff --git a/src/test/ui/imports/issue-57015.rs b/src/test/ui/imports/issue-57015.rs new file mode 100644 index 0000000000..27688fd34f --- /dev/null +++ b/src/test/ui/imports/issue-57015.rs @@ -0,0 +1,13 @@ +mod glob_ok { + pub mod something { + pub mod something_else {} + } +} + +mod single_err {} + +use glob_ok::*; // glob_ok::something +use single_err::something; //~ ERROR unresolved import `single_err::something` +use something::something_else; + +fn main() {} diff --git a/src/test/ui/imports/issue-57015.stderr b/src/test/ui/imports/issue-57015.stderr new file mode 100644 index 0000000000..b0fcf5bec6 --- /dev/null +++ b/src/test/ui/imports/issue-57015.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `single_err::something` + --> $DIR/issue-57015.rs:10:5 + | +LL | use single_err::something; //~ ERROR unresolved import `single_err::something` + | ^^^^^^^^^^^^^^^^^^^^^ no `something` in `single_err` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/issues/issue-56199.rs b/src/test/ui/issues/issue-56199.rs new file mode 100644 index 0000000000..83d4e31b5d --- /dev/null +++ b/src/test/ui/issues/issue-56199.rs @@ -0,0 +1,23 @@ + +enum Foo {} +struct Bar {} + +impl Foo { + fn foo() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +impl Bar { + fn bar() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-56199.stderr b/src/test/ui/issues/issue-56199.stderr new file mode 100644 index 0000000000..6e3c7fd17b --- /dev/null +++ b/src/test/ui/issues/issue-56199.stderr @@ -0,0 +1,30 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:7:17 + | +LL | let _ = Self; + | ^^^^ + | + = note: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:9:17 + | +LL | let _ = Self(); + | ^^^^ + | + = note: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:16:17 + | +LL | let _ = Self; + | ^^^^ did you mean `Self { /* fields */ }`? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:18:17 + | +LL | let _ = Self(); + | ^^^^ did you mean `Self { /* fields */ }`? + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/issues/issue-56835.rs b/src/test/ui/issues/issue-56835.rs new file mode 100644 index 0000000000..c16550e370 --- /dev/null +++ b/src/test/ui/issues/issue-56835.rs @@ -0,0 +1,10 @@ + +pub struct Foo {} + +impl Foo { + fn bar(Self(foo): Self) {} + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + //~^^ ERROR expected tuple struct/variant, found self constructor `Self` [E0164] +} + +fn main() {} diff --git a/src/test/ui/issues/issue-56835.stderr b/src/test/ui/issues/issue-56835.stderr new file mode 100644 index 0000000000..b7c3b142ec --- /dev/null +++ b/src/test/ui/issues/issue-56835.stderr @@ -0,0 +1,15 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56835.rs:5:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ did you mean `Self { /* fields */ }`? + +error[E0164]: expected tuple struct/variant, found self constructor `Self` + --> $DIR/issue-56835.rs:5:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ not a tuple variant or struct + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0164`. diff --git a/src/test/ui/issues/issue-57156.rs b/src/test/ui/issues/issue-57156.rs new file mode 100644 index 0000000000..f20b0f41c7 --- /dev/null +++ b/src/test/ui/issues/issue-57156.rs @@ -0,0 +1,23 @@ +// compile-pass + +trait Foo { + type Output; +} + +trait Bar<'a, T>: for<'s> Foo<&'s T, Output=bool> { + fn cb(&self) -> Box>; +} + +impl<'s> Foo<&'s ()> for () { + type Output = bool; +} + +impl<'a> Bar<'a, ()> for () { + fn cb(&self) -> Box> { + Box::new(*self) + } +} + +fn main() { + let _t = ().cb(); +} diff --git a/src/test/ui/nll/issue-57265-return-type-wf-check.rs b/src/test/ui/nll/issue-57265-return-type-wf-check.rs new file mode 100644 index 0000000000..24c61a4926 --- /dev/null +++ b/src/test/ui/nll/issue-57265-return-type-wf-check.rs @@ -0,0 +1,26 @@ +#![feature(nll)] + +use std::any::Any; + +#[derive(Debug, Clone)] +struct S(T); + +// S<&'a T> is in the return type, so we get an implied bound +// &'a T: 'static +fn foo<'a, T>(x: &'a T) -> (S<&'a T>, Box) { + let y = S(x); + + let z = Box::new(y.clone()) as Box; + (y, z) +} + +fn main() { + let x = 5; + + // Check that we require that the argument is of type `&'static String`, + // so that the return type is well-formed. + let (_, z) = foo(&"hello".to_string()); + //~^ ERROR temporary value dropped while borrowed + + println!("{:?}", z.downcast_ref::>()); +} diff --git a/src/test/ui/nll/issue-57265-return-type-wf-check.stderr b/src/test/ui/nll/issue-57265-return-type-wf-check.stderr new file mode 100644 index 0000000000..db01212597 --- /dev/null +++ b/src/test/ui/nll/issue-57265-return-type-wf-check.stderr @@ -0,0 +1,12 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/issue-57265-return-type-wf-check.rs:22:23 + | +LL | let (_, z) = foo(&"hello".to_string()); + | -----^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement + | | | + | | creates a temporary which is freed while still in use + | argument requires that borrow lasts for `'static` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.rs b/src/test/ui/proc-macro/derive-helper-shadowing.rs index aa9eae0ba3..d4a0721147 100644 --- a/src/test/ui/proc-macro/derive-helper-shadowing.rs +++ b/src/test/ui/proc-macro/derive-helper-shadowing.rs @@ -5,6 +5,21 @@ use derive_helper_shadowing::*; #[my_attr] //~ ERROR `my_attr` is ambiguous #[derive(MyTrait)] -struct S; +struct S { + // FIXME No ambiguity, attributes in non-macro positions are not resolved properly + #[my_attr] + field: [u8; { + // FIXME No ambiguity, derive helpers are not put into scope for non-attributes + use my_attr; -fn main() {} + // FIXME No ambiguity, derive helpers are not put into scope for inner items + #[my_attr] + struct U; + + 0 + }] +} + +fn main() { + let s = S { field: [] }; +} diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs index bfe7e4da84..92541afc0c 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs @@ -10,8 +10,6 @@ // edition:2018 -#![feature(uniform_paths)] - // Tests that arbitrary crates (other than `core`, `std` and `meta`) // aren't allowed without `--extern`, even if they're in the sysroot. use alloc; //~ ERROR unresolved import `alloc` diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr index 06c11b894d..e70a359b57 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr @@ -1,11 +1,11 @@ error: cannot import a built-in macro - --> $DIR/not-whitelisted.rs:18:5 + --> $DIR/not-whitelisted.rs:16:5 | LL | use test; //~ ERROR cannot import a built-in macro | ^^^^ error[E0432]: unresolved import `alloc` - --> $DIR/not-whitelisted.rs:17:5 + --> $DIR/not-whitelisted.rs:15:5 | LL | use alloc; //~ ERROR unresolved import `alloc` | ^^^^^ no `alloc` external crate diff --git a/src/test/ui/rust-2018/future-proofing-locals.rs b/src/test/ui/rust-2018/future-proofing-locals.rs index d2e6dbbb95..ee8136346f 100644 --- a/src/test/ui/rust-2018/future-proofing-locals.rs +++ b/src/test/ui/rust-2018/future-proofing-locals.rs @@ -1,6 +1,7 @@ // edition:2018 -#![feature(uniform_paths, underscore_imports)] +#![feature(underscore_imports)] +#![allow(non_camel_case_types)] mod T { pub struct U; @@ -16,7 +17,7 @@ fn type_param() { } fn self_import() { - use T; // FIXME Should be an error, but future-proofing fails due to `T` being "self-shadowed" + use T; //~ ERROR imports cannot refer to type parameters } fn let_binding() { diff --git a/src/test/ui/rust-2018/future-proofing-locals.stderr b/src/test/ui/rust-2018/future-proofing-locals.stderr index 68354b332a..6b4baab0df 100644 --- a/src/test/ui/rust-2018/future-proofing-locals.stderr +++ b/src/test/ui/rust-2018/future-proofing-locals.stderr @@ -1,50 +1,56 @@ error: imports cannot refer to type parameters - --> $DIR/future-proofing-locals.rs:13:9 + --> $DIR/future-proofing-locals.rs:14:9 | LL | use T as _; //~ ERROR imports cannot refer to type parameters | ^ error: imports cannot refer to type parameters - --> $DIR/future-proofing-locals.rs:14:9 + --> $DIR/future-proofing-locals.rs:15:9 | LL | use T::U; //~ ERROR imports cannot refer to type parameters | ^ error: imports cannot refer to type parameters - --> $DIR/future-proofing-locals.rs:15:9 + --> $DIR/future-proofing-locals.rs:16:9 | LL | use T::*; //~ ERROR imports cannot refer to type parameters | ^ +error: imports cannot refer to type parameters + --> $DIR/future-proofing-locals.rs:20:9 + | +LL | use T; //~ ERROR imports cannot refer to type parameters + | ^ + error: imports cannot refer to local variables - --> $DIR/future-proofing-locals.rs:25:9 + --> $DIR/future-proofing-locals.rs:26:9 | LL | use x as _; //~ ERROR imports cannot refer to local variables | ^ error: imports cannot refer to local variables - --> $DIR/future-proofing-locals.rs:31:9 + --> $DIR/future-proofing-locals.rs:32:9 | LL | use x; //~ ERROR imports cannot refer to local variables | ^ error: imports cannot refer to local variables - --> $DIR/future-proofing-locals.rs:37:17 + --> $DIR/future-proofing-locals.rs:38:17 | LL | use x; //~ ERROR imports cannot refer to local variables | ^ error: imports cannot refer to type parameters - --> $DIR/future-proofing-locals.rs:45:10 + --> $DIR/future-proofing-locals.rs:46:10 | LL | use {T as _, x}; //~ ERROR imports cannot refer to type parameters | ^ error: imports cannot refer to local variables - --> $DIR/future-proofing-locals.rs:45:18 + --> $DIR/future-proofing-locals.rs:46:18 | LL | use {T as _, x}; //~ ERROR imports cannot refer to type parameters | ^ -error: aborting due to 8 previous errors +error: aborting due to 9 previous errors diff --git a/src/test/ui/rust-2018/local-path-suggestions-2018.rs b/src/test/ui/rust-2018/local-path-suggestions-2018.rs index 0d4aefff93..53c92e1c20 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2018.rs +++ b/src/test/ui/rust-2018/local-path-suggestions-2018.rs @@ -12,8 +12,6 @@ // compile-flags:--extern baz // edition:2018 -#![feature(uniform_paths)] - mod foo { pub type Bar = u32; } diff --git a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr index a445a4c612..4fb1a05015 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `foo` - --> $DIR/local-path-suggestions-2018.rs:22:9 + --> $DIR/local-path-suggestions-2018.rs:20:9 | LL | use foo::Bar; //~ ERROR unresolved import `foo` | ^^^ did you mean `crate::foo`? @@ -7,7 +7,7 @@ LL | use foo::Bar; //~ ERROR unresolved import `foo` = note: `use` statements changed in Rust 2018; read more at error[E0432]: unresolved import `foobar` - --> $DIR/local-path-suggestions-2018.rs:31:5 + --> $DIR/local-path-suggestions-2018.rs:29:5 | LL | use foobar::Baz; //~ ERROR unresolved import `foobar` | ^^^^^^ did you mean `baz::foobar`? diff --git a/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs new file mode 100644 index 0000000000..db723075f9 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs @@ -0,0 +1 @@ +pub extern crate core; diff --git a/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs new file mode 100644 index 0000000000..bc010a3dd2 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs @@ -0,0 +1 @@ +// Nothing here diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs index 19be7dc964..3f5897901a 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs @@ -1,7 +1,5 @@ // edition:2018 -#![feature(uniform_paths)] - mod my { pub mod sub { pub fn bar() {} diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr index 0088296b1a..4a01ba5088 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr @@ -1,16 +1,16 @@ error[E0659]: `sub` is ambiguous (name vs any other name during import resolution) - --> $DIR/block-scoped-shadow-nested.rs:18:13 + --> $DIR/block-scoped-shadow-nested.rs:16:13 | LL | use sub::bar; //~ ERROR `sub` is ambiguous | ^^^ ambiguous name | note: `sub` could refer to the module imported here - --> $DIR/block-scoped-shadow-nested.rs:16:9 + --> $DIR/block-scoped-shadow-nested.rs:14:9 | LL | use my::sub; | ^^^^^^^ note: `sub` could also refer to the module defined here - --> $DIR/block-scoped-shadow-nested.rs:11:1 + --> $DIR/block-scoped-shadow-nested.rs:9:1 | LL | / mod sub { LL | | pub fn bar() {} diff --git a/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs b/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs index a7bc625bbf..0c2da1884b 100644 --- a/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs +++ b/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs @@ -1,8 +1,6 @@ // compile-pass // edition:2018 -#![feature(uniform_paths)] - fn main() { enum E { A, B, C } diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54390.rs b/src/test/ui/rust-2018/uniform-paths/issue-54390.rs deleted file mode 100644 index 536cc25e35..0000000000 --- a/src/test/ui/rust-2018/uniform-paths/issue-54390.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2018 - -#![deny(unused)] - -use std::fmt; - -// No "unresolved import" + "unused import" combination here. -use fmt::Write; //~ ERROR imports can only refer to extern crate names - //~| ERROR unused import: `fmt::Write` - -fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54390.stderr b/src/test/ui/rust-2018/uniform-paths/issue-54390.stderr deleted file mode 100644 index 8f86698c9c..0000000000 --- a/src/test/ui/rust-2018/uniform-paths/issue-54390.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/issue-54390.rs:8:5 - | -LL | use std::fmt; - | -------- not an extern crate passed with `--extern` -... -LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names - | ^^^ - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the module imported here - --> $DIR/issue-54390.rs:5:5 - | -LL | use std::fmt; - | ^^^^^^^^ - -error: unused import: `fmt::Write` - --> $DIR/issue-54390.rs:8:5 - | -LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names - | ^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/issue-54390.rs:3:9 - | -LL | #![deny(unused)] - | ^^^^^^ - = note: #[deny(unused_imports)] implied by #[deny(unused)] - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596-2.rs b/src/test/ui/rust-2018/uniform-paths/issue-56596-2.rs new file mode 100644 index 0000000000..9ec3a64113 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596-2.rs @@ -0,0 +1,11 @@ +// compile-pass +// edition:2018 +// compile-flags: --extern issue_56596_2 +// aux-build:issue-56596-2.rs + +mod m { + use core::any; + pub use issue_56596_2::*; +} + +fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596.rs b/src/test/ui/rust-2018/uniform-paths/issue-56596.rs new file mode 100644 index 0000000000..ec5bb656ad --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596.rs @@ -0,0 +1,12 @@ +// edition:2018 +// compile-flags: --extern issue_56596 +// aux-build:issue-56596.rs + +mod m { + pub mod issue_56596 {} +} + +use m::*; +use issue_56596; //~ ERROR `issue_56596` is ambiguous + +fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr new file mode 100644 index 0000000000..01bbe139c7 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr @@ -0,0 +1,18 @@ +error[E0659]: `issue_56596` is ambiguous (name vs any other name during import resolution) + --> $DIR/issue-56596.rs:10:5 + | +LL | use issue_56596; //~ ERROR `issue_56596` is ambiguous + | ^^^^^^^^^^^ ambiguous name + | + = note: `issue_56596` could refer to an extern crate passed with `--extern` + = help: use `::issue_56596` to refer to this extern crate unambiguously +note: `issue_56596` could also refer to the module imported here + --> $DIR/issue-56596.rs:9:5 + | +LL | use m::*; + | ^^^^ + = help: use `crate::issue_56596` to refer to this module unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/rust-2018/uniform-paths/macro-rules.rs b/src/test/ui/rust-2018/uniform-paths/macro-rules.rs index e8098a4679..dcf1f2b4b7 100644 --- a/src/test/ui/rust-2018/uniform-paths/macro-rules.rs +++ b/src/test/ui/rust-2018/uniform-paths/macro-rules.rs @@ -1,22 +1,23 @@ // edition:2018 -// For the time being `macro_rules` items are treated as *very* private... - -#![feature(underscore_imports, decl_macro, uniform_paths)] +#![feature(underscore_imports, decl_macro)] mod m1 { + // Non-exported legacy macros are treated as `pub(crate)`. macro_rules! legacy_macro { () => () } - // ... so they can't be imported by themselves, ... - use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported + use legacy_macro as _; // OK + pub(crate) use legacy_macro as _; // OK + pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported } mod m2 { macro_rules! legacy_macro { () => () } + #[allow(non_camel_case_types)] type legacy_macro = u8; - // ... but don't prevent names from other namespaces from being imported, ... + // Legacy macro imports don't prevent names from other namespaces from being imported. use legacy_macro as _; // OK } @@ -26,19 +27,17 @@ mod m3 { fn f() { macro_rules! legacy_macro { () => () } - // ... but still create ambiguities with other names in the same namespace. + // Legacy macro imports create ambiguities with other names in the same namespace. use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous - //~| ERROR `legacy_macro` is private, and cannot be re-exported } } mod exported { - // Exported macros are treated as private as well, - // some better rules need to be figured out later. + // Exported legacy macros are treated as `pub`. #[macro_export] macro_rules! legacy_macro { () => () } - use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported + pub use legacy_macro as _; // OK } fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr index d7bb233dfe..684f5fceac 100644 --- a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr +++ b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -1,58 +1,34 @@ error[E0364]: `legacy_macro` is private, and cannot be re-exported - --> $DIR/macro-rules.rs:11:9 + --> $DIR/macro-rules.rs:11:13 | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - | -note: consider marking `legacy_macro` as `pub` in the imported module - --> $DIR/macro-rules.rs:11:9 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - -error[E0364]: `legacy_macro` is private, and cannot be re-exported - --> $DIR/macro-rules.rs:30:13 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous +LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported | ^^^^^^^^^^^^^^^^^ | note: consider marking `legacy_macro` as `pub` in the imported module - --> $DIR/macro-rules.rs:30:13 + --> $DIR/macro-rules.rs:11:13 | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous +LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported | ^^^^^^^^^^^^^^^^^ -error[E0364]: `legacy_macro` is private, and cannot be re-exported - --> $DIR/macro-rules.rs:41:9 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - | -note: consider marking `legacy_macro` as `pub` in the imported module - --> $DIR/macro-rules.rs:41:9 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - error[E0659]: `legacy_macro` is ambiguous (name vs any other name during import resolution) - --> $DIR/macro-rules.rs:30:13 + --> $DIR/macro-rules.rs:31:13 | LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous | ^^^^^^^^^^^^ ambiguous name | note: `legacy_macro` could refer to the macro defined here - --> $DIR/macro-rules.rs:27:9 + --> $DIR/macro-rules.rs:28:9 | LL | macro_rules! legacy_macro { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `legacy_macro` could also refer to the macro defined here - --> $DIR/macro-rules.rs:24:5 + --> $DIR/macro-rules.rs:25:5 | LL | macro legacy_macro() {} | ^^^^^^^^^^^^^^^^^^^^^^^ = help: use `self::legacy_macro` to refer to this macro unambiguously -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors Some errors occurred: E0364, E0659. For more information about an error, try `rustc --explain E0364`. diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs new file mode 100644 index 0000000000..541fc1be4e --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs @@ -0,0 +1,19 @@ +// edition:2018 + +// Built-in attribute +use inline as imported_inline; +mod builtin { + pub use inline as imported_inline; +} + +// Tool module +use rustfmt as imported_rustfmt; +mod tool_mod { + pub use rustfmt as imported_rustfmt; +} + +#[imported_inline] //~ ERROR cannot use a built-in attribute through an import +#[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import +#[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +#[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr new file mode 100644 index 0000000000..40b8fcf715 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr @@ -0,0 +1,44 @@ +error: cannot use a built-in attribute through an import + --> $DIR/prelude-fail-2.rs:15:3 + | +LL | #[imported_inline] //~ ERROR cannot use a built-in attribute through an import + | ^^^^^^^^^^^^^^^ + | +note: the built-in attribute imported here + --> $DIR/prelude-fail-2.rs:4:5 + | +LL | use inline as imported_inline; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a built-in attribute through an import + --> $DIR/prelude-fail-2.rs:16:3 + | +LL | #[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:17:3 + | +LL | #[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:10:5 + | +LL | use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:18:13 + | +LL | #[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:12:13 + | +LL | pub use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs b/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs index c5bd50f2f5..d717884c90 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs @@ -1,7 +1,5 @@ // edition:2018 -#![feature(uniform_paths)] - // Built-in macro use env as env_imported; //~ ERROR cannot import a built-in macro diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr index 794d986b82..fdfea416b1 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr @@ -1,11 +1,11 @@ error: cannot import a built-in macro - --> $DIR/prelude-fail.rs:6:5 + --> $DIR/prelude-fail.rs:4:5 | LL | use env as env_imported; //~ ERROR cannot import a built-in macro | ^^^^^^^^^^^^^^^^^^^ error[E0432]: unresolved import `rustfmt` - --> $DIR/prelude-fail.rs:9:5 + --> $DIR/prelude-fail.rs:7:5 | LL | use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt` | ^^^^^^^ not a module `rustfmt` diff --git a/src/test/ui/rust-2018/uniform-paths/prelude.rs b/src/test/ui/rust-2018/uniform-paths/prelude.rs index 5aab5fc3a4..9a326b4c72 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude.rs +++ b/src/test/ui/rust-2018/uniform-paths/prelude.rs @@ -1,17 +1,9 @@ // compile-pass // edition:2018 -#![feature(uniform_paths)] - // Macro imported with `#[macro_use] extern crate` use vec as imported_vec; -// Built-in attribute -use inline as imported_inline; - -// Tool module -use rustfmt as imported_rustfmt; - // Standard library prelude use Vec as ImportedVec; @@ -20,8 +12,6 @@ use u8 as imported_u8; type A = imported_u8; -#[imported_inline] -#[imported_rustfmt::skip] fn main() { imported_vec![0]; ImportedVec::::new(); diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.rs b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.rs new file mode 100644 index 0000000000..766bd14743 --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.rs @@ -0,0 +1,50 @@ +// Regression test for #56288. Checks that if a supertrait defines an associated type +// projection that references `Self`, then that associated type must still be explicitly +// specified in the `dyn Trait` variant, since we don't know what `Self` is anymore. + +trait Base { + type Output; +} + +trait Helper: Base::Target> { + type Target; +} + +impl Base for u32 +{ + type Output = i32; +} + +impl Helper for u32 +{ + type Target = i32; +} + +trait ConstI32 { + type Out; +} + +impl ConstI32 for T { + type Out = i32; +} + +// Test that you still need to manually give a projection type if the Output type +// is normalizable. +trait NormalizableHelper: + Base::Out> +{ + type Target; +} + +impl NormalizableHelper for u32 +{ + type Target = i32; +} + +fn main() { + let _x: Box> = Box::new(2u32); + //~^ ERROR the value of the associated type `Output` (from the trait `Base`) must be specified + + let _y: Box> = Box::new(2u32); + //~^ ERROR the value of the associated type `Output` (from the trait `Base`) must be specified +} diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.stderr b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.stderr new file mode 100644 index 0000000000..350f8ea850 --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.stderr @@ -0,0 +1,21 @@ +error[E0191]: the value of the associated type `Output` (from the trait `Base`) must be specified + --> $DIR/trait-object-with-self-in-projection-output-bad.rs:45:17 + | +LL | type Output; + | ------------ `Output` defined here +... +LL | let _x: Box> = Box::new(2u32); + | ^^^^^^^^^^^^^^^^^^^^^^ associated type `Output` must be specified + +error[E0191]: the value of the associated type `Output` (from the trait `Base`) must be specified + --> $DIR/trait-object-with-self-in-projection-output-bad.rs:48:17 + | +LL | type Output; + | ------------ `Output` defined here +... +LL | let _y: Box> = Box::new(2u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `Output` must be specified + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0191`. diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs b/src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs new file mode 100644 index 0000000000..793d556d08 --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs @@ -0,0 +1,28 @@ +// compile-pass + +// Regression test related to #56288. Check that a supertrait projection (of +// `Output`) that references `Self` can be ok if it is referencing a projection (of +// `Self::Target`, in this case). Note that we still require the user to manually +// specify both `Target` and `Output` for now. + +trait Base { + type Output; +} + +trait Helper: Base::Target> { + type Target; +} + +impl Base for u32 +{ + type Output = i32; +} + +impl Helper for u32 +{ + type Target = i32; +} + +fn main() { + let _x: Box> = Box::new(2u32); +} diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs b/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs new file mode 100644 index 0000000000..46c083f930 --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs @@ -0,0 +1,48 @@ +// compile-pass + +// Regression test related to #56288. Check that a supertrait projection (of +// `Output`) that references `Self` is ok if there is another occurence of +// the same supertrait that specifies the projection explicitly, even if +// the projection's associated type is not explicitly specified in the object type. +// +// Note that in order for this to compile, we need the `Self`-referencing projection +// to normalize fairly directly to a concrete type, otherwise the trait resolver +// will hate us. +// +// There is a test in `trait-object-with-self-in-projection-output-bad.rs` that +// having a normalizing, but `Self`-containing projection does not *by itself* +// allow you to avoid writing the projected type (`Output`, in this example) +// explicitly. + +trait ConstI32 { + type Out; +} + +impl ConstI32 for T { + type Out = i32; +} + +trait Base { + type Output; +} + +trait NormalizingHelper: Base::Out> + Base { + type Target; +} + +impl Base for u32 +{ + type Output = i32; +} + +impl NormalizingHelper for u32 +{ + type Target = i32; +} + +fn main() { + // Make sure this works both with and without the associated type + // being specified. + let _x: Box> = Box::new(2u32); + let _y: Box> = Box::new(2u32); +} diff --git a/src/test/ui/write-to-static-mut-in-static.rs b/src/test/ui/write-to-static-mut-in-static.rs index 191f09b54e..983b5d48e6 100644 --- a/src/test/ui/write-to-static-mut-in-static.rs +++ b/src/test/ui/write-to-static-mut-in-static.rs @@ -12,10 +12,10 @@ pub static mut A: u32 = 0; pub static mut B: () = unsafe { A = 1; }; -//~^ ERROR cannot mutate statics in the initializer of another static +//~^ ERROR could not evaluate static initializer pub static mut C: u32 = unsafe { C = 1; 0 }; -//~^ ERROR cannot mutate statics in the initializer of another static +//~^ ERROR cycle detected pub static D: u32 = D; diff --git a/src/test/ui/write-to-static-mut-in-static.stderr b/src/test/ui/write-to-static-mut-in-static.stderr index 673a71b464..335f849fb2 100644 --- a/src/test/ui/write-to-static-mut-in-static.stderr +++ b/src/test/ui/write-to-static-mut-in-static.stderr @@ -1,14 +1,28 @@ -error: cannot mutate statics in the initializer of another static +error[E0080]: could not evaluate static initializer --> $DIR/write-to-static-mut-in-static.rs:14:33 | LL | pub static mut B: () = unsafe { A = 1; }; - | ^^^^^ + | ^^^^^ tried to modify a static's initial value from another static's initializer -error: cannot mutate statics in the initializer of another static +error[E0391]: cycle detected when const-evaluating `C` --> $DIR/write-to-static-mut-in-static.rs:17:34 | LL | pub static mut C: u32 = unsafe { C = 1; 0 }; | ^^^^^ + | +note: ...which requires const-evaluating `C`... + --> $DIR/write-to-static-mut-in-static.rs:17:1 + | +LL | pub static mut C: u32 = unsafe { C = 1; 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires const-evaluating `C`, completing the cycle +note: cycle used when const-evaluating + checking `C` + --> $DIR/write-to-static-mut-in-static.rs:17:1 + | +LL | pub static mut C: u32 = unsafe { C = 1; 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors +Some errors occurred: E0080, E0391. +For more information about an error, try `rustc --explain E0080`. diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index bf95b31ae3..20daa5d2ab 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -621,8 +621,10 @@ impl Builder { let asc = self.output.join(format!("{}.asc", filename)); println!("signing: {:?}", path); let mut cmd = Command::new("gpg"); - cmd.arg("--no-tty") + cmd.arg("--pinentry-mode=loopback") + .arg("--no-tty") .arg("--yes") + .arg("--batch") .arg("--passphrase-fd").arg("0") .arg("--personal-digest-preferences").arg("SHA512") .arg("--armor") diff --git a/vendor/libc/.cargo-checksum.json b/vendor/libc/.cargo-checksum.json index fbebcfd356..37b8ad9af1 100644 --- a/vendor/libc/.cargo-checksum.json +++ b/vendor/libc/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".travis.yml":"8088167016d06169f8b1eb86ba5f413cdfcb776bd95af46f968d146665ff5afe","Cargo.toml":"74e837a30336b387d94fc92db3d1ece407b47318ca1362a2b8f37dfb28064e54","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"a550fd6c92b62c70925cc6a75dd1d40ae93f9a77e3c4e9baacdf014fa0cae550","appveyor.yml":"216f7ac4561aa5810dc84ce5a9950897a8c0496e0615d0211d62348b1c8dc720","ci/README.md":"2e3d7ad13f8c3202e57d2af73aeeebde306221dce7c0907e462e25767a692d6b","ci/android-install-ndk.sh":"725db9025c5905849916bf7c910f98ff0e753484397c2a1f836d48a576d10890","ci/android-install-sdk.sh":"5c3fbe402ac611239ac7715a61f247d1c55fa012f33a5be0b0127dfc196965cf","ci/android-sysimage.sh":"901415631752827454c827e8c51906ba4260612e4021eda98eb7fff771c7d0e8","ci/docker/aarch64-linux-android/Dockerfile":"e17945fba1786dfe766006f50e79baf3f4151ca0c0c14ae96f91483bf345afd7","ci/docker/aarch64-unknown-linux-gnu/Dockerfile":"5f430271941e1eecdf9d1a5fb701dd5622e2c4b9da03140fd829bf216e55529d","ci/docker/aarch64-unknown-linux-musl/Dockerfile":"1e8c66067bcbd718119db5eb6e69390c4f0ea72c1543e09b6846a36ef66cd21b","ci/docker/arm-linux-androideabi/Dockerfile":"4e0bdc13254f99bd0db195f91331c634050426e3e4a0fcc63ef25ab795fe2d46","ci/docker/arm-unknown-linux-gnueabihf/Dockerfile":"dbb025b53b27e406893184290836a50133ecae8295711d5e05b4e41fac9bd262","ci/docker/arm-unknown-linux-musleabihf/Dockerfile":"12b50abdc5605e3a39eff6bb0d0fccb0885896933c5bfbb3d0cbde9068492a0f","ci/docker/asmjs-unknown-emscripten/Dockerfile":"0d9aea5119c2cd136cc2c0a578105d91210e45901ac49b17c5e45f458b1c7551","ci/docker/i686-linux-android/Dockerfile":"4e8377ec0bd9ad2df23bf2c5373200a12750dc9f28c4f10bc83a0150fe1623ee","ci/docker/i686-unknown-linux-gnu/Dockerfile":"f22ac412525ef15b33ab8ccd8193d97346faf421c17f6ddeffc25b651aba83b7","ci/docker/i686-unknown-linux-musl/Dockerfile":"f95cd8b514f48686d774b85e4dffccce1a5acd68749d8ff59b204419d448d575","ci/docker/mips-unknown-linux-gnu/Dockerfile":"6d2a9daa299003497c1d441d07b69f730ad75ee49f34520f959b5158e60072e0","ci/docker/mips-unknown-linux-musl/Dockerfile":"4773b2656a7dd6a3b106fcb737428436652edf3d1f48181de3f62c16bf5bd49d","ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile":"7c4d26232f1c1553a6612d9b0b3faac9887e139eaffa025f70d34113dcee812f","ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile":"edb4144c07ade1a8bd65272ec1d3672ad794e9e6b7d01197896e159a70175b58","ci/docker/mipsel-unknown-linux-musl/Dockerfile":"0ca9c12b5618c6d2df04ff820d56fb28e05b43e45eaa506480126b03c5072d48","ci/docker/powerpc-unknown-linux-gnu/Dockerfile":"4b247dcc399395815ec9153c1247cc03d764896c484eddcb196d0bf8650d6311","ci/docker/powerpc64-unknown-linux-gnu/Dockerfile":"e949717a8ba5e123940729ff47ce1c45989c8b8247c576f1488f698b534e0283","ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile":"018591017f499414a9f79477e1c39baa6a47f71fce6812fb1868fb0fcdfb8cea","ci/docker/s390x-unknown-linux-gnu/Dockerfile":"9860f478c5b2dc3bcf76d2cda7f71922a2a2ef54898cc2ed6ea9b9eff094a5c0","ci/docker/sparc64-unknown-linux-gnu/Dockerfile":"1471a694817758331ecdbb23857537563ad7ae56aa3a88e49bf9cd421addcafe","ci/docker/wasm32-unknown-emscripten/Dockerfile":"bd072d6ae91a9160693e402dd77462d3c9dd0716711e719a62af330ae479eb4e","ci/docker/wasm32-unknown-emscripten/node-wrapper.sh":"0eef37c3c4fb16dbc083148b7e7af45f2ae60bd9a1b3a77e1d43da79efbd30c6","ci/docker/x86_64-linux-android/Dockerfile":"aeeaa540189ca712369c564c9a14cbace63217dadcfaf879a2cb40fbdeb08199","ci/docker/x86_64-rumprun-netbsd/Dockerfile":"e8f9287b267c6058eec42d1bca0007cb9a78a1d244dd8e11088368cb61fb17d6","ci/docker/x86_64-rumprun-netbsd/runtest.rs":"53302e9ed39293c1ec68ab56287593907d4aaf5bac9c1c2857b29f754a71d62b","ci/docker/x86_64-unknown-freebsd/Dockerfile":"ab1f14c65c29f3721c7c091bdec2e865fb1abf45fdcdc867201d087966e396c4","ci/docker/x86_64-unknown-linux-gnu/Dockerfile":"ab3fa45765802b8155996796fcad9fb82096360ac587e38e6faa3ec345268796","ci/docker/x86_64-unknown-linux-gnux32/Dockerfile":"f22ac412525ef15b33ab8ccd8193d97346faf421c17f6ddeffc25b651aba83b7","ci/docker/x86_64-unknown-linux-musl/Dockerfile":"0c31058e39d9f25c6f4f9b7fe78c7c8d135f32bfe52199e9b2e7fa10d5dc3940","ci/dox.sh":"d77171a9da467bb01fc702a28fc3b5099f82a485a627f3d5593a9830c3e1a77c","ci/emscripten-entry.sh":"c97bbec520b57af9b1ae264ca991560e99c3852c99b00a2f673c614d1ba17498","ci/emscripten.sh":"6f66c7b5c3d34a41afc59ceb0a8c3b0880cd6fd9a6344b874ae80bac0639ccb2","ci/ios/deploy_and_run_on_ios_simulator.rs":"be6d2ccfe78df5d77a2c4ee40ffbd22b1bb2ac0a0cf6b2a108f21406f22ce1a8","ci/landing-page-footer.html":"b70b3112c2147f5c967e7481061ef38bc2d79a28dd55a16fb916d9c9426da2c4","ci/landing-page-head.html":"ad69663fac7924f27d0209bc519d55838e86edfc4133713a6fd08caadac1b142","ci/linux-s390x.sh":"d6b732d7795b4ba131326aff893bca6228a7d2eb0e9402f135705413dbbe0dce","ci/linux-sparc64.sh":"c92966838b1ab7ad3b7a344833ee726aba6b647cf5952e56f0ad1ba420b13325","ci/run-docker.sh":"be83bc5a8b5ef913a7c9941ffca24734716028650c9a876123c4c160672c18de","ci/run-qemu.sh":"bb859421170871ef23a8940c5e150efec0c01b95e32d2ce2d37b79a45d9d346c","ci/run.sh":"86b7d1ce555ed5eeeac6b44fd0e9563166ff38ba38e56a82d70800ace3b65946","ci/runtest-android.rs":"a07ddbdd276aedda7876c7e676774178a60d9aeab95df01275a4ee95f59e3044","ci/style.rs":"940c06a676cff1dfc1555b887e46867c6aacc473956cd6aaafaed71824facdb2","ci/test-runner-linux":"cb3713d9e4fa1d9a7c039dfd077af0939921c1f2bf969c9e680ee66e87dc30a4","src/cloudabi/aarch64.rs":"b8550bf1fd7344972aa4db29441486f39f31482d0327534981dbb75959c29114","src/cloudabi/arm.rs":"c197e2781c2839808bd6fcef219a29705b27b992d3ef920e9cf6ac96e2022bbf","src/cloudabi/mod.rs":"1c2dc787a1b3438970ccd04153c93538719b1a27445707913b90b6f0cdcdde77","src/cloudabi/x86.rs":"33eb97f272d2201f3838ae74d444583c7de8f67856852ca375293b20bbd05636","src/cloudabi/x86_64.rs":"400d85d4fe39e26cf2e6ece9ee31c75fe9e88c4bcf4d836ca9f765c05c9c5be3","src/dox.rs":"8f6037887281b828d8541ce8a549dacaed5d29c05fd9cf78b169838476b82741","src/fuchsia/aarch64.rs":"8366ac6f51e494aad9266ccab2b3a95c5ed7aa3a9f77ea672413283440919743","src/fuchsia/mod.rs":"e5b7e6ff40e670200c52919b53474627931b4def18d452323999de201953cf21","src/fuchsia/powerpc64.rs":"390e8db54271a1d5f512d54a21b328091a792378bf9b42b49b6c1a72388da4ec","src/fuchsia/x86_64.rs":"b4a3eff94dcf1ffe41e6500468ca2cff0e97ddbcc75fe079b6ac7adb1e493f56","src/lib.rs":"bbad6abf79078649e76c2379c3c3fcbc4198430736e726a01d96a8f1439e8cb1","src/macros.rs":"8ad55edea39fad158e80c5df0d7b520b6863f5088db4db286ba31c12cbc4d67d","src/redox/mod.rs":"685d4d39911e855bf0fd7879b9a02bc15cefebfb0f520382c1a1353364f0d523","src/redox/net.rs":"f2e1922883f208cb46c00744da4a68feccfbec576c6981978ad404e46f818c8b","src/unix/bsd/apple/b32.rs":"41699d2802327b0a4d4aa50cd20b1e366b442176cbedab27ca888ac0446c9156","src/unix/bsd/apple/b64.rs":"0cda592881a1db30f2d96ff0f67cf4214aa99881dfe4f2fb474ef7ec78bd204a","src/unix/bsd/apple/mod.rs":"ac02092ad74cb81fa789e89d541d79525d2298ac77842847b48e5fd1a83fff0d","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"7a8df4e8079ed60ad4ac35362901eb2fea4d53384709e4ac45930899b84f8eaf","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/freebsd/mod.rs":"1b158199be42b37708f10d0e73164cf0b63a2b5ae0e6fcc1feab5944f5377f24","src/unix/bsd/freebsdlike/freebsd/x86.rs":"54311d3ebf2bb091ab22361e377e6ef9224aec2ecfe459fbfcedde4932db9c58","src/unix/bsd/freebsdlike/freebsd/x86_64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/mod.rs":"9ddcc86d3bb76f426e26c4df8d853b3715a7d6d9006acaa4fa26b2b0f5bb3314","src/unix/bsd/mod.rs":"a1030452eed4ec52a39e9f39040e8fae4309143c7af145efadd9b425caa39672","src/unix/bsd/netbsdlike/mod.rs":"6fb522d55eced39ef1bc28873f9ae8d5ab141acde09c5cb6a22aeca577d916ad","src/unix/bsd/netbsdlike/netbsd/mod.rs":"1cd66ed5967c788562d4ad626cfbeb1544f4b9267111de5f6790379b8327f28e","src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/netbsd/other/mod.rs":"4d9f7091af8e166943ac6f42ce85558909e5b6e61325039bff7adfbcf4b90212","src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs":"92459d80b8e5b570c0efe35a1d244d38f23072cd28b6581dfcb313dc9bfc3d51","src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs":"927eeccaf3269d299db4c2a55f8010807bf43dfa894aea6a783215f5d3560baa","src/unix/bsd/netbsdlike/openbsdlike/mod.rs":"37fea61239bd53cd951fd7bc800229f663be2e9ad2e1539ebdf73767ca28b469","src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs":"820092e397c7ec259cd2de8f2444083a8e57071c02d73d678701dfa7807726e9","src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs":"973331fd80876db55467913556d81f45ea1ede03322fef9c5d552aba833d2207","src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs":"44b7ea81cf363777b29935da175e702cbf45ed78f7498ae57faf44aa32335085","src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs":"7c959cdb3415f68a0f948117b9aa87a17463e57ab97cc3235f2567454b706653","src/unix/haiku/b32.rs":"69ae47fc52c6880e85416b4744500d5655c9ec6131cb737f3b649fceaadce15a","src/unix/haiku/b64.rs":"73e64db09275a8da8d50a13cce2cfa2b136036ddf3a930d2939f337fc995900b","src/unix/haiku/mod.rs":"8b8a7a51e1bc20407e42b0ab6c1a0cd1c8fc4f3ef61a04ccb7c8e312495ce30b","src/unix/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/unix/hermit/mod.rs":"a8bb096695eea74fb1c5c6766c1e680d28378c452dbc622fa5f91c6ce204306f","src/unix/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/unix/mod.rs":"af909129f76f9bbe571dee2e78f43afd63ff6e46c27a429da43c239537330283","src/unix/newlib/aarch64/mod.rs":"c408a990f22fb4292a824f38367e9b517e6e6f8623328397ee631cc88b3d1f7d","src/unix/newlib/arm/mod.rs":"2b6dba2e697ab9b4f4bc4dd5f28057249e9b596d1cb395a9322ec87605c4a5c4","src/unix/newlib/mod.rs":"d9f59ee9a994490122986b7ae5e3064bf9ce0b888349a388a50341a4c7069842","src/unix/notbsd/android/b32/arm.rs":"3625a32c7e58cfe683a53486fbe3d42d4e28f00bea31e19cb46ed2bb0b6a140b","src/unix/notbsd/android/b32/mod.rs":"2fbe398c1fb5251dda6213741a193e50aae4622807cb255d1dd2e82b536f0c65","src/unix/notbsd/android/b32/x86.rs":"ae2b7f1d6278caddc007749bb1d09ca33f7593478a0fd7fe98b457dae86c7814","src/unix/notbsd/android/b64/aarch64.rs":"63d65629d79371814910f691672ef593d20244ee09be26f1ebe07ee6212d0163","src/unix/notbsd/android/b64/mod.rs":"90d4f6b063fd4de42fd302cbc9d9902fd99ac1d71dc48cb8bc6ad7b4c902e481","src/unix/notbsd/android/b64/x86_64.rs":"5547aef8dcbaa5a932559f34606fd8d89f6c9c15173d2b1412c12d39b3c1045f","src/unix/notbsd/android/mod.rs":"eadc87bfea5f5e8ea50a3776b526cea2b0bfaf6d55240ba88134e19670f8a3a6","src/unix/notbsd/emscripten.rs":"d2d817af2b1496c1ee173f216c478a3a1c26223ef938797103bc50a265284662","src/unix/notbsd/linux/mips/mips32.rs":"a483ddfd10765b7d5090dc21686eee8842649cd21236828a42d634114885f5f9","src/unix/notbsd/linux/mips/mips64.rs":"9fff696e3943cf206b549d1ae13fa361828e9a8454e2d5730eeaa1c172ff370d","src/unix/notbsd/linux/mips/mod.rs":"af1b7bffff09aa5d8662e6452f72bc1e55b6639899b8c2a4be9cd1cfb245de01","src/unix/notbsd/linux/mod.rs":"081cb74be8b465c9cf86289f675cb7c6f7d7eee39713a6764e1871eabcbaee44","src/unix/notbsd/linux/musl/b32/arm.rs":"9d9bff31ab0925a1f62a20945d36a83b94ce3ab78dd202cd468bb31556b21725","src/unix/notbsd/linux/musl/b32/mips.rs":"cb38c463aebfc235f31880db158dd47c6e21f182a092d3f3087d92994b7711da","src/unix/notbsd/linux/musl/b32/mod.rs":"540928f168f145c136f9dd729ffa12b9d1838d9fe664fc642365d17d7fae648f","src/unix/notbsd/linux/musl/b32/powerpc.rs":"3930a2825657ac9208935341e29cfa62f6e37fc5c6b2c0d0dc9ac8c3b5569d59","src/unix/notbsd/linux/musl/b32/x86.rs":"c02dd333012cf65cb8873fa211eff5e63d466be55451a347510e3d4f50ed515e","src/unix/notbsd/linux/musl/b64/aarch64.rs":"4d79d86d11fbb8cb7a74084e410a1140e3c89dfc1842cdfb213f3a0ca93046df","src/unix/notbsd/linux/musl/b64/mod.rs":"caac00326693b372d6805e4dda239475e7fef36368881f372c006264844fda0d","src/unix/notbsd/linux/musl/b64/powerpc64.rs":"24514e41be4b5f5e0ffbe8a25a99dae8989489b607db59e8bfa345f8e65c9963","src/unix/notbsd/linux/musl/b64/x86_64.rs":"25340999290a63d564ec149532c905f59c312ec369f8806d6b15df66fa1b8857","src/unix/notbsd/linux/musl/mod.rs":"17c70acf9c6eabeb73916c2abb7d7e8b0310214090faae4a8dc2fd183a9b45ba","src/unix/notbsd/linux/other/b32/arm.rs":"d9892f7350b2978335f734f1cd2d7fed60f0f2e66aa05bee3f69549c031f8b14","src/unix/notbsd/linux/other/b32/mod.rs":"dac0fd1054a0fa163bce85df58c4ad4d222d8b7353bdb4364482b46c19991d03","src/unix/notbsd/linux/other/b32/powerpc.rs":"253fcd2f9978525285be1903cc08f3fec2dc3b12d1660a33e2995b4f6b810d1c","src/unix/notbsd/linux/other/b32/x86.rs":"49376e3ed0f3ff95c230ac20751911fe3c608dfe15c7c118b069fd7a954d8db9","src/unix/notbsd/linux/other/b64/aarch64.rs":"d57f3e06a0ac8affc5bf9d17e1f217ef1d1d714c947f47e647e0e038deaf48b2","src/unix/notbsd/linux/other/b64/mod.rs":"63e1a3fdf5f4d1b9820934ab344c91aed5e458e7e05908535d2e942d51a08bf8","src/unix/notbsd/linux/other/b64/not_x32.rs":"fa8636fb93eab230ed53bdec0a06f5b81d6d982cc0800103563c8c1eefcdb2d9","src/unix/notbsd/linux/other/b64/powerpc64.rs":"024057a910d0b885c63443165d34ce33f972973a9a8f5979906198180b19ad8b","src/unix/notbsd/linux/other/b64/sparc64.rs":"bb28f201e29c7f490a42dd2673eb8180fd82c1824a5d21aeb5aed674ffcc6e07","src/unix/notbsd/linux/other/b64/x32.rs":"06a26c5120ced30fc015c220799b67c4401be2f13fc6c7361bebd3d37ff4982d","src/unix/notbsd/linux/other/b64/x86_64.rs":"afba464e903d350325a1ca3d9d5af1659efc0ede83a43dbac4dbd60c522e2ad1","src/unix/notbsd/linux/other/mod.rs":"add154a8cfe9392d5a73b6055eb1419902e2b8b5458c22586a6ef8f90f89501b","src/unix/notbsd/linux/s390x.rs":"033cb7c4ee00af352698615de0248a5c6c9bcff57ba671ee22d31b70ef86fb4a","src/unix/notbsd/mod.rs":"134502158bab09d5189249ef400c9ddf7fdf5d1a1bd3134484ca82b80a0833e7","src/unix/solaris/mod.rs":"9c52a7479b56d3bc1f2c9ba5bb44f71ab1470989a54d3d0d85571e19489e4b7e","src/unix/uclibc/mips/mips32.rs":"9739c5fb47f389a0394ef08ee30da97a3de0a1300020731a8cc0a033616011b2","src/unix/uclibc/mips/mips64.rs":"230583280bbc7b3c7fcdb61244f51fa1af5944ca127c7cf83c598fe2313713d0","src/unix/uclibc/mips/mod.rs":"3f86061d05a8da7d923310550b7d40c6223f0c907d77edc86b7a78da1d647f76","src/unix/uclibc/mod.rs":"8cf2db30468476b917a60fdffe475917302875a3a4150f29a042ebee182545d1","src/unix/uclibc/x86_64/l4re.rs":"68fd3a833fd1f7caf784a084224f384bdbdfb8b5a14ef94c4f5155409afb3439","src/unix/uclibc/x86_64/mod.rs":"419182836aedd426a5c9e6b8667058adf86ac8f43af73ce8d00c503f8ff8f414","src/unix/uclibc/x86_64/other.rs":"f03b47842896f2f3ae6f8ebdcbcf0276454f880349d9cf00e3d304f8136893c5","src/windows.rs":"e41357d610608bad81abf285306ad8b127b6f02d5132f63c4942861980b47d59"},"package":"76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"} \ No newline at end of file +{"files":{".cargo_vcs_info.json":"806578805c8c34007ab20f0408640735bffbfa7663702d841168eb2221065293",".cirrus.yml":"febfac265e379dfb7ae265517031cdb83464abf4c00ae7ce8183e628088f2e5d","Cargo.toml":"024525ac791835ac86622ba2165bee3fe25f10dac9ac9372497631afc64dcc00","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"4458032a60ca0d499a26706f0e6ba9437ea0e75b104899481bc9c5a8a2cbb13c","build.rs":"2d1cbe87e0478de12a15a230d7ef0997020ba845b5b7d221d74cd2ce3fe0e720","src/cloudabi/aarch64.rs":"b8550bf1fd7344972aa4db29441486f39f31482d0327534981dbb75959c29114","src/cloudabi/arm.rs":"c197e2781c2839808bd6fcef219a29705b27b992d3ef920e9cf6ac96e2022bbf","src/cloudabi/mod.rs":"640375751825b8d4adf4fb089a53c4d883f265f96b07daf06f2dcf3acf6639c9","src/cloudabi/x86.rs":"33eb97f272d2201f3838ae74d444583c7de8f67856852ca375293b20bbd05636","src/cloudabi/x86_64.rs":"400d85d4fe39e26cf2e6ece9ee31c75fe9e88c4bcf4d836ca9f765c05c9c5be3","src/dox.rs":"c0c483fbc3d5bcf51324956e4507eee0ddadf2e41fe21c6b249373ed5108df0c","src/fuchsia/aarch64.rs":"40dce617877e606e92353491e1913711b1ecfa510bb983156f4a8460f490419e","src/fuchsia/mod.rs":"784dee21605f00a41d7cae1fc3d782646a84515a687a4952700eae51cc3840f0","src/fuchsia/x86_64.rs":"b4a3eff94dcf1ffe41e6500468ca2cff0e97ddbcc75fe079b6ac7adb1e493f56","src/lib.rs":"d456d34fc58c8d194f8f24201b4021860f61c5f125904bb8dcc954d1f813f6b7","src/macros.rs":"29d61c13523328c4742a7290dbb7d718ce198740824592e029199e9df5429b20","src/redox/mod.rs":"87cb35a988be84d45e79206f7cb5d098e8e7c5a1825cfcd0bd663453dedc3103","src/redox/net.rs":"f2e1922883f208cb46c00744da4a68feccfbec576c6981978ad404e46f818c8b","src/sgx.rs":"18d33a470d06c15b00be5a3bf45b6e51da6104ae7437f50c0eccbd3b79994389","src/switch.rs":"00365ed196519b260fc99a32f02d60b3fb1aaf0484654b19fec8c25bc1687420","src/unix/bsd/apple/b32.rs":"da60c99ee3d773f9c0767b93ccf18b67ad67576e2c58e2e86d05b23c23fd989a","src/unix/bsd/apple/b64.rs":"0cc15406c3a91abde65b28c7783ccab7801474ecc51c78dbd1d7332d4b834390","src/unix/bsd/apple/mod.rs":"297b2c69a66141ec91ff8f15edb9efe0a96167be0066b50a2c677c2a64a9c140","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"6c69319675328d4d16939c9c2aba3fb8ca9381a8b390d18d766949307090304b","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/freebsd/mod.rs":"98c8e7d49485a317a64359ee356539da0c1e9506dbdb8f0b345d021769deb29f","src/unix/bsd/freebsdlike/freebsd/x86.rs":"54311d3ebf2bb091ab22361e377e6ef9224aec2ecfe459fbfcedde4932db9c58","src/unix/bsd/freebsdlike/freebsd/x86_64.rs":"97132e2097411034271b8c927ecc94a208a361564680972a6c82998bd30a9826","src/unix/bsd/freebsdlike/mod.rs":"2eee91709710dd44784536ea014d960c1231b4b0444fda831a5eca8e575aa28b","src/unix/bsd/mod.rs":"7188fd6d49e46995a267a5a0cf1745e06752fc99250a16252dac2ae3e7f33f28","src/unix/bsd/netbsdlike/mod.rs":"e3104ad6bb9a7ab3e334a7fff29a386999cd8f7537805fa56c6a4d727c8fc1de","src/unix/bsd/netbsdlike/netbsd/aarch64.rs":"f455848cd03cb80897776f2355dbd14bbb3aa88b1aa6aec22122ec47cdbd0f20","src/unix/bsd/netbsdlike/netbsd/arm.rs":"4c9eac982c385165f475ef3a80770fd634c6dde8fb400b3cb7e08c9bb7498af6","src/unix/bsd/netbsdlike/netbsd/mod.rs":"d818a3d4c5a83f584d4b4817b289f411885765e71de96c5de125728a6e332821","src/unix/bsd/netbsdlike/netbsd/powerpc.rs":"183818c62dff72db6ee1d329d90ad8727628775ed5cd823c8485c6769003c91e","src/unix/bsd/netbsdlike/netbsd/sparc64.rs":"4db043327fb2615af2fb0f999d162310bea2294e7d050806e19a46b083561f16","src/unix/bsd/netbsdlike/netbsd/x86.rs":"979c4cbacbde37b9053f2c9df4b8f87d37b255436ef4a383e1e5f40ee21180d6","src/unix/bsd/netbsdlike/netbsd/x86_64.rs":"741353a1c6451efb0c7c7c486fd2cb54e3d36fd1c3dd280f6432d8858b0a5356","src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs":"4d2ad2e885d83ad3134add61580f49a8e58cb03284ae328273a9e2e104a4d084","src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs":"bd251a102bed65d5cb3459275f6ec3310fe5803ff4c9651212115548f86256d0","src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs":"6e6f15e81597d85d83ca0eeb154e4f8b8e7f9cbb6a9cfa176601f78642ef94f9","src/unix/bsd/netbsdlike/openbsdlike/mod.rs":"0f163ecf987d663ef3f2fcc6d56c9df1b9179884bd54b4589a5d109b41781dd0","src/unix/bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs":"820092e397c7ec259cd2de8f2444083a8e57071c02d73d678701dfa7807726e9","src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs":"6adc0dcb1b358ef91bbeb5512e19ba6f40adc77b7d259cb11641a69426fc5ea2","src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs":"44b7ea81cf363777b29935da175e702cbf45ed78f7498ae57faf44aa32335085","src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs":"97956c3a53aa07a2edf8865252f980dade0d34e930adca0e870e7344d7e2b0bb","src/unix/haiku/b32.rs":"69ae47fc52c6880e85416b4744500d5655c9ec6131cb737f3b649fceaadce15a","src/unix/haiku/b64.rs":"73e64db09275a8da8d50a13cce2cfa2b136036ddf3a930d2939f337fc995900b","src/unix/haiku/mod.rs":"b00fa310b6d835cb613a02101c7b1a72c636faec316586587cb63aebdcb9de8f","src/unix/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/unix/hermit/mod.rs":"248c0b0abaa7d56a7dc3293e67a0ce70a4ef8c83638bda8aa222ad8bb0ef6801","src/unix/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/unix/mod.rs":"c5f3c6d74ac8e8ef83374b6115bab7c6e57297336a7635aa4c47462649b00dfb","src/unix/newlib/aarch64/mod.rs":"c408a990f22fb4292a824f38367e9b517e6e6f8623328397ee631cc88b3d1f7d","src/unix/newlib/arm/mod.rs":"2b6dba2e697ab9b4f4bc4dd5f28057249e9b596d1cb395a9322ec87605c4a5c4","src/unix/newlib/mod.rs":"eea5f1eb720184d9a00be966e4161fddb3733362fc349182e85b1599ba4e825f","src/unix/notbsd/android/b32/arm.rs":"3625a32c7e58cfe683a53486fbe3d42d4e28f00bea31e19cb46ed2bb0b6a140b","src/unix/notbsd/android/b32/mod.rs":"2fbe398c1fb5251dda6213741a193e50aae4622807cb255d1dd2e82b536f0c65","src/unix/notbsd/android/b32/x86.rs":"ae2b7f1d6278caddc007749bb1d09ca33f7593478a0fd7fe98b457dae86c7814","src/unix/notbsd/android/b64/aarch64.rs":"63d65629d79371814910f691672ef593d20244ee09be26f1ebe07ee6212d0163","src/unix/notbsd/android/b64/mod.rs":"90d4f6b063fd4de42fd302cbc9d9902fd99ac1d71dc48cb8bc6ad7b4c902e481","src/unix/notbsd/android/b64/x86_64.rs":"5547aef8dcbaa5a932559f34606fd8d89f6c9c15173d2b1412c12d39b3c1045f","src/unix/notbsd/android/mod.rs":"bb60b798e4e4d336fe38657fd378ea492a0f7ce647395ed50eaa0c82048ba896","src/unix/notbsd/emscripten.rs":"9ed47a0a5020c8f72d9496f87ef0da669c1ed2b85980013100c466f18cd8a4c5","src/unix/notbsd/linux/mips/mips32.rs":"a483ddfd10765b7d5090dc21686eee8842649cd21236828a42d634114885f5f9","src/unix/notbsd/linux/mips/mips64.rs":"9fff696e3943cf206b549d1ae13fa361828e9a8454e2d5730eeaa1c172ff370d","src/unix/notbsd/linux/mips/mod.rs":"712aa3bcfad17a97b4c1a7e75e9ff600c6d9f29eda86cf6c84c15f2d7a8ce880","src/unix/notbsd/linux/mod.rs":"e72ef2bae7777175b1b0516bdfa27f46021975bdb9f0cd812ebfdd0030fb81b6","src/unix/notbsd/linux/musl/b32/arm.rs":"fdf170e03812072785ec531f1ae810d0c4feb9b29d0c316681b9f7affe1262c0","src/unix/notbsd/linux/musl/b32/mips.rs":"afa4981d93f29b3fb0083a73ce1323f7dce1392f90d5cf1966b1fae10d510033","src/unix/notbsd/linux/musl/b32/mod.rs":"540928f168f145c136f9dd729ffa12b9d1838d9fe664fc642365d17d7fae648f","src/unix/notbsd/linux/musl/b32/powerpc.rs":"16c615770a96f155540511f58b5a8070c9c7a43e12bdfed83996690e7558bcb5","src/unix/notbsd/linux/musl/b32/x86.rs":"3abf1610c68c37f407cdd0f93563c3542c024219e0e8c9888266a6ee014e0c87","src/unix/notbsd/linux/musl/b64/aarch64.rs":"d98643408c2837387988f78adc95c90ad21196a6f8f879e3d33d7e8ccf612640","src/unix/notbsd/linux/musl/b64/mod.rs":"d9285cd705e2e92552a08c9aa69b810e7e1bd0e9da6edf069c678af285579661","src/unix/notbsd/linux/musl/b64/powerpc64.rs":"544d8a7f6d6d84143df8a4c3537c9a3a36bf3d338d7a1c15689b94492498d8d7","src/unix/notbsd/linux/musl/b64/x86_64.rs":"25340999290a63d564ec149532c905f59c312ec369f8806d6b15df66fa1b8857","src/unix/notbsd/linux/musl/mod.rs":"4e582af62a11e8a5235ccbeabe5b1003fc17705e606c1ed9b21b931a470681fc","src/unix/notbsd/linux/other/b32/arm.rs":"d9892f7350b2978335f734f1cd2d7fed60f0f2e66aa05bee3f69549c031f8b14","src/unix/notbsd/linux/other/b32/mod.rs":"26211878c6481861e11393625620edaa0700cac41f55f0118c0f0bd42c1b7520","src/unix/notbsd/linux/other/b32/powerpc.rs":"253fcd2f9978525285be1903cc08f3fec2dc3b12d1660a33e2995b4f6b810d1c","src/unix/notbsd/linux/other/b32/x86.rs":"49376e3ed0f3ff95c230ac20751911fe3c608dfe15c7c118b069fd7a954d8db9","src/unix/notbsd/linux/other/b64/aarch64.rs":"1124ab5e974718b94fa40ae0f1772fb1c537910ef3e018b7c6c94a38b83dd742","src/unix/notbsd/linux/other/b64/mod.rs":"63e1a3fdf5f4d1b9820934ab344c91aed5e458e7e05908535d2e942d51a08bf8","src/unix/notbsd/linux/other/b64/not_x32.rs":"fa8636fb93eab230ed53bdec0a06f5b81d6d982cc0800103563c8c1eefcdb2d9","src/unix/notbsd/linux/other/b64/powerpc64.rs":"a771d982ed8a9458e1f2f039f959b5075b22443159875ba5612eebba96661c24","src/unix/notbsd/linux/other/b64/sparc64.rs":"0caffe5924886f3aed187531dfe78189b3df40adb96782ec4b471647ff83e9b1","src/unix/notbsd/linux/other/b64/x32.rs":"06a26c5120ced30fc015c220799b67c4401be2f13fc6c7361bebd3d37ff4982d","src/unix/notbsd/linux/other/b64/x86_64.rs":"70d0cec088630502128c1c28ffef9dcc0fd9c0644f6a71b1325961d075625226","src/unix/notbsd/linux/other/mod.rs":"fe76beac87fc549b076078a0fa3e2ecd4c13b0e6e4fcb34a89e16c6584f5259b","src/unix/notbsd/linux/s390x.rs":"033cb7c4ee00af352698615de0248a5c6c9bcff57ba671ee22d31b70ef86fb4a","src/unix/notbsd/mod.rs":"6f9aad1e883a026f7c483bd74018bef684dc9841513315006b83bd74b7f434af","src/unix/solaris/mod.rs":"7950a26f3eb0b7bc8e71f524cc2e05832b759fe2ce12a58e0c1957e0ec1286dc","src/unix/uclibc/mips/mips32.rs":"9739c5fb47f389a0394ef08ee30da97a3de0a1300020731a8cc0a033616011b2","src/unix/uclibc/mips/mips64.rs":"230583280bbc7b3c7fcdb61244f51fa1af5944ca127c7cf83c598fe2313713d0","src/unix/uclibc/mips/mod.rs":"2d76e6cfeb2b7f7c59231a6e099f1aed811a45659e62153aaf00c220b9488a9d","src/unix/uclibc/mod.rs":"521818507cef958376edfd8401c35db7ee1c51ee3cf106ad962002104a184cf5","src/unix/uclibc/x86_64/l4re.rs":"68fd3a833fd1f7caf784a084224f384bdbdfb8b5a14ef94c4f5155409afb3439","src/unix/uclibc/x86_64/mod.rs":"419182836aedd426a5c9e6b8667058adf86ac8f43af73ce8d00c503f8ff8f414","src/unix/uclibc/x86_64/other.rs":"f03b47842896f2f3ae6f8ebdcbcf0276454f880349d9cf00e3d304f8136893c5","src/windows/gnu.rs":"791efcc59a26e3dedd9621a157bf1d5e88da854ac2279a2bf19edff064d10544","src/windows/mod.rs":"92394900144a70f609898d1fb9d60e9293f6ff5bba5e7964f52f054b6246913d","src/windows/msvc.rs":"5a01d74d4932ebef7d9345f4975ec21c27c24ee6c8d43fc113efbbb78df913f2"},"package":"2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74"} \ No newline at end of file diff --git a/vendor/libc/.cargo_vcs_info.json b/vendor/libc/.cargo_vcs_info.json new file mode 100644 index 0000000000..ed59a0ba1d --- /dev/null +++ b/vendor/libc/.cargo_vcs_info.json @@ -0,0 +1,5 @@ +{ + "git": { + "sha1": "f5636fc618f8e16968b3178196d73c94ad9f7b05" + } +} diff --git a/vendor/libc/.cirrus.yml b/vendor/libc/.cirrus.yml new file mode 100644 index 0000000000..3aa24af38a --- /dev/null +++ b/vendor/libc/.cirrus.yml @@ -0,0 +1,14 @@ +freebsd_instance: + image: freebsd-11-1-release-amd64 + +task: + # This name gets reported as a build status in GitHub + name: stable x86_64-unknown-freebsd + setup_script: + - pkg install -y curl + - curl https://sh.rustup.rs -sSf --output rustup.sh + - sh rustup.sh -y + test_script: + - . $HOME/.cargo/env + - cd libc-test + - cargo test diff --git a/vendor/libc/.travis.yml b/vendor/libc/.travis.yml deleted file mode 100644 index b6a73f00c2..0000000000 --- a/vendor/libc/.travis.yml +++ /dev/null @@ -1,123 +0,0 @@ -language: rust -rust: stable -sudo: required -dist: trusty -services: - - docker -install: - - if [ -z "$NO_ADD" ]; then rustup target add $TARGET; fi -script: - - cargo build $OPT - - cargo build $OPT --no-default-features - - cargo generate-lockfile --manifest-path libc-test/Cargo.toml - - if [[ $TRAVIS_OS_NAME = "linux" ]]; then - sh ci/run-docker.sh $TARGET; - else - export CARGO_TARGET_DIR=`pwd`/target; - sh ci/run.sh $TARGET; - fi - - rustc ci/style.rs && ./style src -env: - global: - secure: "e2/3QjgRN9atOuSHp22TrYG7QVKcYUWY48Hi9b60w+r1+BhPkTseIJLte7WefRhdXtqpjjUJTooKDhnurFOeHaCT+nmBgiv+FPU893sBl4bhesY4m0vgUJVbNZcs6lTImYekWVb+aqjGdgV/XAgCw7c3kPmrZV0MzGDWL64Xaps=" -matrix: - allow_failures: - # FIXME(#987) move back to include once 404 is fixed - - env: TARGET=s390x-unknown-linux-gnu - include: - # 1.13.0 compat - - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1 - rust: 1.13.0 - script: rm -f Cargo.lock && cargo build - install: - - # build documentation - - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1 - rust: nightly - script: sh ci/dox.sh - - # stable compat - - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1 - - env: TARGET=i686-unknown-linux-gnu - - os: osx - env: TARGET=x86_64-apple-darwin NO_ADD=1 - osx_image: xcode9.4 - - os: osx - env: TARGET=i686-apple-darwin - osx_image: xcode9.4 - - env: TARGET=arm-linux-androideabi - - env: TARGET=aarch64-linux-android - # FIXME(#826) should reenable - #- env: TARGET=i686-linux-android - - env: TARGET=x86_64-linux-android - - env: TARGET=x86_64-unknown-linux-musl - - env: TARGET=i686-unknown-linux-musl - - env: TARGET=arm-unknown-linux-gnueabihf - - env: TARGET=arm-unknown-linux-musleabihf - - env: TARGET=aarch64-unknown-linux-gnu - - env: TARGET=aarch64-unknown-linux-musl - # FIXME(#856) - rust: 1.22.1 - - os: osx - osx_image: xcode9.4 - env: TARGET=i386-apple-ios - CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest - RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0 - before_install: - rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest - - os: osx - osx_image: xcode9.4 - env: TARGET=x86_64-apple-ios - CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest - RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0 - before_install: - rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest - - env: TARGET=x86_64-rumprun-netbsd - - env: TARGET=powerpc-unknown-linux-gnu - - env: TARGET=powerpc64-unknown-linux-gnu - - env: TARGET=powerpc64le-unknown-linux-gnu - - env: TARGET=mips-unknown-linux-musl - - env: TARGET=mipsel-unknown-linux-musl - - env: TARGET=mips64-unknown-linux-gnuabi64 - - env: TARGET=mips64el-unknown-linux-gnuabi64 - - env: TARGET=mips-unknown-linux-gnu - - env: TARGET=s390x-unknown-linux-gnu - - env: TARGET=sparc64-unknown-linux-gnu - - env: TARGET=asmjs-unknown-emscripten - - env: TARGET=wasm32-unknown-emscripten - - # beta - - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1 - rust: beta - - os: osx - env: TARGET=x86_64-apple-darwin NO_ADD=1 - osx_image: xcode9.4 - rust: beta - - # nightly - - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1 - rust: nightly - - os: osx - env: TARGET=x86_64-apple-darwin NO_ADD=1 - osx_image: xcode9.4 - rust: nightly - # not available on stable - # without --release the build fails - # see https://github.com/rust-lang/rust/issues/45417 - - env: TARGET=x86_64-unknown-linux-gnux32 OPT="--release" - rust: nightly - - # QEMU based targets that compile in an emulator - - env: TARGET=x86_64-unknown-freebsd - allow_failures: - - env: TARGET=i386-apple-ios - CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest - RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0 - - env: TARGET=x86_64-apple-ios - CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest - RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0 - -notifications: - email: - on_success: never - webhooks: https://buildbot.rust-lang.org/homu/travis diff --git a/vendor/libc/Cargo.toml b/vendor/libc/Cargo.toml index 876b127c08..4d3e334226 100644 --- a/vendor/libc/Cargo.toml +++ b/vendor/libc/Cargo.toml @@ -12,18 +12,26 @@ [package] name = "libc" -version = "0.2.43" +version = "0.2.45" authors = ["The Rust Project Developers"] -description = "A library for types and bindings to native C functions often found in libc or\nother common platform libraries.\n" +build = "build.rs" +exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] +description = "Raw FFI bindings to platform libraries like libc.\n" homepage = "https://github.com/rust-lang/libc" documentation = "http://doc.rust-lang.org/libc" readme = "README.md" -license = "MIT/Apache-2.0" +keywords = ["libc", "ffi", "bindings", "operating", "system"] +categories = ["external-ffi-bindings", "no-std", "os"] +license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/libc" +[dependencies.rustc-std-workspace-core] +version = "1.0.0" +optional = true [features] align = [] default = ["use_std"] +rustc-dep-of-std = ["align", "rustc-std-workspace-core"] use_std = [] [badges.appveyor] project_name = "rust-lang-libs/libc" diff --git a/vendor/libc/README.md b/vendor/libc/README.md index a19a56ee0f..6cf2d15971 100644 --- a/vendor/libc/README.md +++ b/vendor/libc/README.md @@ -1,8 +1,7 @@ libc ==== -A Rust library with native bindings to the types and functions commonly found on -various systems, including libc. +Raw FFI bindings to platform libraries like `libc`. [![Build Status](https://travis-ci.org/rust-lang/libc.svg?branch=master)](https://travis-ci.org/rust-lang/libc) [![Build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/libc?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/libc) diff --git a/vendor/libc/appveyor.yml b/vendor/libc/appveyor.yml deleted file mode 100644 index fe2a332a1c..0000000000 --- a/vendor/libc/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -environment: - # When this was added there were revocation check failures when using the - # libcurl backend as libcurl checks by default, but rustup doesn't provide the - # switch to turn this off. Switch to Hyper which looks to not check for - # revocation by default like libcurl does. - RUSTUP_USE_HYPER: 1 - CARGO_HTTP_CHECK_REVOKE: false - matrix: - - TARGET: x86_64-pc-windows-gnu - MSYS2_BITS: 64 - - TARGET: i686-pc-windows-gnu - MSYS2_BITS: 32 - - TARGET: x86_64-pc-windows-msvc - - TARGET: i686-pc-windows-msvc -install: - - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init.exe -y --default-host %TARGET% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --target %TARGET% - - cargo test --no-default-features --target %TARGET% - - cargo test --manifest-path libc-test/Cargo.toml --target %TARGET% diff --git a/vendor/libc/build.rs b/vendor/libc/build.rs new file mode 100644 index 0000000000..1852ed2790 --- /dev/null +++ b/vendor/libc/build.rs @@ -0,0 +1,35 @@ +use std::env; +use std::process::Command; +use std::str; + +fn main() { + /* + * If `core::ffi::c_void` exists, libc can just re-export it. Otherwise, it + * must define an incompatible type to retain backwards-compatibility. + */ + if rustc_minor_version().expect("Failed to get rustc version") >= 30 { + println!("cargo:rustc-cfg=core_cvoid"); + } +} + +fn rustc_minor_version() -> Option { + macro_rules! otry { + ($e:expr) => { + match $e { + Some(e) => e, + None => return None, + } + }; + } + + let rustc = otry!(env::var_os("RUSTC")); + let output = otry!(Command::new(rustc).arg("--version").output().ok()); + let version = otry!(str::from_utf8(&output.stdout).ok()); + let mut pieces = version.split('.'); + + if pieces.next() != Some("rustc 1") { + return None; + } + + otry!(pieces.next()).parse().ok() +} diff --git a/vendor/libc/ci/README.md b/vendor/libc/ci/README.md deleted file mode 100644 index 28152e5d00..0000000000 --- a/vendor/libc/ci/README.md +++ /dev/null @@ -1,243 +0,0 @@ -The goal of the libc crate is to have CI running everywhere to have the -strongest guarantees about the definitions that this library contains, and as a -result the CI is pretty complicated and also pretty large! Hopefully this can -serve as a guide through the sea of scripts in this directory and elsewhere in -this project. - -# Files - -First up, let's talk about the files in this directory: - -* `run-travis.sh` - a shell script run by all Travis builders, this is - responsible for setting up the rest of the environment such as installing new - packages, downloading Rust target libraries, etc. - -* `run.sh` - the actual script which runs tests for a particular architecture. - Called from the `run-travis.sh` script this will run all tests for the target - specified. - -* `cargo-config` - Cargo configuration of linkers to use copied into place by - the `run-travis.sh` script before builds are run. - -* `dox.sh` - script called from `run-travis.sh` on only the linux 64-bit nightly - Travis bots to build documentation for this crate. - -* `landing-page-*.html` - used by `dox.sh` to generate a landing page for all - architectures' documentation. - -* `run-qemu.sh` - see discussion about QEMU below - -* `mips`, `rumprun` - instructions to build the docker image for each respective - CI target - -# CI Systems - -Currently this repository leverages a combination of Travis CI and AppVeyor for -running tests. The triples tested are: - -* AppVeyor - * `{i686,x86_64}-pc-windows-{msvc,gnu}` -* Travis - * `{i686,x86_64,mips,aarch64}-unknown-linux-gnu` - * `{x86_64,aarch64}-unknown-linux-musl` - * `arm-unknown-linux-gnueabihf` - * `arm-linux-androideabi` - * `{i686,x86_64}-apple-{darwin,ios}` - * `x86_64-rumprun-netbsd` - * `x86_64-unknown-freebsd` - * `x86_64-unknown-openbsd` - -The Windows triples are all pretty standard, they just set up their environment -then run tests, no need for downloading any extra target libs (we just download -the right installer). The Intel Linux/OSX builds are similar in that we just -download the right target libs and run tests. Note that the Intel Linux/OSX -builds are run on stable/beta/nightly, but are the only ones that do so. - -The remaining architectures look like: - -* Android runs in a [docker image][android-docker] with an emulator, the NDK, - and the SDK already set up. The entire build happens within the docker image. -* The MIPS, ARM, and AArch64 builds all use the QEMU userspace emulator to run - the generated binary to actually verify the tests pass. -* The MUSL build just has to download a MUSL compiler and target libraries and - then otherwise runs tests normally. -* iOS builds need an extra linker flag currently, but beyond that they're built - as standard as everything else. -* The rumprun target builds an entire kernel from the test suite and then runs - it inside QEMU using the serial console to test whether it succeeded or - failed. -* The BSD builds, currently OpenBSD and FreeBSD, use QEMU to boot up a system - and compile/run tests. More information on that below. - -[android-docker]: https://github.com/rust-lang/rust-buildbot/blob/master/slaves/android/Dockerfile - -## QEMU - -Lots of the architectures tested here use QEMU in the tests, so it's worth going -over all the crazy capabilities QEMU has and the various flavors in which we use -it! - -First up, QEMU has userspace emulation where it doesn't boot a full kernel, it -just runs a binary from another architecture (using the `qemu-` wrappers). -We provide it the runtime path for the dynamically loaded system libraries, -however. This strategy is used for all Linux architectures that aren't intel. -Note that one downside of this QEMU system is that threads are barely -implemented, so we're careful to not spawn many threads. - -For the rumprun target the only output is a kernel image, so we just use that -plus the `rumpbake` command to create a full kernel image which is then run from -within QEMU. - -Finally, the fun part, the BSDs. Quite a few hoops are jumped through to get CI -working for these platforms, but the gist of it looks like: - -* Cross compiling from Linux to any of the BSDs seems to be quite non-standard. - We may be able to get it working but it might be difficult at that point to - ensure that the libc definitions align with what you'd get on the BSD itself. - As a result, we try to do compiles within the BSD distro. -* On Travis we can't run a VM-in-a-VM, so we resort to userspace emulation - (QEMU). -* Unfortunately on Travis we also can't use KVM, so the emulation is super slow. - -With all that in mind, the way BSD is tested looks like: - -1. Download a pre-prepared image for the OS being tested. -2. Generate the tests for the OS being tested. This involves running the `ctest` - library over libc to generate a Rust file and a C file which will then be - compiled into the final test. -3. Generate a disk image which will later be mounted by the OS being tested. - This image is mostly just the libc directory, but some modifications are made - to compile the generated files from step 2. -4. The kernel is booted in QEMU, and it is configured to detect the libc-test - image being available, run the test script, and then shut down afterwards. -5. Look for whether the tests passed in the serial console output of the kernel. - -There's some pretty specific instructions for setting up each image (detailed -below), but the main gist of this is that we must avoid a vanilla `cargo run` -inside of the `libc-test` directory (which is what it's intended for) because -that would compile `syntex_syntax`, a large library, with userspace emulation. -This invariably times out on Travis, so we can't do that. - -Once all those hoops are jumped through, however, we can be happy that we're -testing almost everything! - -Below are some details of how to set up the initial OS images which are -downloaded. Each image must be enabled have input/output over the serial -console, log in automatically at the serial console, detect if a second drive in -QEMU is available, and if so mount it, run a script (it'll specifically be -`run-qemu.sh` in this folder which is copied into the generated image talked -about above), and then shut down. - -### QEMU Setup - FreeBSD - -1. [Download the latest stable amd64-bootonly release ISO](https://www.freebsd.org/where.html). - E.g. FreeBSD-11.1-RELEASE-amd64-bootonly.iso -2. Create the disk image: `qemu-img create -f qcow2 FreeBSD-11.1-RELEASE-amd64.qcow2 2G` -3. Boot the machine: `qemu-system-x86_64 -cdrom FreeBSD-11.1-RELEASE-amd64-bootonly.iso -drive if=virtio,file=FreeBSD-11.1-RELEASE-amd64.qcow2 -net nic,model=virtio -net user` -4. Run the installer, and install FreeBSD: - 1. Install - 1. Continue with default keymap - 1. Set Hostname: freebsd-ci - 1. Distribution Select: - 1. Uncheck lib32 - 1. Uncheck ports - 1. Network Configuration: vtnet0 - 1. Configure IPv4? Yes - 1. DHCP? Yes - 1. Configure IPv6? No - 1. Resolver Configuration: Ok - 1. Mirror Selection: Main Site - 1. Partitioning: Auto (UFS) - 1. Partition: Entire Disk - 1. Partition Scheme: MBR - 1. App Partition: Ok - 1. Partition Editor: Finish - 1. Confirmation: Commit - 1. Wait for sets to install - 1. Set the root password to nothing (press enter twice) - 1. Set time zone to UTC - 1. Set Date: Skip - 1. Set Time: Skip - 1. System Configuration: - 1. Disable sshd - 1. Disable dumpdev - 1. System Hardening - 1. Disable Sendmail service - 1. Add User Accounts: No - 1. Final Configuration: Exit - 1. Manual Configuration: Yes - 1. `echo 'console="comconsole"' >> /boot/loader.conf` - 1. `echo 'autoboot_delay="0"' >> /boot/loader.conf` - 1. `echo 'ext2fs_load="YES"' >> /boot/loader.conf` - 1. Look at `/etc/ttys`, see what getty argument is for `ttyu0` (E.g. `3wire`) - 1. Edit `/etc/gettytab` (with `vi` for example), look for `ttyu0` argument, - prepend `:al=root` to the line beneath to have the machine auto-login as - root. E.g. - - 3wire:\ - :np:nc:sp#0: - becomes: - - 3wire:\ - :al=root:np:nc:sp#0: - - 1. Edit `/root/.login` and put this in it: - - [ -e /dev/vtbd1 ] || exit 0 - mount -t ext2fs /dev/vtbd1 /mnt - sh /mnt/run.sh /mnt - poweroff - - 1. Exit the post install shell: `exit` - 1. Back in in the installer choose Reboot - 1. If all went well the machine should reboot and show a login prompt. - If you switch to the serial console by choosing View > serial0 in - the qemu menu, you should be logged in as root. - 1. Shutdown the machine: `shutdown -p now` - -Helpful links - -* https://en.wikibooks.org/wiki/QEMU/Images -* https://blog.nekoconeko.nl/blog/2015/06/04/creating-an-openstack-freebsd-image.html -* https://www.freebsd.org/doc/handbook/serialconsole-setup.html - - -### QEMU setup - OpenBSD - -1. Download CD installer -2. `qemu-img create -f qcow2 foo.qcow2 2G` -3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user` -4. run installer -5. `echo 'set tty com0' >> /etc/boot.conf` -6. `echo 'boot' >> /etc/boot.conf` -7. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to - 'vt220 on secure' -8. Modify same line in /etc/ttys to have `"/root/foo.sh"` as the shell -9. Add this script to `/root/foo.sh` - -``` -#!/bin/sh -exec 1>/dev/tty00 -exec 2>&1 - -if mount -t ext2fs /dev/sd1c /mnt; then - sh /mnt/run.sh /mnt - shutdown -ph now -fi - -# limited shell... -exec /bin/sh < /dev/tty00 -``` - -10. `chmod +x /root/foo.sh` - -Helpful links: - -* https://en.wikibooks.org/wiki/QEMU/Images -* http://www.openbsd.org/faq/faq7.html#SerCon - -# Questions? - -Hopefully that's at least somewhat of an introduction to everything going on -here, and feel free to ping @alexcrichton with questions! - diff --git a/vendor/libc/ci/android-install-ndk.sh b/vendor/libc/ci/android-install-ndk.sh deleted file mode 100644 index 873f6c52c8..0000000000 --- a/vendor/libc/ci/android-install-ndk.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# Copyright 2016 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. - -set -ex - -curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip -unzip -q android-ndk-r15b-linux-x86_64.zip - -case "$1" in - aarch64) - arch=arm64 - ;; - - i686) - arch=x86 - ;; - - *) - arch=$1 - ;; -esac; - -android-ndk-r15b/build/tools/make_standalone_toolchain.py \ - --unified-headers \ - --install-dir /android/ndk-$1 \ - --arch $arch \ - --api 24 - -rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b diff --git a/vendor/libc/ci/android-install-sdk.sh b/vendor/libc/ci/android-install-sdk.sh deleted file mode 100644 index ab7e14d95b..0000000000 --- a/vendor/libc/ci/android-install-sdk.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# Copyright 2016 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. - -set -ex - -# Prep the SDK and emulator -# -# Note that the update process requires that we accept a bunch of licenses, and -# we can't just pipe `yes` into it for some reason, so we take the same strategy -# located in https://github.com/appunite/docker by just wrapping it in a script -# which apparently magically accepts the licenses. - -mkdir sdk -curl https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O -unzip -d sdk sdk-tools-linux-3859397.zip - -case "$1" in - arm | armv7) - abi=armeabi-v7a - ;; - - aarch64) - abi=arm64-v8a - ;; - - i686) - abi=x86 - ;; - - x86_64) - abi=x86_64 - ;; - - *) - echo "invalid arch: $1" - exit 1 - ;; -esac; - -# --no_https avoids -# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found -echo "yes" | \ - ./sdk/tools/bin/sdkmanager --no_https \ - "emulator" \ - "platform-tools" \ - "platforms;android-24" \ - "system-images;android-24;default;$abi" - -echo "no" | - ./sdk/tools/bin/avdmanager create avd \ - --name $1 \ - --package "system-images;android-24;default;$abi" diff --git a/vendor/libc/ci/android-sysimage.sh b/vendor/libc/ci/android-sysimage.sh deleted file mode 100644 index 9611dfeb0d..0000000000 --- a/vendor/libc/ci/android-sysimage.sh +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2017 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. - -set -ex - -URL=https://dl.google.com/android/repository/sys-img/android - -main() { - local arch=$1 - local name=$2 - local dest=/system - local td=$(mktemp -d) - - apt-get install --no-install-recommends e2tools - - pushd $td - curl -O $URL/$name - unzip -q $name - - local system=$(find . -name system.img) - mkdir -p $dest/{bin,lib,lib64} - - # Extract android linker and libraries to /system - # This allows android executables to be run directly (or with qemu) - if [ $arch = "x86_64" -o $arch = "arm64" ]; then - e2cp -p $system:/bin/linker64 $dest/bin/ - e2cp -p $system:/lib64/libdl.so $dest/lib64/ - e2cp -p $system:/lib64/libc.so $dest/lib64/ - e2cp -p $system:/lib64/libm.so $dest/lib64/ - else - e2cp -p $system:/bin/linker $dest/bin/ - e2cp -p $system:/lib/libdl.so $dest/lib/ - e2cp -p $system:/lib/libc.so $dest/lib/ - e2cp -p $system:/lib/libm.so $dest/lib/ - fi - - # clean up - apt-get purge --auto-remove -y e2tools - - popd - - rm -rf $td -} - -main "${@}" diff --git a/vendor/libc/ci/docker/aarch64-linux-android/Dockerfile b/vendor/libc/ci/docker/aarch64-linux-android/Dockerfile deleted file mode 100644 index 5fc83aadb3..0000000000 --- a/vendor/libc/ci/docker/aarch64-linux-android/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:16.04 - -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - file \ - curl \ - ca-certificates \ - python \ - unzip \ - expect \ - openjdk-9-jre \ - libstdc++6:i386 \ - libpulse0 \ - gcc \ - libc6-dev - -WORKDIR /android/ -COPY android* /android/ - -ENV ANDROID_ARCH=aarch64 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools - -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH -RUN sh /android/android-install-sdk.sh $ANDROID_ARCH -RUN mv /root/.android /tmp -RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ - CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ - HOME=/tmp - -ADD runtest-android.rs /tmp/runtest.rs -ENTRYPOINT [ \ - "bash", \ - "-c", \ - # set SHELL so android can detect a 64bits system, see - # http://stackoverflow.com/a/41789144 - "SHELL=/bin/dash /android/sdk/emulator/emulator @aarch64 -no-window & \ - rustc /tmp/runtest.rs -o /tmp/runtest && \ - exec \"$@\"", \ - "--" \ -] diff --git a/vendor/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 18214a3e64..0000000000 --- a/vendor/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:17.10 -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev ca-certificates \ - gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user -ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile b/vendor/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile deleted file mode 100644 index caec1572cb..0000000000 --- a/vendor/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc make libc6-dev git curl ca-certificates \ - gcc-aarch64-linux-gnu qemu-user -RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \ - tar xzf - && \ - cd musl-1.1.19 && \ - CC=aarch64-linux-gnu-gcc \ - ./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \ - make install -j4 && \ - cd .. && \ - rm -rf musl-1.1.19 -# Install linux kernel headers sanitized for use with musl -RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ - tar xzf - && \ - cd kernel-headers-3.12.6-6 && \ - make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \ - cd .. && \ - rm -rf kernel-headers-3.12.6-6 - -# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd? -ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \ - CC_aarch64_unknown_linux_musl=musl-gcc \ - RUSTFLAGS='-Clink-args=-lgcc' \ - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \ - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-aarch64 -L /musl-aarch64" diff --git a/vendor/libc/ci/docker/arm-linux-androideabi/Dockerfile b/vendor/libc/ci/docker/arm-linux-androideabi/Dockerfile deleted file mode 100644 index a3fc64bfd5..0000000000 --- a/vendor/libc/ci/docker/arm-linux-androideabi/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:16.04 - -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - file \ - curl \ - ca-certificates \ - python \ - unzip \ - expect \ - openjdk-9-jre \ - libstdc++6:i386 \ - libpulse0 \ - gcc \ - libc6-dev - -WORKDIR /android/ -COPY android* /android/ - -ENV ANDROID_ARCH=arm -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools - -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH -RUN sh /android/android-install-sdk.sh $ANDROID_ARCH -RUN mv /root/.android /tmp -RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ - CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \ - HOME=/tmp - -ADD runtest-android.rs /tmp/runtest.rs -ENTRYPOINT [ \ - "bash", \ - "-c", \ - # set SHELL so android can detect a 64bits system, see - # http://stackoverflow.com/a/41789144 - "SHELL=/bin/dash /android/sdk/emulator/emulator @arm -no-window & \ - rustc /tmp/runtest.rs -o /tmp/runtest && \ - exec \"$@\"", \ - "--" \ -] diff --git a/vendor/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/vendor/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile deleted file mode 100644 index 9fe71dcf87..0000000000 --- a/vendor/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:17.10 -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev ca-certificates \ - gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user -ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ - CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/vendor/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile deleted file mode 100644 index 86304130fe..0000000000 --- a/vendor/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc make libc6-dev git curl ca-certificates \ - gcc-arm-linux-gnueabihf qemu-user - -RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | tar xzf - -WORKDIR /musl-1.1.19 -RUN CC=arm-linux-gnueabihf-gcc \ - CFLAGS="-march=armv6 -marm" \ - ./configure --prefix=/musl-arm --enable-wrapper=yes -RUN make install -j4 - -# Install linux kernel headers sanitized for use with musl -RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ - tar xzf - && \ - cd kernel-headers-3.12.6-6 && \ - make ARCH=arm prefix=/musl-arm install -j4 && \ - cd .. && \ - rm -rf kernel-headers-3.12.6-6 - -ENV PATH=$PATH:/musl-arm/bin:/rust/bin \ - CC_arm_unknown_linux_musleabihf=musl-gcc \ - CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=musl-gcc \ - CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_RUNNER="qemu-arm -L /musl-arm" diff --git a/vendor/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile b/vendor/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile deleted file mode 100644 index 3088fc53c4..0000000000 --- a/vendor/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - gcc \ - git \ - libc6-dev \ - python \ - xz-utils - -COPY emscripten.sh / -RUN bash /emscripten.sh - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node - -COPY emscripten-entry.sh / -ENTRYPOINT ["/emscripten-entry.sh"] diff --git a/vendor/libc/ci/docker/i686-linux-android/Dockerfile b/vendor/libc/ci/docker/i686-linux-android/Dockerfile deleted file mode 100644 index f0836c3853..0000000000 --- a/vendor/libc/ci/docker/i686-linux-android/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:16.04 - -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - file \ - curl \ - ca-certificates \ - python \ - unzip \ - expect \ - openjdk-9-jre \ - libstdc++6:i386 \ - libpulse0 \ - gcc \ - libc6-dev - -WORKDIR /android/ -COPY android* /android/ - -ENV ANDROID_ARCH=i686 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools - -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH -RUN sh /android/android-install-sdk.sh $ANDROID_ARCH -RUN mv /root/.android /tmp -RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \ - CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \ - HOME=/tmp - -ADD runtest-android.rs /tmp/runtest.rs -ENTRYPOINT [ \ - "bash", \ - "-c", \ - # set SHELL so android can detect a 64bits system, see - # http://stackoverflow.com/a/41789144 - "SHELL=/bin/dash /android/sdk/emulator/emulator @i686 -no-window -no-accel & \ - rustc /tmp/runtest.rs -o /tmp/runtest && \ - exec \"$@\"", \ - "--" \ -] diff --git a/vendor/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 03f3e8e690..0000000000 --- a/vendor/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:18.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc-multilib libc6-dev ca-certificates -ENV PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/i686-unknown-linux-musl/Dockerfile b/vendor/libc/ci/docker/i686-unknown-linux-musl/Dockerfile deleted file mode 100644 index 49f37d70f2..0000000000 --- a/vendor/libc/ci/docker/i686-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM ubuntu:17.10 - -RUN dpkg --add-architecture i386 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc-multilib make libc6-dev git curl ca-certificates libc6:i386 -# Below we're cross-compiling musl for i686 using the system compiler on an -# x86_64 system. This is an awkward thing to be doing and so we have to jump -# through a couple hoops to get musl to be happy. In particular: -# -# * We specifically pass -m32 in CFLAGS and override CC when running ./configure, -# since otherwise the script will fail to find a compiler. -# * We manually unset CROSS_COMPILE when running make; otherwise the makefile -# will call the non-existent binary 'i686-ar'. -RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \ - tar xzf - && \ - cd musl-1.1.19 && \ - CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \ - make CROSS_COMPILE= install -j4 && \ - cd .. && \ - rm -rf musl-1.1.19 -# Install linux kernel headers sanitized for use with musl -RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ - tar xzf - && \ - cd kernel-headers-3.12.6-6 && \ - make ARCH=i386 prefix=/musl-i686 install -j4 && \ - cd .. && \ - rm -rf kernel-headers-3.12.6-6 - -ENV PATH=$PATH:/musl-i686/bin:/rust/bin \ - CC_i686_unknown_linux_musl=musl-gcc diff --git a/vendor/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile deleted file mode 100644 index c66abd471b..0000000000 --- a/vendor/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-mips-linux-gnu libc6-dev-mips-cross \ - qemu-system-mips - -ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/mips-unknown-linux-musl/Dockerfile b/vendor/libc/ci/docker/mips-unknown-linux-musl/Dockerfile deleted file mode 100644 index 91ffd58173..0000000000 --- a/vendor/libc/ci/docker/mips-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ - bzip2 - -RUN mkdir /toolchain - -# Note that this originally came from: -# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 -RUN curl -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ - tar xjf - -C /toolchain --strip-components=1 - -ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \ - CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15" diff --git a/vendor/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/vendor/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile deleted file mode 100644 index b9921fcc50..0000000000 --- a/vendor/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \ - qemu-system-mips64 - -ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \ - CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \ - CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile b/vendor/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile deleted file mode 100644 index 434c90819e..0000000000 --- a/vendor/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \ - qemu-system-mips64el - -ENV CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnuabi64-gcc \ - CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64el -L /usr/mips64el-linux-gnuabi64" \ - CC_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnuabi64-gcc \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/vendor/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile deleted file mode 100644 index 3642fa8cad..0000000000 --- a/vendor/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ - bzip2 - -RUN mkdir /toolchain - -# Note that this originally came from: -# https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 -RUN curl -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ - tar xjf - -C /toolchain --strip-components=2 - -ENV PATH=$PATH:/rust/bin:/toolchain/bin \ - CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ - CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \ - CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain" diff --git a/vendor/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 106ada444a..0000000000 --- a/vendor/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \ - qemu-system-ppc - -ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \ - CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index a6ab66a9a6..0000000000 --- a/vendor/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \ - qemu-system-ppc - -ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \ - CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \ - CC=powerpc64-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 627123e9a1..0000000000 --- a/vendor/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \ - qemu-system-ppc - -ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \ - CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64le -L /usr/powerpc64le-linux-gnu" \ - CC=powerpc64le-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 861f4f9b00..0000000000 --- a/vendor/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - curl ca-certificates \ - gcc libc6-dev \ - gcc-s390x-linux-gnu libc6-dev-s390x-cross \ - qemu-system-s390x \ - cpio - -COPY linux-s390x.sh / -RUN bash /linux-s390x.sh - -COPY test-runner-linux / - -ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \ - CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="/test-runner-linux s390x" \ - CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index d9edaab426..0000000000 --- a/vendor/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM debian:stretch - -RUN apt-get update && apt-get install -y --no-install-recommends \ - curl ca-certificates \ - gcc libc6-dev \ - gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \ - qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \ - p7zip-full cpio linux-libc-dev-sparc64-cross linux-headers-4.9.0-3-common - -# Put linux/module.h into the right spot as it is not shipped by debian -RUN cp /usr/src/linux-headers-4.9.0-3-common/include/uapi/linux/module.h /usr/sparc64-linux-gnu/include/linux/ - -COPY linux-sparc64.sh / -RUN bash /linux-sparc64.sh - -COPY test-runner-linux / - -ENV CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_LINKER=sparc64-linux-gnu-gcc \ - CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER="/test-runner-linux sparc64" \ - CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile b/vendor/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile deleted file mode 100644 index 59bf7d9a23..0000000000 --- a/vendor/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - gcc \ - git \ - libc6-dev \ - python \ - xz-utils - -COPY emscripten.sh / -RUN bash /emscripten.sh - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh - -COPY emscripten-entry.sh / -COPY docker/wasm32-unknown-emscripten/node-wrapper.sh /usr/local/bin/node-wrapper.sh -ENTRYPOINT ["/emscripten-entry.sh"] diff --git a/vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh b/vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh deleted file mode 100755 index 3122e2e23b..0000000000 --- a/vendor/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -me=$1 -shift -dir=$(dirname $me) -file=$(basename $me) - -if echo $file | grep -q wasm; then - exit 0 # FIXME(rust-lang/cargo#4750) -fi - -cd $dir -exec node $file "$@" diff --git a/vendor/libc/ci/docker/x86_64-linux-android/Dockerfile b/vendor/libc/ci/docker/x86_64-linux-android/Dockerfile deleted file mode 100644 index 0cfbc48209..0000000000 --- a/vendor/libc/ci/docker/x86_64-linux-android/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - gcc \ - libc-dev \ - python \ - unzip - -WORKDIR /android/ -ENV ANDROID_ARCH=x86_64 -COPY android-install-ndk.sh /android/ -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH - -# We do not run x86_64-linux-android tests on an android emulator. -# See ci/android-sysimage.sh for informations about how tests are run. -COPY android-sysimage.sh /android/ -RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip - -ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \ - CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \ - CC_x86_64_linux_android=x86_64-linux-android-gcc \ - CXX_x86_64_linux_android=x86_64-linux-android-g++ \ - HOME=/tmp diff --git a/vendor/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile b/vendor/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile deleted file mode 100644 index a486d05b2e..0000000000 --- a/vendor/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM mato/rumprun-toolchain-hw-x86_64 -USER root -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - qemu -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest - -ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/ -ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"] diff --git a/vendor/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs b/vendor/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs deleted file mode 100644 index 94b5946080..0000000000 --- a/vendor/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs +++ /dev/null @@ -1,54 +0,0 @@ -use std::env; -use std::process::{Command, Stdio}; -use std::sync::mpsc; -use std::thread; -use std::time::Duration; -use std::io::{BufRead, BufReader, Read}; - -fn main() { - assert_eq!(env::args().len(), 2); - - let status = Command::new("rumprun-bake") - .arg("hw_virtio") - .arg("/tmp/libc-test.img") - .arg(env::args().nth(1).unwrap()) - .status() - .expect("failed to run rumprun-bake"); - assert!(status.success()); - - let mut child = Command::new("qemu-system-x86_64") - .arg("-nographic") - .arg("-vga").arg("none") - .arg("-m").arg("64") - .arg("-kernel").arg("/tmp/libc-test.img") - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .expect("failed to spawn qemu"); - - let mut stdout = child.stdout.take().unwrap(); - let mut stderr = child.stderr.take().unwrap(); - let (tx, rx) = mpsc::channel(); - let tx2 = tx.clone(); - let t1 = thread::spawn(move || find_ok(&mut stdout, tx)); - let t2 = thread::spawn(move || find_ok(&mut stderr, tx2)); - - let res = rx.recv_timeout(Duration::new(5, 0)); - child.kill().unwrap(); - t1.join().unwrap(); - t2.join().unwrap(); - - if res.is_err() { - panic!("didn't find success"); - } -} - -fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) { - for line in BufReader::new(input).lines() { - let line = line.unwrap(); - println!("{}", line); - if line.starts_with("PASSED ") && line.contains(" tests") { - tx.send(()).unwrap(); - } - } -} diff --git a/vendor/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile b/vendor/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile deleted file mode 100644 index 35f1036575..0000000000 --- a/vendor/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM wezm/port-prebuilt-freebsd11@sha256:43553e2265ec702ec72a63a765df333f50b1858b896e69385749e96d8624e9b0 - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - qemu genext2fs xz-utils -RUN apt-get install -y curl ca-certificates gcc - -ENTRYPOINT ["sh"] - -ENV PATH=$PATH:/rust/bin \ - QEMU=2018-03-15/FreeBSD-11.1-RELEASE-amd64.qcow2.xz \ - CAN_CROSS=1 \ - CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd11-gcc diff --git a/vendor/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/vendor/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 6ab9c92319..0000000000 --- a/vendor/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:18.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc libc6-dev ca-certificates -ENV PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile b/vendor/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile deleted file mode 100644 index 03f3e8e690..0000000000 --- a/vendor/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:18.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc-multilib libc6-dev ca-certificates -ENV PATH=$PATH:/rust/bin diff --git a/vendor/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/vendor/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile deleted file mode 100644 index 6e2b7d9e5e..0000000000 --- a/vendor/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:17.10 - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc make libc6-dev git curl ca-certificates -RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \ - tar xzf - && \ - cd musl-1.1.19 && \ - ./configure --prefix=/musl-x86_64 && \ - make install -j4 && \ - cd .. && \ - rm -rf musl-1.1.19 -# Install linux kernel headers sanitized for use with musl -RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ - tar xzf - && \ - cd kernel-headers-3.12.6-6 && \ - make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \ - cd .. && \ - rm -rf kernel-headers-3.12.6-6 -ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin diff --git a/vendor/libc/ci/dox.sh b/vendor/libc/ci/dox.sh deleted file mode 100644 index b8ffa7dd0d..0000000000 --- a/vendor/libc/ci/dox.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -# Builds documentation for all target triples that we have a registered URL for -# in liblibc. This scrapes the list of triples to document from `src/lib.rs` -# which has a bunch of `html_root_url` directives we pick up. - -set -e - -TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'` - -rm -rf target/doc -mkdir -p target/doc - -cp ci/landing-page-head.html target/doc/index.html - -for target in $TARGETS; do - echo documenting $target - - rustdoc -o target/doc/$target --target $target src/lib.rs --cfg cross_platform_docs \ - --crate-name libc - - echo "

  • $target
  • " \ - >> target/doc/index.html -done - -cat ci/landing-page-footer.html >> target/doc/index.html - -# If we're on travis, not a PR, and on the right branch, publish! -if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then - pip install ghp_import --install-option="--prefix=$HOME/.local" - $HOME/.local/bin/ghp-import -n target/doc - git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages -fi diff --git a/vendor/libc/ci/emscripten-entry.sh b/vendor/libc/ci/emscripten-entry.sh deleted file mode 100755 index 22ae8b08a3..0000000000 --- a/vendor/libc/ci/emscripten-entry.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2017 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. - -set -ex - -source /emsdk-portable/emsdk_env.sh &> /dev/null - -# emsdk-portable provides a node binary, but we need version 8 to run wasm -export PATH="/node-v8.0.0-linux-x64/bin:$PATH" - -exec "$@" diff --git a/vendor/libc/ci/emscripten.sh b/vendor/libc/ci/emscripten.sh deleted file mode 100644 index d80258584d..0000000000 --- a/vendor/libc/ci/emscripten.sh +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2017 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. - -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - $@ &> /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - rm -f /tmp/build.log - set -x -} - -cd / -curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ - tar -xz - -cd /emsdk-portable -./emsdk update -hide_output ./emsdk install sdk-1.37.20-64bit -./emsdk activate sdk-1.37.20-64bit - -# Compile and cache libc -source ./emsdk_env.sh -echo "main(){}" > a.c -HOME=/emsdk-portable/ emcc a.c -HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c -rm -f a.* - -# Make emsdk usable by any user -cp /root/.emscripten /emsdk-portable -chmod a+rxw -R /emsdk-portable - -# node 8 is required to run wasm -cd / -curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \ - tar -xJ - diff --git a/vendor/libc/ci/ios/deploy_and_run_on_ios_simulator.rs b/vendor/libc/ci/ios/deploy_and_run_on_ios_simulator.rs deleted file mode 100644 index 95df52d76d..0000000000 --- a/vendor/libc/ci/ios/deploy_and_run_on_ios_simulator.rs +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2017 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. - -// This is a script to deploy and execute a binary on an iOS simulator. -// The primary use of this is to be able to run unit tests on the simulator and -// retrieve the results. -// -// To do this through Cargo instead, use Dinghy -// (https://github.com/snipsco/dinghy): cargo dinghy install, then cargo dinghy -// test. - -use std::env; -use std::fs::{self, File}; -use std::io::Write; -use std::path::Path; -use std::process; -use std::process::Command; - -macro_rules! t { - ($e:expr) => (match $e { - Ok(e) => e, - Err(e) => panic!("{} failed with: {}", stringify!($e), e), - }) -} - -// Step one: Wrap as an app -fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) { - println!("Packaging simulator app"); - drop(fs::remove_dir_all("ios_simulator_app")); - t!(fs::create_dir("ios_simulator_app")); - t!(fs::copy(test_binary_path, - Path::new("ios_simulator_app").join(crate_name))); - - let mut f = t!(File::create("ios_simulator_app/Info.plist")); - t!(f.write_all(format!(r#" - - - - - CFBundleExecutable - {} - CFBundleIdentifier - com.rust.unittests - - - "#, crate_name).as_bytes())); -} - -// Step two: Start the iOS simulator -fn start_simulator() { - println!("Looking for iOS simulator"); - let output = t!(Command::new("xcrun").arg("simctl").arg("list").output()); - assert!(output.status.success()); - let mut simulator_exists = false; - let mut simulator_booted = false; - let mut found_rust_sim = false; - let stdout = t!(String::from_utf8(output.stdout)); - for line in stdout.lines() { - if line.contains("rust_ios") { - if found_rust_sim { - panic!("Duplicate rust_ios simulators found. Please \ - double-check xcrun simctl list."); - } - simulator_exists = true; - simulator_booted = line.contains("(Booted)"); - found_rust_sim = true; - } - } - - if simulator_exists == false { - println!("Creating iOS simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("create") - .arg("rust_ios") - .arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE") - .arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2") - .check_status(); - } else if simulator_booted == true { - println!("Shutting down already-booted simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("shutdown") - .arg("rust_ios") - .check_status(); - } - - println!("Starting iOS simulator"); - // We can't uninstall the app (if present) as that will hang if the - // simulator isn't completely booted; just erase the simulator instead. - Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status(); - Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status(); -} - -// Step three: Install the app -fn install_app_to_simulator() { - println!("Installing app to simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("install") - .arg("booted") - .arg("ios_simulator_app/") - .check_status(); -} - -// Step four: Run the app -fn run_app_on_simulator() { - println!("Running app"); - let output = t!(Command::new("xcrun") - .arg("simctl") - .arg("launch") - .arg("--console") - .arg("booted") - .arg("com.rust.unittests") - .output()); - - println!("status: {}", output.status); - println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout)); - println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr)); - - let stdout = String::from_utf8_lossy(&output.stdout); - let passed = stdout.lines() - .find(|l| l.contains("PASSED")) - .map(|l| l.contains("tests")) - .unwrap_or(false); - - println!("Shutting down simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("shutdown") - .arg("rust_ios") - .check_status(); - if !passed { - panic!("tests didn't pass"); - } -} - -trait CheckStatus { - fn check_status(&mut self); -} - -impl CheckStatus for Command { - fn check_status(&mut self) { - println!("\trunning: {:?}", self); - assert!(t!(self.status()).success()); - } -} - -fn main() { - let args: Vec = env::args().collect(); - if args.len() != 2 { - println!("Usage: {} ", args[0]); - process::exit(-1); - } - - let test_binary_path = Path::new(&args[1]); - let crate_name = test_binary_path.file_name().unwrap(); - - package_as_simulator_app(crate_name.to_str().unwrap(), test_binary_path); - start_simulator(); - install_app_to_simulator(); - run_app_on_simulator(); -} diff --git a/vendor/libc/ci/landing-page-footer.html b/vendor/libc/ci/landing-page-footer.html deleted file mode 100644 index 941cc8d2b4..0000000000 --- a/vendor/libc/ci/landing-page-footer.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/vendor/libc/ci/landing-page-head.html b/vendor/libc/ci/landing-page-head.html deleted file mode 100644 index fc69fa88eb..0000000000 --- a/vendor/libc/ci/landing-page-head.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -
      diff --git a/vendor/libc/ci/linux-s390x.sh b/vendor/libc/ci/linux-s390x.sh deleted file mode 100644 index 972abeec56..0000000000 --- a/vendor/libc/ci/linux-s390x.sh +++ /dev/null @@ -1,18 +0,0 @@ -set -ex - -mkdir -m 777 /qemu -cd /qemu - -curl -LO https://github.com/qemu/qemu/raw/master/pc-bios/s390-ccw.img -curl -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/kernel.debian -curl -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/initrd.debian - -mv kernel.debian kernel -mv initrd.debian initrd.gz - -mkdir init -cd init -gunzip -c ../initrd.gz | cpio -id -rm ../initrd.gz -cp /usr/s390x-linux-gnu/lib/libgcc_s.so.1 usr/lib/ -chmod a+w . diff --git a/vendor/libc/ci/linux-sparc64.sh b/vendor/libc/ci/linux-sparc64.sh deleted file mode 100644 index 4452b120e1..0000000000 --- a/vendor/libc/ci/linux-sparc64.sh +++ /dev/null @@ -1,17 +0,0 @@ -set -ex - -mkdir -m 777 /qemu -cd /qemu - -curl -LO https://cdimage.debian.org/cdimage/ports/9.0/sparc64/iso-cd/debian-9.0-sparc64-NETINST-1.iso -7z e debian-9.0-sparc64-NETINST-1.iso boot/initrd.gz -7z e debian-9.0-sparc64-NETINST-1.iso boot/sparc64 -mv sparc64 kernel -rm debian-9.0-sparc64-NETINST-1.iso - -mkdir init -cd init -gunzip -c ../initrd.gz | cpio -id -rm ../initrd.gz -cp /usr/sparc64-linux-gnu/lib/libgcc_s.so.1 usr/lib/ -chmod a+w . diff --git a/vendor/libc/ci/run-docker.sh b/vendor/libc/ci/run-docker.sh deleted file mode 100755 index 662a1d491a..0000000000 --- a/vendor/libc/ci/run-docker.sh +++ /dev/null @@ -1,36 +0,0 @@ -# Small script to run tests for a target (or all targets) inside all the -# respective docker images. - -set -ex - -run() { - echo $1 - # use -f so we can use ci/ as build context - docker build -t libc -f ci/docker/$1/Dockerfile ci/ - mkdir -p target - if [ -w /dev/kvm ]; then - kvm="--volume /dev/kvm:/dev/kvm" - fi - docker run \ - --user `id -u`:`id -g` \ - --rm \ - --init \ - --volume $HOME/.cargo:/cargo \ - $kvm \ - --env CARGO_HOME=/cargo \ - --volume `rustc --print sysroot`:/rust:ro \ - --volume `pwd`:/checkout:ro \ - --volume `pwd`/target:/checkout/target \ - --env CARGO_TARGET_DIR=/checkout/target \ - --workdir /checkout \ - libc \ - ci/run.sh $1 -} - -if [ -z "$1" ]; then - for d in `ls ci/docker/`; do - run $d - done -else - run $1 -fi diff --git a/vendor/libc/ci/run-qemu.sh b/vendor/libc/ci/run-qemu.sh deleted file mode 100644 index b2f457df91..0000000000 --- a/vendor/libc/ci/run-qemu.sh +++ /dev/null @@ -1,32 +0,0 @@ -# Initial script which is run inside of all qemu images. The first argument to -# this script (as arranged by the qemu image itself) is the path to where the -# libc crate is mounted. -# -# For qemu images we currently need to install Rust manually as this wasn't done -# by the initial run-travis.sh script -# -# FIXME: feels like run-travis.sh should be responsible for downloading the -# compiler. - -set -ex - -ROOT=$1 -cp -r $ROOT/libc /tmp/libc -cd /tmp/libc - -TARGET=$(cat $ROOT/TARGET) -export CARGO_TARGET_DIR=/tmp - -case $TARGET in - *-openbsd) - pkg_add cargo gcc%4.9 rust - export CC=egcc - ;; - - *) - echo "Unknown target: $TARGET" - exit 1 - ;; -esac - -exec sh ci/run.sh $TARGET diff --git a/vendor/libc/ci/run.sh b/vendor/libc/ci/run.sh deleted file mode 100755 index 27ffc054a0..0000000000 --- a/vendor/libc/ci/run.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh - -# Builds and runs tests for a particular target passed as an argument to this -# script. - -set -ex - -TARGET=$1 - -# If we're going to run tests inside of a qemu image, then we don't need any of -# the scripts below. Instead, download the image, prepare a filesystem which has -# the current state of this repository, and then run the image. -# -# It's assume that all images, when run with two disks, will run the `run.sh` -# script from the second which we place inside. -if [ "$QEMU" != "" ]; then - tmpdir=/tmp/qemu-img-creation - mkdir -p $tmpdir - - if [ -z "${QEMU#*.gz}" ]; then - # image is .gz : download and uncompress it - qemufile=$(echo ${QEMU%.gz} | sed 's/\//__/g') - if [ ! -f $tmpdir/$qemufile ]; then - curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \ - gunzip -d > $tmpdir/$qemufile - fi - elif [ -z "${QEMU#*.xz}" ]; then - # image is .xz : download and uncompress it - qemufile=$(echo ${QEMU%.xz} | sed 's/\//__/g') - if [ ! -f $tmpdir/$qemufile ]; then - curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \ - unxz > $tmpdir/$qemufile - fi - else - # plain qcow2 image: just download it - qemufile=$(echo ${QEMU} | sed 's/\//__/g') - if [ ! -f $tmpdir/$qemufile ]; then - curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU \ - > $tmpdir/$qemufile - fi - fi - - # Create a mount a fresh new filesystem image that we'll later pass to QEMU. - # This will have a `run.sh` script will which use the artifacts inside to run - # on the host. - rm -f $tmpdir/libc-test.img - mkdir $tmpdir/mount - - # Do the standard rigamarole of cross-compiling an executable and then the - # script to run just executes the binary. - cargo build \ - --manifest-path libc-test/Cargo.toml \ - --target $TARGET \ - --test main - rm $CARGO_TARGET_DIR/$TARGET/debug/main-*.d - cp $CARGO_TARGET_DIR/$TARGET/debug/main-* $tmpdir/mount/libc-test - echo 'exec $1/libc-test' > $tmpdir/mount/run.sh - - du -sh $tmpdir/mount - genext2fs \ - --root $tmpdir/mount \ - --size-in-blocks 100000 \ - $tmpdir/libc-test.img - - # Pass -snapshot to prevent tampering with the disk images, this helps when - # running this script in development. The two drives are then passed next, - # first is the OS and second is the one we just made. Next the network is - # configured to work (I'm not entirely sure how), and then finally we turn off - # graphics and redirect the serial console output to out.log. - qemu-system-x86_64 \ - -m 1024 \ - -snapshot \ - -drive if=virtio,file=$tmpdir/$qemufile \ - -drive if=virtio,file=$tmpdir/libc-test.img \ - -net nic,model=virtio \ - -net user \ - -nographic \ - -vga none 2>&1 | tee $CARGO_TARGET_DIR/out.log - exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log -fi - -# FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release -# See https://github.com/rust-lang/rust/issues/45417 -opt= -if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then - opt="--release" -fi - -# Building with --no-default-features is currently broken on rumprun because we -# need cfg(target_vendor), which is currently unstable. -if [ "$TARGET" != "x86_64-rumprun-netbsd" ]; then - cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET -fi -# Test the #[repr(align(x))] feature if this is building on Rust >= 1.25 -if [ $(rustc --version | sed -E 's/^rustc 1\.([0-9]*)\..*/\1/') -ge 25 ]; then - cargo test $opt --features align --manifest-path libc-test/Cargo.toml --target $TARGET -fi -exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET diff --git a/vendor/libc/ci/runtest-android.rs b/vendor/libc/ci/runtest-android.rs deleted file mode 100644 index a8f8db83ff..0000000000 --- a/vendor/libc/ci/runtest-android.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::env; -use std::process::Command; -use std::path::{Path, PathBuf}; - -fn main() { - assert_eq!(env::args_os().len(), 2); - let test = PathBuf::from(env::args_os().nth(1).unwrap()); - let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap()); - - let status = Command::new("adb") - .arg("wait-for-device") - .status() - .expect("failed to run rumprun-bake"); - assert!(status.success()); - - let status = Command::new("adb") - .arg("push") - .arg(&test) - .arg(&dst) - .status() - .expect("failed to run rumprun-bake"); - assert!(status.success()); - - let output = Command::new("adb") - .arg("shell") - .arg(&dst) - .output() - .expect("failed to run rumprun-bake"); - assert!(status.success()); - - println!("status: {}\nstdout ---\n{}\nstderr ---\n{}", - output.status, - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr)); - - let stdout = String::from_utf8_lossy(&output.stdout); - let mut lines = stdout.lines().filter(|l| l.starts_with("PASSED ")); - if !lines.any(|l| l.contains(" tests")) { - panic!("failed to find successful test run"); - } -} diff --git a/vendor/libc/ci/style.rs b/vendor/libc/ci/style.rs deleted file mode 100644 index bf31576b90..0000000000 --- a/vendor/libc/ci/style.rs +++ /dev/null @@ -1,206 +0,0 @@ -//! Simple script to verify the coding style of this library -//! -//! ## How to run -//! -//! The first argument to this script is the directory to run on, so running -//! this script should be as simple as: -//! -//! ```notrust -//! rustc ci/style.rs -//! ./style src -//! ``` -//! -//! ## Guidelines -//! -//! The current style is: -//! -//! * No trailing whitespace -//! * No tabs -//! * 80-character lines -//! * `extern` instead of `extern "C"` -//! * Specific module layout: -//! 1. use directives -//! 2. typedefs -//! 3. structs -//! 4. constants -//! 5. f! { ... } functions -//! 6. extern functions -//! 7. modules + pub use -//! -//! Things not verified: -//! -//! * alignment -//! * 4-space tabs -//! * leading colons on paths - -use std::env; -use std::fs; -use std::io::prelude::*; -use std::path::Path; - -macro_rules! t { - ($e:expr) => (match $e { - Ok(e) => e, - Err(e) => panic!("{} failed with {}", stringify!($e), e), - }) -} - -fn main() { - let arg = env::args().skip(1).next().unwrap_or(".".to_string()); - - let mut errors = Errors { errs: false }; - walk(Path::new(&arg), &mut errors); - - if errors.errs { - panic!("found some lint errors"); - } else { - println!("good style!"); - } -} - -fn walk(path: &Path, err: &mut Errors) { - for entry in t!(path.read_dir()).map(|e| t!(e)) { - let path = entry.path(); - if t!(entry.file_type()).is_dir() { - walk(&path, err); - continue - } - - let name = entry.file_name().into_string().unwrap(); - match &name[..] { - n if !n.ends_with(".rs") => continue, - - "dox.rs" | - "lib.rs" | - "macros.rs" => continue, - - _ => {} - } - - let mut contents = String::new(); - t!(t!(fs::File::open(&path)).read_to_string(&mut contents)); - - check_style(&contents, &path, err); - } -} - -struct Errors { - errs: bool, -} - -#[derive(Clone, Copy, PartialEq)] -enum State { - Start, - Imports, - Typedefs, - Structs, - Constants, - FunctionDefinitions, - Functions, - Modules, -} - -fn check_style(file: &str, path: &Path, err: &mut Errors) { - let mut state = State::Start; - let mut s_macros = 0; - let mut f_macros = 0; - let mut prev_blank = false; - - for (i, line) in file.lines().enumerate() { - if line == "" { - if prev_blank { - err.error(path, i, "double blank line"); - } - prev_blank = true; - } else { - prev_blank = false; - } - if line != line.trim_right() { - err.error(path, i, "trailing whitespace"); - } - if line.contains("\t") { - err.error(path, i, "tab character"); - } - if line.len() > 80 { - err.error(path, i, "line longer than 80 chars"); - } - if line.contains("extern \"C\"") { - err.error(path, i, "use `extern` instead of `extern \"C\""); - } - if line.contains("#[cfg(") && !line.contains(" if ") - && !line.contains("target_endian") - { - if state != State::Structs { - err.error(path, i, "use cfg_if! and submodules \ - instead of #[cfg]"); - } - } - - let line = line.trim_left(); - let is_pub = line.starts_with("pub "); - let line = if is_pub {&line[4..]} else {line}; - - let line_state = if line.starts_with("use ") { - if is_pub { - State::Modules - } else { - State::Imports - } - } else if line.starts_with("const ") { - State::Constants - } else if line.starts_with("type ") { - State::Typedefs - } else if line.starts_with("s! {") { - s_macros += 1; - State::Structs - } else if line.starts_with("f! {") { - f_macros += 1; - State::FunctionDefinitions - } else if line.starts_with("extern ") { - State::Functions - } else if line.starts_with("mod ") { - State::Modules - } else { - continue - }; - - if state as usize > line_state as usize { - err.error(path, i, &format!("{} found after {} when \ - it belongs before", - line_state.desc(), state.desc())); - } - - if f_macros == 2 { - f_macros += 1; - err.error(path, i, "multiple f! macros in one module"); - } - if s_macros == 2 { - s_macros += 1; - err.error(path, i, "multiple s! macros in one module"); - } - - state = line_state; - } -} - -impl State { - fn desc(&self) -> &str { - match *self { - State::Start => "start", - State::Imports => "import", - State::Typedefs => "typedef", - State::Structs => "struct", - State::Constants => "constant", - State::FunctionDefinitions => "function definition", - State::Functions => "extern function", - State::Modules => "module", - } - } -} - -impl Errors { - fn error(&mut self, path: &Path, line: usize, msg: &str) { - self.errs = true; - println!("{}:{} - {}", path.display(), line + 1, msg); - } -} diff --git a/vendor/libc/ci/test-runner-linux b/vendor/libc/ci/test-runner-linux deleted file mode 100755 index 5f1fb237c2..0000000000 --- a/vendor/libc/ci/test-runner-linux +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -set -e - -arch=$1 -prog=$2 - -cd /qemu/init -cp -f $2 prog -find . | cpio --create --format='newc' --quiet | gzip > ../initrd.gz -cd .. - -timeout 30s qemu-system-$arch \ - -m 1024 \ - -nographic \ - -kernel kernel \ - -initrd initrd.gz \ - -append init=/prog > output || true - -# remove kernel messages -tr -d '\r' < output | egrep -v '^\[' - -grep PASSED output > /dev/null diff --git a/vendor/libc/src/cloudabi/mod.rs b/vendor/libc/src/cloudabi/mod.rs index e506414e34..df11de002e 100644 --- a/vendor/libc/src/cloudabi/mod.rs +++ b/vendor/libc/src/cloudabi/mod.rs @@ -1,3 +1,33 @@ +use dox::Option; + +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 in_addr_t = u32; pub type in_port_t = u16; pub type pthread_key_t = usize; @@ -56,6 +86,9 @@ s! { } } +pub const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + pub const _SC_NPROCESSORS_ONLN: ::c_int = 52; pub const _SC_PAGESIZE: ::c_int = 54; @@ -89,7 +122,114 @@ pub const PTHREAD_STACK_MIN: ::size_t = 1024; pub const SOCK_DGRAM: ::c_int = 128; pub const SOCK_STREAM: ::c_int = 130; +pub enum FILE {} +pub enum fpos_t {} // TODO: fill this out with a struct + 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 getline (lineptr: *mut *mut c_char, n: *mut size_t, + stream: *mut FILE) -> ssize_t; + + 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 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 arc4random_buf(buf: *const ::c_void, len: ::size_t); pub fn freeaddrinfo(res: *mut addrinfo); pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; @@ -164,3 +304,21 @@ cfg_if! { // Unknown target_arch } } + +cfg_if! { + if #[cfg(core_cvoid)] { + pub use core::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)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} diff --git a/vendor/libc/src/dox.rs b/vendor/libc/src/dox.rs index 779641b3cc..33a9c166f4 100644 --- a/vendor/libc/src/dox.rs +++ b/vendor/libc/src/dox.rs @@ -2,10 +2,10 @@ pub use self::imp::*; #[cfg(not(cross_platform_docs))] mod imp { - pub use core::option::Option; pub use core::clone::Clone; pub use core::marker::Copy; pub use core::mem; + pub use core::option::Option; } #[cfg(cross_platform_docs)] @@ -16,17 +16,23 @@ mod imp { } impl Copy for Option {} impl Clone for Option { - fn clone(&self) -> Option { loop {} } + fn clone(&self) -> Option { + loop {} + } } impl Copy for *mut T {} impl Clone for *mut T { - fn clone(&self) -> *mut T { loop {} } + fn clone(&self) -> *mut T { + loop {} + } } impl Copy for *const T {} impl Clone for *const T { - fn clone(&self) -> *const T { loop {} } + fn clone(&self) -> *const T { + loop {} + } } pub trait Clone { @@ -47,52 +53,52 @@ mod imp { pub trait Sized {} macro_rules! each_int { - ($mac:ident) => ( + ($mac:ident) => { $mac!(u8); $mac!(u16); $mac!(u32); $mac!(u64); $mac!(usize); each_signed_int!($mac); - ) + }; } macro_rules! each_signed_int { - ($mac:ident) => ( + ($mac:ident) => { $mac!(i8); $mac!(i16); $mac!(i32); $mac!(i64); $mac!(isize); - ) + }; } #[lang = "div"] - pub trait Div { + pub trait Div { type Output; fn div(self, rhs: RHS) -> Self::Output; } #[lang = "shl"] - pub trait Shl { + pub trait Shl { type Output; fn shl(self, rhs: RHS) -> Self::Output; } #[lang = "mul"] - pub trait Mul { + pub trait Mul { type Output; fn mul(self, rhs: RHS) -> Self::Output; } #[lang = "sub"] - pub trait Sub { + pub trait Sub { type Output; fn sub(self, rhs: RHS) -> Self::Output; } #[lang = "bitand"] - pub trait BitAnd { + pub trait BitAnd { type Output; fn bitand(self, rhs: RHS) -> Self::Output; } @@ -103,7 +109,7 @@ mod imp { } #[lang = "bitor"] - pub trait BitOr { + pub trait BitOr { type Output; fn bitor(self, rhs: RHS) -> Self::Output; } @@ -114,7 +120,7 @@ mod imp { } #[lang = "bitxor"] - pub trait BitXor { + pub trait BitXor { type Output; fn bitxor(self, rhs: RHS) -> Self::Output; } @@ -203,7 +209,11 @@ mod imp { each_int!(impl_traits); pub mod mem { - pub fn size_of_val(_: &T) -> usize { 4 } - pub const fn size_of() -> usize { 4 } + pub fn size_of_val(_: &T) -> usize { + 4 + } + pub const fn size_of() -> usize { + 4 + } } } diff --git a/vendor/libc/src/fuchsia/aarch64.rs b/vendor/libc/src/fuchsia/aarch64.rs index 157d3d6e9e..572f8c1ce3 100644 --- a/vendor/libc/src/fuchsia/aarch64.rs +++ b/vendor/libc/src/fuchsia/aarch64.rs @@ -1,8 +1,8 @@ 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; +pub type nlink_t = ::c_ulong; +pub type blksize_t = ::c_long; s! { pub struct stat { diff --git a/vendor/libc/src/fuchsia/mod.rs b/vendor/libc/src/fuchsia/mod.rs index e103292979..e785fabf8e 100644 --- a/vendor/libc/src/fuchsia/mod.rs +++ b/vendor/libc/src/fuchsia/mod.rs @@ -7,6 +7,34 @@ use dox::{mem, Option}; // 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; +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 pid_t = i32; pub type uid_t = u32; pub type gid_t = u32; @@ -97,16 +125,13 @@ s! { pub tv_usec: suseconds_t, } - // linux x32 compatibility - // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437 pub struct timespec { pub tv_sec: time_t, - #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] - pub tv_nsec: i64, - #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] pub tv_nsec: ::c_long, } + // FIXME: the rlimit and rusage related functions and types don't exist + // within zircon. Are there reasons for keeping them around? pub struct rlimit { pub rlim_cur: rlim_t, pub rlim_max: rlim_t, @@ -166,11 +191,8 @@ s! { pub s_addr: in_addr_t, } - #[cfg_attr(feature = "align", repr(align(4)))] pub struct in6_addr { pub s6_addr: [u8; 16], - #[cfg(not(feature = "align"))] - __align: [u32; 0], } pub struct ip_mreq { @@ -180,9 +202,6 @@ s! { pub struct ipv6_mreq { pub ipv6mr_multiaddr: in6_addr, - #[cfg(target_os = "android")] - pub ipv6mr_interface: ::c_int, - #[cfg(not(target_os = "android"))] pub ipv6mr_interface: ::c_uint, } @@ -400,13 +419,9 @@ s! { pub struct sched_param { pub sched_priority: ::c_int, - #[cfg(target_env = "musl")] pub sched_ss_low_priority: ::c_int, - #[cfg(target_env = "musl")] pub sched_ss_repl_period: ::timespec, - #[cfg(target_env = "musl")] pub sched_ss_init_budget: ::timespec, - #[cfg(target_env = "musl")] pub sched_ss_max_repl: ::c_int, } @@ -417,11 +432,6 @@ s! { pub dli_saddr: *mut ::c_void, } - #[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, @@ -467,13 +477,9 @@ s! { 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 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 dirent { @@ -522,30 +528,22 @@ s! { #[cfg_attr(all(feature = "align", target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", + any(target_arch = "arm", target_arch = "x86_64")), repr(align(4)))] #[cfg_attr(all(feature = "align", any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", + not(any(target_arch = "arm", target_arch = "x86_64")))), repr(align(8)))] pub struct pthread_mutex_t { #[cfg(all(not(feature = "align"), - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", + any(target_arch = "arm", all(target_arch = "x86_64", target_pointer_width = "32"))))] __align: [::c_long; 0], #[cfg(not(any(feature = "align", - target_arch = "mips", target_arch = "arm", - target_arch = "powerpc", all(target_arch = "x86_64", target_pointer_width = "32"))))] __align: [::c_longlong; 0], @@ -554,30 +552,22 @@ s! { #[cfg_attr(all(feature = "align", target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", + any(target_arch = "arm", target_arch = "x86_64")), repr(align(4)))] #[cfg_attr(all(feature = "align", any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", + not(any(target_arch = "arm", target_arch = "x86_64")))), repr(align(8)))] pub struct pthread_rwlock_t { #[cfg(all(not(feature = "align"), - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc", + any(target_arch = "arm", all(target_arch = "x86_64", target_pointer_width = "32"))))] __align: [::c_long; 0], #[cfg(not(any(feature = "align", - target_arch = "mips", target_arch = "arm", - target_arch = "powerpc", all(target_arch = "x86_64", target_pointer_width = "32"))))] __align: [::c_longlong; 0], @@ -586,29 +576,21 @@ s! { #[cfg_attr(all(feature = "align", any(target_pointer_width = "32", - target_arch = "x86_64", target_arch = "powerpc64", - target_arch = "mips64", target_arch = "s390x", - target_arch = "sparc64", + target_arch = "x86_64", all(target_arch = "aarch64", target_env = "musl"))), repr(align(4)))] #[cfg_attr(all(feature = "align", not(any(target_pointer_width = "32", - target_arch = "x86_64", target_arch = "powerpc64", - target_arch = "mips64", target_arch = "s390x", - target_arch = "sparc64", + target_arch = "x86_64", all(target_arch = "aarch64", target_env = "musl")))), repr(align(8)))] pub struct pthread_mutexattr_t { #[cfg(all(not(features = "align"), - any(target_arch = "x86_64", target_arch = "powerpc64", - target_arch = "mips64", target_arch = "s390x", - target_arch = "sparc64", + any(target_arch = "x86_64", all(target_arch = "aarch64", target_env = "musl"))))] __align: [::c_int; 0], #[cfg(all(not(features = "align"), - not(any(target_arch = "x86_64", target_arch = "powerpc64", - target_arch = "mips64", target_arch = "s390x", - target_arch = "sparc64", + not(any(target_arch = "x86_64", all(target_arch = "aarch64", target_env = "musl")))))] __align: [::c_long; 0], size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T], @@ -731,7 +713,12 @@ s! { pub ssi_utime: ::uint64_t, pub ssi_stime: ::uint64_t, pub ssi_addr: ::uint64_t, - _pad: [::uint8_t; 48], + 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 { @@ -1090,6 +1077,9 @@ s! { // PUB_CONST +pub const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub const SIG_IGN: sighandler_t = 1 as sighandler_t; pub const SIG_ERR: sighandler_t = !0 as sighandler_t; @@ -3052,7 +3042,110 @@ f! { #[link(name = "fdio")] extern {} +pub enum FILE {} +pub enum fpos_t {} // TODO: fill this out with a struct + 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 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 getpwnam(name: *const ::c_char) -> *mut passwd; pub fn getpwuid(uid: ::uid_t) -> *mut passwd; @@ -3192,6 +3285,7 @@ extern { -> ::ssize_t; pub fn rmdir(path: *const c_char) -> ::c_int; pub fn seteuid(uid: uid_t) -> ::c_int; + pub fn setegid(gid: gid_t) -> ::c_int; pub fn setgid(gid: gid_t) -> ::c_int; pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; pub fn setsid() -> pid_t; @@ -3987,9 +4081,6 @@ 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::*; @@ -3997,3 +4088,21 @@ cfg_if! { // Unknown target_arch } } + +cfg_if! { + if #[cfg(core_cvoid)] { + pub use core::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)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} diff --git a/vendor/libc/src/fuchsia/powerpc64.rs b/vendor/libc/src/fuchsia/powerpc64.rs deleted file mode 100644 index 112cd43514..0000000000 --- a/vendor/libc/src/fuchsia/powerpc64.rs +++ /dev/null @@ -1,79 +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 SYS_pivot_root: ::c_long = 203; -pub const SYS_gettid: ::c_long = 207; -pub const SYS_perf_event_open: ::c_long = 319; -pub const SYS_memfd_create: ::c_long = 360; - -pub const MAP_32BIT: ::c_int = 0x0040; - -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; - -// Syscall table -pub const SYS_renameat2: ::c_long = 357; diff --git a/vendor/libc/src/lib.rs b/vendor/libc/src/lib.rs index b6b5cdb161..03e78041ab 100644 --- a/vendor/libc/src/lib.rs +++ b/vendor/libc/src/lib.rs @@ -15,274 +15,165 @@ #![crate_name = "libc"] #![cfg_attr(cross_platform_docs, feature(no_core, lang_items, const_fn))] #![cfg_attr(cross_platform_docs, no_core)] -#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", - html_favicon_url = "https://doc.rust-lang.org/favicon.ico")] - -#![cfg_attr(all(target_os = "linux", target_arch = "x86_64"), doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-linux-gnu" -))] -#![cfg_attr(all(target_os = "linux", target_arch = "x86"), doc( - html_root_url = "https://rust-lang.github.io/libc/i686-unknown-linux-gnu" -))] -#![cfg_attr(all(target_os = "linux", target_arch = "arm"), doc( - html_root_url = "https://rust-lang.github.io/libc/arm-unknown-linux-gnueabihf" -))] -#![cfg_attr(all(target_os = "linux", target_arch = "mips"), doc( - html_root_url = "https://rust-lang.github.io/libc/mips-unknown-linux-gnu" -))] -#![cfg_attr(all(target_os = "linux", target_arch = "aarch64"), doc( - html_root_url = "https://rust-lang.github.io/libc/aarch64-unknown-linux-gnu" -))] -#![cfg_attr(all(target_os = "linux", target_env = "musl"), doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-linux-musl" -))] -#![cfg_attr(all(target_os = "macos", target_arch = "x86_64"), doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-apple-darwin" -))] -#![cfg_attr(all(target_os = "macos", target_arch = "x86"), doc( - html_root_url = "https://rust-lang.github.io/libc/i686-apple-darwin" -))] -#![cfg_attr(all(windows, target_arch = "x86_64", target_env = "gnu"), doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-pc-windows-gnu" -))] -#![cfg_attr(all(windows, target_arch = "x86", target_env = "gnu"), doc( - html_root_url = "https://rust-lang.github.io/libc/i686-pc-windows-gnu" -))] -#![cfg_attr(all(windows, target_arch = "x86_64", target_env = "msvc"), doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-pc-windows-msvc" -))] -#![cfg_attr(all(windows, target_arch = "x86", target_env = "msvc"), doc( - html_root_url = "https://rust-lang.github.io/libc/i686-pc-windows-msvc" -))] -#![cfg_attr(target_os = "android", doc( - html_root_url = "https://rust-lang.github.io/libc/arm-linux-androideabi" -))] -#![cfg_attr(target_os = "freebsd", doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-freebsd" -))] -#![cfg_attr(target_os = "openbsd", doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-openbsd" -))] -#![cfg_attr(target_os = "bitrig", doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-bitrig" -))] -#![cfg_attr(target_os = "netbsd", doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-netbsd" -))] -#![cfg_attr(target_os = "dragonfly", doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-dragonfly" -))] -#![cfg_attr(target_os = "solaris", doc( - html_root_url = "https://rust-lang.github.io/libc/x86_64-sun-solaris" -))] -#![cfg_attr(all(target_os = "emscripten", target_arch = "asmjs"), doc( - html_root_url = "https://rust-lang.github.io/libc/asmjs-unknown-emscripten" -))] -#![cfg_attr(all(target_os = "emscripten", target_arch = "wasm32"), doc( - html_root_url = "https://rust-lang.github.io/libc/wasm32-unknown-emscripten" -))] -#![cfg_attr(all(target_os = "linux", target_arch = "sparc64"), doc( - html_root_url = "https://rust-lang.github.io/libc/sparc64-unknown-linux-gnu" -))] - +#![doc( + html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", + html_favicon_url = "https://doc.rust-lang.org/favicon.ico" +)] +#![cfg_attr( + all(target_os = "linux", target_arch = "x86_64"), + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-linux-gnu" + ) +)] +#![cfg_attr( + all(target_os = "linux", target_arch = "x86"), + doc( + html_root_url = "https://rust-lang.github.io/libc/i686-unknown-linux-gnu" + ) +)] +#![cfg_attr( + all(target_os = "linux", target_arch = "arm"), + doc( + html_root_url = "https://rust-lang.github.io/libc/arm-unknown-linux-gnueabihf" + ) +)] +#![cfg_attr( + all(target_os = "linux", target_arch = "mips"), + doc( + html_root_url = "https://rust-lang.github.io/libc/mips-unknown-linux-gnu" + ) +)] +#![cfg_attr( + all(target_os = "linux", target_arch = "aarch64"), + doc( + html_root_url = "https://rust-lang.github.io/libc/aarch64-unknown-linux-gnu" + ) +)] +#![cfg_attr( + all(target_os = "linux", target_env = "musl"), + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-linux-musl" + ) +)] +#![cfg_attr( + all(target_os = "macos", target_arch = "x86_64"), + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-apple-darwin" + ) +)] +#![cfg_attr( + all(target_os = "macos", target_arch = "x86"), + doc(html_root_url = "https://rust-lang.github.io/libc/i686-apple-darwin") +)] +#![cfg_attr( + all(windows, target_arch = "x86_64", target_env = "gnu"), + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-pc-windows-gnu" + ) +)] +#![cfg_attr( + all(windows, target_arch = "x86", target_env = "gnu"), + doc( + html_root_url = "https://rust-lang.github.io/libc/i686-pc-windows-gnu" + ) +)] +#![cfg_attr( + all(windows, target_arch = "x86_64", target_env = "msvc"), + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-pc-windows-msvc" + ) +)] +#![cfg_attr( + all(windows, target_arch = "x86", target_env = "msvc"), + doc( + html_root_url = "https://rust-lang.github.io/libc/i686-pc-windows-msvc" + ) +)] +#![cfg_attr( + target_os = "android", + doc( + html_root_url = "https://rust-lang.github.io/libc/arm-linux-androideabi" + ) +)] +#![cfg_attr( + target_os = "freebsd", + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-freebsd" + ) +)] +#![cfg_attr( + target_os = "openbsd", + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-openbsd" + ) +)] +#![cfg_attr( + target_os = "bitrig", + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-bitrig" + ) +)] +#![cfg_attr( + target_os = "netbsd", + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-netbsd" + ) +)] +#![cfg_attr( + target_os = "dragonfly", + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-unknown-dragonfly" + ) +)] +#![cfg_attr( + target_os = "solaris", + doc( + html_root_url = "https://rust-lang.github.io/libc/x86_64-sun-solaris" + ) +)] +#![cfg_attr( + all(target_os = "emscripten", target_arch = "asmjs"), + doc( + html_root_url = "https://rust-lang.github.io/libc/asmjs-unknown-emscripten" + ) +)] +#![cfg_attr( + all(target_os = "emscripten", target_arch = "wasm32"), + doc( + html_root_url = "https://rust-lang.github.io/libc/wasm32-unknown-emscripten" + ) +)] +#![cfg_attr( + all(target_os = "linux", target_arch = "sparc64"), + doc( + html_root_url = "https://rust-lang.github.io/libc/sparc64-unknown-linux-gnu" + ) +)] // Attributes needed when building as part of the standard library -#![cfg_attr(feature = "stdbuild", feature(staged_api, cfg_target_vendor))] -#![cfg_attr(feature = "stdbuild", feature(link_cfg, repr_packed))] -#![cfg_attr(feature = "stdbuild", allow(warnings))] -#![cfg_attr(feature = "stdbuild", unstable(feature = "libc", - reason = "use `libc` from crates.io", - issue = "27783"))] - -#![cfg_attr(not(feature = "use_std"), no_std)] +#![cfg_attr(feature = "rustc-dep-of-std", feature(cfg_target_vendor))] +#![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, repr_packed))] +#![cfg_attr(feature = "rustc-dep-of-std", feature(no_core))] +#![cfg_attr(feature = "rustc-dep-of-std", no_core)] +#![cfg_attr(feature = "rustc-dep-of-std", allow(warnings))] +#![cfg_attr(not(any(feature = "use_std", feature = "rustc-dep-of-std")), no_std)] #[cfg(all(not(cross_platform_docs), feature = "use_std"))] extern crate std as core; -#[macro_use] mod macros; +#[cfg(feature = "rustc-dep-of-std")] +extern crate rustc_std_workspace_core as core; +#[cfg(feature = "rustc-dep-of-std")] +#[allow(unused_imports)] +use core::iter; +#[cfg(feature = "rustc-dep-of-std")] +#[allow(unused_imports)] +use core::option; + +#[macro_use] +mod macros; + mod dox; -cfg_if! { - if #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] { - // empty ... - } 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)] - pub enum c_void { - // Two dummy variants so the #[repr] attribute can be used. - #[doc(hidden)] - __variant1, - #[doc(hidden)] - __variant2, - } - - 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 enum FILE {} - pub enum fpos_t {} // TODO: fill this out with a struct - - pub const INT_MIN: c_int = -2147483648; - pub const INT_MAX: c_int = 2147483647; - - 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; - - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "fopen$UNIX2003")] - pub fn fopen(filename: *const c_char, - mode: *const c_char) -> *mut FILE; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "freopen$UNIX2003")] - 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; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "fputs$UNIX2003")] - 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; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "fwrite$UNIX2003")] - 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); - #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] - pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] - 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; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "strtod$UNIX2003")] - 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; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "system$UNIX2003")] - 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 strlen(cs: *const c_char) -> size_t; - pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; - #[cfg_attr(all(target_os = "macos", target_arch = "x86"), - link_name = "strerror$UNIX2003")] - 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; - } - - // These are all inline functions on android, so they end up just being entirely - // missing on that platform. - #[cfg(not(target_os = "android"))] - 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); - } - } -} - cfg_if! { if #[cfg(windows)] { mod windows; @@ -296,10 +187,16 @@ cfg_if! { } else if #[cfg(target_os = "fuchsia")] { mod fuchsia; pub use fuchsia::*; + } else if #[cfg(target_os = "switch")] { + mod switch; + pub use switch::*; } else if #[cfg(unix)] { mod unix; pub use unix::*; - } else { - // Unknown target_family + } else if #[cfg(target_env = "sgx")] { + mod sgx; + pub use sgx::*; + } else { + // non-supported targets: empty... } } diff --git a/vendor/libc/src/macros.rs b/vendor/libc/src/macros.rs index f48ad45941..77205788c8 100644 --- a/vendor/libc/src/macros.rs +++ b/vendor/libc/src/macros.rs @@ -48,6 +48,7 @@ macro_rules! s { )*) } +#[allow(unused_macros)] macro_rules! f { ($(pub fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { $($body:stmt);* @@ -67,7 +68,9 @@ macro_rules! f { } macro_rules! __item { - ($i:item) => ($i) + ($i:item) => { + $i + }; } #[allow(unused_macros)] diff --git a/vendor/libc/src/redox/mod.rs b/vendor/libc/src/redox/mod.rs index e32c4b385b..9f68632a0f 100644 --- a/vendor/libc/src/redox/mod.rs +++ b/vendor/libc/src/redox/mod.rs @@ -1,3 +1,32 @@ + +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; @@ -25,6 +54,9 @@ s! { } } +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; @@ -117,16 +149,128 @@ pub const SIGIO: ::c_int = 29; pub const SIGPWR: ::c_int = 30; pub const SIGSYS: ::c_int = 31; +pub enum FILE {} +pub enum fpos_t {} // TODO: fill this out with a struct + 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 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 read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) - -> ::ssize_t; + 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; - pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; - pub fn close(fd: ::c_int) -> ::c_int; } #[link(name = "c")] @@ -136,3 +280,21 @@ extern {} pub use self::net::*; mod net; + +cfg_if! { + if #[cfg(core_cvoid)] { + pub use core::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)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} diff --git a/vendor/libc/src/sgx.rs b/vendor/libc/src/sgx.rs new file mode 100644 index 0000000000..045133399b --- /dev/null +++ b/vendor/libc/src/sgx.rs @@ -0,0 +1,54 @@ +//! 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; +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 const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + +cfg_if! { + if #[cfg(core_cvoid)] { + pub use core::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)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} diff --git a/vendor/libc/src/switch.rs b/vendor/libc/src/switch.rs new file mode 100644 index 0000000000..e2d9b491cb --- /dev/null +++ b/vendor/libc/src/switch.rs @@ -0,0 +1,57 @@ +//! 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; +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 off_t = i64; +pub type c_char = u8; +pub type c_long = i64; +pub type c_ulong = u64; +pub type wchar_t = u32; + +pub const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + +cfg_if! { + if #[cfg(core_cvoid)] { + pub use core::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)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} + diff --git a/vendor/libc/src/unix/bsd/apple/b32.rs b/vendor/libc/src/unix/bsd/apple/b32.rs index 5dea472ccb..907ab02df4 100644 --- a/vendor/libc/src/unix/bsd/apple/b32.rs +++ b/vendor/libc/src/unix/bsd/apple/b32.rs @@ -58,3 +58,9 @@ pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12; pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459; pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458; + +extern { + pub fn exchangedata(path1: *const ::c_char, + path2: *const ::c_char, + options: ::c_ulong) -> ::c_int; +} diff --git a/vendor/libc/src/unix/bsd/apple/b64.rs b/vendor/libc/src/unix/bsd/apple/b64.rs index ca98f20952..8e8c87dd28 100644 --- a/vendor/libc/src/unix/bsd/apple/b64.rs +++ b/vendor/libc/src/unix/bsd/apple/b64.rs @@ -63,3 +63,9 @@ pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16; pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458; + +extern { + pub fn exchangedata(path1: *const ::c_char, + path2: *const ::c_char, + options: ::c_uint) -> ::c_int; +} diff --git a/vendor/libc/src/unix/bsd/apple/mod.rs b/vendor/libc/src/unix/bsd/apple/mod.rs index cf48528b4a..bb07cc4872 100644 --- a/vendor/libc/src/unix/bsd/apple/mod.rs +++ b/vendor/libc/src/unix/bsd/apple/mod.rs @@ -245,7 +245,7 @@ s! { pub f_reserved: [::uint32_t; 8], } - #[cfg_attr(feature = "stdbuild", repr(packed(4)))] + #[cfg_attr(feature = "rustc-dep-of-std", repr(packed(4)))] pub struct kevent { pub ident: ::uintptr_t, pub filter: ::int16_t, @@ -535,7 +535,36 @@ s! { pub _key: ::key_t, } - #[cfg_attr(feature = "stdbuild", repr(packed(4)))] + // sys/sem.h + + pub struct sembuf { + pub sem_num: ::c_ushort, + pub sem_op: ::c_short, + pub sem_flg: ::c_short, + } + + #[cfg_attr(feature = "rustc-dep-of-std", repr(packed(4)))] + 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_nsems: ::c_ushort, + pub sem_otime: ::time_t, + pub sem_pad1: ::int32_t, + pub sem_ctime: ::time_t, + pub sem_pad2: ::int32_t, + pub sem_pad3: [::int32_t; 4], + } + + pub union semun { + pub val: ::c_int, + pub buf: *mut semid_ds, + pub array: *mut ::c_ushort, + } + + // sys/shm.h + + #[cfg_attr(feature = "rustc-dep-of-std", repr(packed(4)))] pub struct shmid_ds { pub shm_perm: ipc_perm, pub shm_segsz: ::size_t, @@ -747,11 +776,32 @@ pub const PROT_READ: ::c_int = 1; pub const PROT_WRITE: ::c_int = 2; pub const PROT_EXEC: ::c_int = 4; +pub const PT_TRACE_ME: ::c_int = 0; +pub const PT_READ_I: ::c_int = 1; +pub const PT_READ_D: ::c_int = 2; +pub const PT_READ_U: ::c_int = 3; +pub const PT_WRITE_I: ::c_int = 4; +pub const PT_WRITE_D: ::c_int = 5; +pub const PT_WRITE_U: ::c_int = 6; +pub const PT_CONTINUE: ::c_int = 7; +pub const PT_KILL: ::c_int = 8; +pub const PT_STEP: ::c_int = 9; +pub const PT_ATTACH: ::c_int = 10; +pub const PT_DETACH: ::c_int = 11; +pub const PT_SIGEXC: ::c_int = 12; +pub const PT_THUPDATE: ::c_int = 13; +pub const PT_ATTACHEXC: ::c_int = 14; + +pub const PT_FORCEQUOTA: ::c_int = 30; +pub const PT_DENY_ATTACH: ::c_int = 31; +pub const PT_FIRSTMACH: ::c_int = 32; + 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_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; @@ -765,8 +815,8 @@ 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 = 0xff07401b; -pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401b; +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 | @@ -1528,7 +1578,8 @@ pub const IPV6_LEAVE_GROUP: ::c_int = 13; pub const IPV6_PKTINFO: ::c_int = 46; pub const IPV6_RECVPKTINFO: ::c_int = 61; -pub const TCP_NODELAY: ::c_int = 0x01; +pub const TCP_NOPUSH: ::c_int = 4; +pub const TCP_NOOPT: ::c_int = 8; pub const TCP_KEEPALIVE: ::c_int = 0x10; pub const SOL_LOCAL: ::c_int = 0; @@ -2275,6 +2326,17 @@ pub const IPC_R: ::c_int = 0x100; pub const IPC_W: ::c_int = 0x80; pub const IPC_M: ::c_int = 0x1000; +// sys/sem.h +pub const SEM_UNDO: ::c_int = 0o10000; + +pub const GETNCNT: ::c_int = 3; +pub const GETPID: ::c_int = 4; +pub const GETVAL: ::c_int = 5; +pub const GETALL: ::c_int = 6; +pub const GETZCNT: ::c_int = 7; +pub const SETVAL: ::c_int = 8; +pub const SETALL: ::c_int = 9; + // sys/shm.h pub const SHM_RDONLY: ::c_int = 0x1000; pub const SHM_RND: ::c_int = 0x2000; @@ -2282,6 +2344,20 @@ pub const SHMLBA: ::c_int = 4096; pub const SHM_R: ::c_int = IPC_R; pub const SHM_W: ::c_int = IPC_W; +// Flags for chflags(2) +pub const UF_SETTABLE: ::c_uint = 0x0000ffff; +pub const UF_NODUMP: ::c_uint = 0x00000001; +pub const UF_IMMUTABLE: ::c_uint = 0x00000002; +pub const UF_APPEND: ::c_uint = 0x00000004; +pub const UF_OPAQUE: ::c_uint = 0x00000008; +pub const UF_COMPRESSED: ::c_uint = 0x00000020; +pub const UF_TRACKED: ::c_uint = 0x00000040; +pub const SF_SETTABLE: ::c_uint = 0xffff0000; +pub const SF_ARCHIVED: ::c_uint = 0x00010000; +pub const SF_IMMUTABLE: ::c_uint = 0x00020000; +pub const SF_APPEND: ::c_uint = 0x00040000; +pub const UF_HIDDEN: ::c_uint = 0x00008000; + f! { pub fn WSTOPSIG(status: ::c_int) -> ::c_int { status >> 8 @@ -2315,6 +2391,8 @@ extern { 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 chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int; + pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::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 lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, @@ -2349,7 +2427,15 @@ extern { link_name = "mprotect$UNIX2003")] pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; + pub fn semget(key: key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "semctl$UNIX2003")] + pub fn semctl(semid: ::c_int, + semnum: ::c_int, + cmd: ::c_int, ...) -> ::c_int; + pub fn semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int; pub fn shm_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::c_int; + pub fn ftok(pathname : *const c_char, proj_id : ::c_int) -> key_t; 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; @@ -2427,6 +2513,9 @@ extern { len: *mut ::off_t, hdtr: *mut ::sf_hdtr, flags: ::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 openpty(amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, diff --git a/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 9e1082e53b..0414380461 100644 --- a/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -222,6 +222,8 @@ pub const O_DIRECTORY: ::c_int = 0x08000000; pub const F_GETLK: ::c_int = 7; pub const F_SETLK: ::c_int = 8; pub const F_SETLKW: ::c_int = 9; +pub const ENOMEDIUM: ::c_int = 93; +pub const EASYNC: ::c_int = 99; pub const ELAST: ::c_int = 99; pub const RLIMIT_POSIXLOCKS: ::c_int = 11; pub const RLIM_NLIMITS: ::rlim_t = 12; @@ -429,6 +431,8 @@ pub const NOTE_CHILD: ::uint32_t = 0x00000004; pub const SO_SNDSPACE: ::c_int = 0x100a; pub const SO_CPUHINT: ::c_int = 0x1030; +pub const PT_FIRSTMACH: ::c_int = 32; + // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/net/if.h#L101 pub const IFF_UP: ::c_int = 0x1; // interface is up pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid @@ -680,6 +684,11 @@ pub const IPPROTO_DONE: ::c_int = 257; /// Used by RSS: the layer3 protocol is unknown pub const IPPROTO_UNKNOWN: ::c_int = 258; +// sys/netinet/tcp.h +pub const TCP_SIGNATURE_ENABLE: ::c_int = 16; +pub const TCP_KEEPINIT: ::c_int = 32; +pub const TCP_FASTKEEP: ::c_int = 128; + pub const AF_BLUETOOTH: ::c_int = 33; pub const AF_MPLS: ::c_int = 34; pub const AF_IEEE80211: ::c_int = 35; @@ -765,6 +774,14 @@ pub const RTP_PRIO_NORMAL: ::c_ushort = 1; pub const RTP_PRIO_IDLE: ::c_ushort = 2; pub const RTP_PRIO_THREAD: ::c_ushort = 3; +// Flags for chflags(2) +pub const UF_NOHISTORY: ::c_ulong = 0x00000040; +pub const UF_CACHE: ::c_ulong = 0x00000080; +pub const UF_XLINK: ::c_ulong = 0x00000100; +pub const SF_NOHISTORY: ::c_ulong = 0x00400000; +pub const SF_CACHE: ::c_ulong = 0x00800000; +pub const SF_XLINK: ::c_ulong = 0x01000000; + extern { pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; diff --git a/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs index a64dbc468f..1ead1665b5 100644 --- a/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -186,6 +186,10 @@ s! { pub const SIGEV_THREAD_ID: ::c_int = 4; +pub const EXTATTR_NAMESPACE_EMPTY: ::c_int = 0; +pub const EXTATTR_NAMESPACE_USER: ::c_int = 1; +pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2; + pub const RAND_MAX: ::c_int = 0x7fff_fffd; pub const PTHREAD_STACK_MIN: ::size_t = 2048; pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4; @@ -457,6 +461,7 @@ pub const JAIL_SYS_INHERIT: ::c_int = 2; 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; @@ -473,6 +478,39 @@ pub const LOCAL_CREDS: ::c_int = 2; pub const LOCAL_CONNWAIT: ::c_int = 4; pub const LOCAL_VENDOR: ::c_int = SO_VENDOR; +pub const PT_LWPINFO: ::c_int = 13; +pub const PT_GETNUMLWPS: ::c_int = 14; +pub const PT_GETLWPLIST: ::c_int = 15; +pub const PT_CLEARSTEP: ::c_int = 16; +pub const PT_SETSTEP: ::c_int = 17; +pub const PT_SUSPEND: ::c_int = 18; +pub const PT_RESUME: ::c_int = 19; +pub const PT_TO_SCE: ::c_int = 20; +pub const PT_TO_SCX: ::c_int = 21; +pub const PT_SYSCALL: ::c_int = 22; +pub const PT_FOLLOW_FORK: ::c_int = 23; +pub const PT_LWP_EVENTS: ::c_int = 24; +pub const PT_GET_EVENT_MASK: ::c_int = 25; +pub const PT_SET_EVENT_MASK: ::c_int = 26; +pub const PT_GETREGS: ::c_int = 33; +pub const PT_SETREGS: ::c_int = 34; +pub const PT_GETFPREGS: ::c_int = 35; +pub const PT_SETFPREGS: ::c_int = 36; +pub const PT_GETDBREGS: ::c_int = 37; +pub const PT_SETDBREGS: ::c_int = 38; +pub const PT_VM_TIMESTAMP: ::c_int = 40; +pub const PT_VM_ENTRY: ::c_int = 41; +pub const PT_FIRSTMACH: ::c_int = 64; + +pub const PTRACE_EXEC: ::c_int = 0x0001; +pub const PTRACE_SCE: ::c_int = 0x0002; +pub const PTRACE_SCX: ::c_int = 0x0004; +pub const PTRACE_SYSCALL: ::c_int = PTRACE_SCE | PTRACE_SCX; +pub const PTRACE_FORK: ::c_int = 0x0008; +pub const PTRACE_LWP: ::c_int = 0x0010; +pub const PTRACE_VFORK: ::c_int = 0x0020; +pub const PTRACE_DEFAULT: ::c_int = PTRACE_EXEC; + pub const AF_SLOW: ::c_int = 33; pub const AF_SCLUSTER: ::c_int = 34; pub const AF_ARP: ::c_int = 35; @@ -754,6 +792,16 @@ pub const IPPROTO_DIVERT: ::c_int = 258; /// SeND pseudo-protocol pub const IPPROTO_SEND: ::c_int = 259; +// sys/netinet/TCP.h +pub const TCP_MD5SIG: ::c_int = 16; +pub const TCP_INFO: ::c_int = 32; +pub const TCP_CONGESTION: ::c_int = 64; +pub const TCP_CCALGOOPT: ::c_int = 65; +pub const TCP_KEEPINIT: ::c_int = 128; +pub const TCP_FASTOPEN: ::c_int = 1025; +pub const TCP_PCAP_OUT: ::c_int = 2048; +pub const TCP_PCAP_IN: ::c_int = 4096; + pub const IP_BINDANY: ::c_int = 24; pub const PF_SLOW: ::c_int = AF_SLOW; @@ -890,6 +938,16 @@ pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08; pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10; pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20; +// Flags for chflags(2) +pub const UF_SYSTEM: ::c_ulong = 0x00000080; +pub const UF_SPARSE: ::c_ulong = 0x00000100; +pub const UF_OFFLINE: ::c_ulong = 0x00000200; +pub const UF_REPARSE: ::c_ulong = 0x00000400; +pub const UF_ARCHIVE: ::c_ulong = 0x00000800; +pub const UF_READONLY: ::c_ulong = 0x00001000; +pub const UF_HIDDEN: ::c_ulong = 0x00008000; +pub const SF_SNAPSHOT: ::c_ulong = 0x00200000; + extern { pub fn __error() -> *mut ::c_int; @@ -900,6 +958,58 @@ extern { 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 extattr_delete_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_get_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_list_fd(fd: ::c_int, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_list_file(path: *const ::c_char, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_list_link(path: *const ::c_char, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn jail(jail: *mut ::jail) -> ::c_int; pub fn jail_attach(jid: ::c_int) -> ::c_int; pub fn jail_remove(jid: ::c_int) -> ::c_int; @@ -1022,6 +1132,16 @@ extern { pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; + + pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; +} + +#[link(name = "util")] +extern { + pub fn extattr_namespace_to_string(attrnamespace: ::c_int, + string: *mut *mut ::c_char) -> ::c_int; + pub fn extattr_string_to_namespace(string: *const ::c_char, + attrnamespace: *mut ::c_int) -> ::c_int; } cfg_if! { diff --git a/vendor/libc/src/unix/bsd/freebsdlike/mod.rs b/vendor/libc/src/unix/bsd/freebsdlike/mod.rs index 75a7a670e9..cb3dba4004 100644 --- a/vendor/libc/src/unix/bsd/freebsdlike/mod.rs +++ b/vendor/libc/src/unix/bsd/freebsdlike/mod.rs @@ -624,6 +624,18 @@ pub const PF_NATM: ::c_int = AF_NATM; pub const PF_ATM: ::c_int = AF_ATM; pub const PF_NETGRAPH: ::c_int = AF_NETGRAPH; +pub const PT_TRACE_ME: ::c_int = 0; +pub const PT_READ_I: ::c_int = 1; +pub const PT_READ_D: ::c_int = 2; +pub const PT_WRITE_I: ::c_int = 4; +pub const PT_WRITE_D: ::c_int = 5; +pub const PT_CONTINUE: ::c_int = 7; +pub const PT_KILL: ::c_int = 8; +pub const PT_STEP: ::c_int = 9; +pub const PT_ATTACH: ::c_int = 10; +pub const PT_DETACH: ::c_int = 11; +pub const PT_IO: ::c_int = 12; + pub const SOMAXCONN: ::c_int = 128; pub const MSG_OOB: ::c_int = 0x00000001; @@ -657,7 +669,8 @@ pub const IPV6_LEAVE_GROUP: ::c_int = 13; pub const IPV6_RECVPKTINFO: ::c_int = 36; pub const IPV6_PKTINFO: ::c_int = 46; -pub const TCP_NODELAY: ::c_int = 1; +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; @@ -991,6 +1004,21 @@ pub const RTP_PRIO_MAX: ::c_ushort = 31; pub const RTP_LOOKUP: ::c_int = 0; pub const RTP_SET: ::c_int = 1; +// Flags for chflags(2) +pub const UF_SETTABLE: ::c_ulong = 0x0000ffff; +pub const UF_NODUMP: ::c_ulong = 0x00000001; +pub const UF_IMMUTABLE: ::c_ulong = 0x00000002; +pub const UF_APPEND: ::c_ulong = 0x00000004; +pub const UF_OPAQUE: ::c_ulong = 0x00000008; +pub const UF_NOUNLINK: ::c_ulong = 0x00000010; +pub const SF_SETTABLE: ::c_ulong = 0xffff0000; +pub const SF_ARCHIVED: ::c_ulong = 0x00010000; +pub const SF_IMMUTABLE: ::c_ulong = 0x00020000; +pub const SF_APPEND: ::c_ulong = 0x00040000; +pub const SF_NOUNLINK: ::c_ulong = 0x00100000; + +pub const TIMER_ABSTIME: ::c_int = 1; + f! { pub fn WIFCONTINUED(status: ::c_int) -> bool { status == 0x13 @@ -1010,33 +1038,73 @@ f! { } extern { - pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::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; + 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 chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; + pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_ulong, + atflag: ::c_int) -> ::c_int; + pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; + pub fn duplocale(base: ::locale_t) -> ::locale_t; pub fn endutxent(); - 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 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 getgrouplist(name: *const ::c_char, - basegid: ::gid_t, - groups: *mut ::gid_t, - ngroups: *mut ::c_int) -> ::c_int; - pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; + pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int; + pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; + pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int; + pub fn getgrent_r(grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] pub fn getpwent_r(pwd: *mut ::passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::passwd) -> ::c_int; - pub fn getgrent_r(grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; - pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; + pub fn getgrouplist(name: *const ::c_char, + basegid: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int) -> ::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 getpriority(which: ::c_int, who: ::c_int) -> ::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 initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; + #[cfg_attr(target_os = "freebsd", link_name = "kevent@FBSD_1.0")] + 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 lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::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 memrchr(cx: *const ::c_void, + c: ::c_int, + 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")] + 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; pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int; + pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; pub fn mq_receive(mqd: ::mqd_t, msg_ptr: *mut ::c_char, msg_len: ::size_t, @@ -1059,51 +1127,87 @@ extern { msq_prio: ::c_uint, abs_timeout: *const ::timespec) -> ::c_int; pub fn mq_unlink(name: *const ::c_char) -> ::c_int; -} - -#[link(name = "util")] -extern { - 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 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; - #[cfg_attr(target_os = "freebsd", link_name = "kevent@FBSD_1.0")] - 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 mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; - pub fn pwritev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off_t) -> ::ssize_t; + pub fn newlocale(mask: ::c_int, + locale: *const ::c_char, + base: ::locale_t) -> ::locale_t; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; + pub fn ppoll(fds: *mut ::pollfd, + nfds: ::nfds_t, + timeout: *const ::timespec, + sigmask: *const sigset_t) -> ::c_int; pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; - pub fn sysctlnametomib(name: *const ::c_char, - mibp: *mut ::c_int, - sizep: *mut ::size_t) - -> ::c_int; + pub fn pthread_attr_get_np(tid: ::pthread_t, + attr: *mut ::pthread_attr_t) -> ::c_int; + pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, + guardsize: *mut ::size_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 pthread_condattr_getclock(attr: *const pthread_condattr_t, + clock_id: *mut clockid_t) -> ::c_int; + pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, + pshared: *mut ::c_int) -> ::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 pthread_mutex_timedlock(lock: *mut pthread_mutex_t, + abstime: *const ::timespec) -> ::c_int; + pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, + pshared: *mut ::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 pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); + pub fn ptrace(request: ::c_int, + pid: ::pid_t, + addr: *mut ::c_char, + data: ::c_int) -> ::c_int; + pub fn pututxline(ut: *const utmpx) -> *mut utmpx; + pub fn pwritev(fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t) -> ::ssize_t; + pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; + pub fn rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int; + pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; + pub fn sched_setscheduler(pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param) -> ::c_int; + pub fn sem_getvalue(sem: *mut sem_t, + sval: *mut ::c_int) -> ::c_int; + pub fn sem_timedwait(sem: *mut sem_t, + abstime: *const ::timespec) -> ::c_int; + pub fn sendfile(fd: ::c_int, + s: ::c_int, + offset: ::off_t, + nbytes: ::size_t, + hdtr: *mut ::sf_hdtr, + sbytes: *mut ::off_t, + flags: ::c_int) -> ::c_int; + pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int; + pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::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 settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + pub fn setutxent(); pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::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 sysctl(name: *const ::c_int, namelen: ::c_uint, oldp: *mut ::c_void, @@ -1117,25 +1221,17 @@ extern { newp: *const ::c_void, newlen: ::size_t) -> ::c_int; - pub fn sched_setscheduler(pid: ::pid_t, - policy: ::c_int, - param: *const ::sched_param) -> ::c_int; - pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; - pub fn memrchr(cx: *const ::c_void, - c: ::c_int, - n: ::size_t) -> *mut ::c_void; - pub fn sendfile(fd: ::c_int, - s: ::c_int, - offset: ::off_t, - nbytes: ::size_t, - hdtr: *mut ::sf_hdtr, - sbytes: *mut ::off_t, - 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 sysctlnametomib(name: *const ::c_char, + mibp: *mut ::c_int, + sizep: *mut ::size_t) + -> ::c_int; + pub fn uselocale(loc: ::locale_t) -> ::locale_t; + pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, + times: *const ::timespec, flag: ::c_int) -> ::c_int; +} + +#[link(name = "util")] +extern { pub fn openpty(amaster: *mut ::c_int, aslave: *mut ::c_int, name: *mut ::c_char, @@ -1145,63 +1241,6 @@ extern { name: *mut ::c_char, termp: *mut termios, winp: *mut ::winsize) -> ::pid_t; - pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; - pub fn duplocale(base: ::locale_t) -> ::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 querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; - pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; - pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); - pub fn pthread_attr_get_np(tid: ::pthread_t, - attr: *mut ::pthread_attr_t) -> ::c_int; - pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, - guardsize: *mut ::size_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 pthread_condattr_setpshared(attr: *mut pthread_condattr_t, - pshared: ::c_int) -> ::c_int; - pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, - pshared: *mut ::c_int) -> ::c_int; - pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, - pshared: ::c_int) -> ::c_int; - pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, - pshared: *mut ::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 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 rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int; - - #[cfg_attr(target_os = "freebsd", 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 mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_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 sethostname(name: *const ::c_char, len: ::c_int) -> ::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 pthread_mutex_timedlock(lock: *mut pthread_mutex_t, - abstime: *const ::timespec) -> ::c_int; - pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; - pub fn ppoll(fds: *mut ::pollfd, - nfds: ::nfds_t, - timeout: *const ::timespec, - sigmask: *const sigset_t) -> ::c_int; - pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; - pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int; - pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int; } cfg_if! { diff --git a/vendor/libc/src/unix/bsd/mod.rs b/vendor/libc/src/unix/bsd/mod.rs index 47f82bdf59..770b9b9818 100644 --- a/vendor/libc/src/unix/bsd/mod.rs +++ b/vendor/libc/src/unix/bsd/mod.rs @@ -215,6 +215,10 @@ pub const O_NDELAY: ::c_int = O_NONBLOCK; pub const F_GETOWN: ::c_int = 5; pub const F_SETOWN: ::c_int = 6; +pub const F_RDLCK: ::c_short = 1; +pub const F_UNLCK: ::c_short = 2; +pub const F_WRLCK: ::c_short = 3; + pub const MNT_FORCE: ::c_int = 0x80000; pub const Q_SYNC: ::c_int = 0x600; @@ -312,6 +316,7 @@ 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 TCP_NODELAY: ::c_int = 1; pub const TCP_MAXSEG: ::c_int = 2; pub const PIPE_BUF: usize = 512; @@ -328,6 +333,43 @@ pub const POLLRDBAND: ::c_short = 0x080; pub const POLLWRBAND: ::c_short = 0x100; 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_NXTHDR(mhdr: *const msghdr, + cmsg: *const cmsghdr) -> *mut cmsghdr { + if cmsg.is_null() { + return CMSG_FIRSTHDR(mhdr); + }; + let pad = mem::align_of::() - 1; + let next = cmsg as usize + (*cmsg).cmsg_len as usize + pad & !pad; + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if next < max { + next 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 { + let pad = mem::align_of::() as ::c_uint - 1; + mem::size_of::() as ::c_uint + ((length + pad) & !pad) + } + + pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { + mem::size_of::() as ::c_uint + length + } + pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8; let fd = fd as usize; @@ -376,6 +418,12 @@ f! { } 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 getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; pub fn freeifaddrs(ifa: *mut ::ifaddrs); pub fn setgroups(ngroups: ::c_int, @@ -444,6 +492,7 @@ extern { flags: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::ssize_t; pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__futimes50")] pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; @@ -538,6 +587,7 @@ extern { attr: *const ::pthread_attr_t, f: extern fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void) -> ::c_int; + pub fn acct(filename: *const ::c_char) -> ::c_int; } cfg_if! { diff --git a/vendor/libc/src/unix/bsd/netbsdlike/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/mod.rs index 6384a29f8c..bfd541d8a0 100644 --- a/vendor/libc/src/unix/bsd/netbsdlike/mod.rs +++ b/vendor/libc/src/unix/bsd/netbsdlike/mod.rs @@ -314,6 +314,17 @@ pub const POSIX_MADV_DONTNEED : ::c_int = 4; pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0; pub const PTHREAD_CREATE_DETACHED : ::c_int = 1; +pub const PT_TRACE_ME: ::c_int = 0; +pub const PT_READ_I: ::c_int = 1; +pub const PT_READ_D: ::c_int = 2; +pub const PT_WRITE_I: ::c_int = 4; +pub const PT_WRITE_D: ::c_int = 5; +pub const PT_CONTINUE: ::c_int = 7; +pub const PT_KILL: ::c_int = 8; +pub const PT_ATTACH: ::c_int = 9; +pub const PT_DETACH: ::c_int = 10; +pub const PT_IO: ::c_int = 11; + // http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2 // The man page says clock_gettime(3) can accept various values as clockid_t but // http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161 @@ -420,8 +431,6 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 13; pub const IPV6_RECVPKTINFO: ::c_int = 36; pub const IPV6_PKTINFO: ::c_int = 46; -pub const TCP_NODELAY: ::c_int = 0x01; - pub const SOL_SOCKET: ::c_int = 0xffff; pub const SO_DEBUG: ::c_int = 0x01; pub const SO_ACCEPTCONN: ::c_int = 0x0002; @@ -569,6 +578,19 @@ pub const TIOCM_DSR: ::c_int = 0o0400; pub const TIOCM_CD: ::c_int = TIOCM_CAR; pub const TIOCM_RI: ::c_int = TIOCM_RNG; +// Flags for chflags(2) +pub const UF_SETTABLE: ::c_ulong = 0x0000ffff; +pub const UF_NODUMP: ::c_ulong = 0x00000001; +pub const UF_IMMUTABLE: ::c_ulong = 0x00000002; +pub const UF_APPEND: ::c_ulong = 0x00000004; +pub const UF_OPAQUE: ::c_ulong = 0x00000008; +pub const SF_SETTABLE: ::c_ulong = 0xffff0000; +pub const SF_ARCHIVED: ::c_ulong = 0x00010000; +pub const SF_IMMUTABLE: ::c_ulong = 0x00020000; +pub const SF_APPEND: ::c_ulong = 0x00040000; + +pub const TIMER_ABSTIME: ::c_int = 1; + f! { pub fn WSTOPSIG(status: ::c_int) -> ::c_int { status >> 8 diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs new file mode 100644 index 0000000000..66f33016b1 --- /dev/null +++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -0,0 +1,11 @@ +use PT_FIRSTMACH; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; + +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3; diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs new file mode 100644 index 0000000000..9e673166d6 --- /dev/null +++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -0,0 +1,11 @@ +use PT_FIRSTMACH; + +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_int; + +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 --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs index 065f6bd36a..55b8f4c433 100644 --- a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1,6 +1,5 @@ use dox::mem; -pub type c_char = i8; pub type clock_t = ::c_uint; pub type suseconds_t = ::c_int; pub type dev_t = u64; @@ -9,6 +8,7 @@ pub type fsblkcnt_t = ::uint64_t; pub type fsfilcnt_t = ::uint64_t; pub type idtype_t = ::c_int; pub type mqd_t = ::c_int; +type __pthread_spin_t = __cpu_simple_lock_nv_t; s! { pub struct aiocb { @@ -161,9 +161,14 @@ s! { pub struct pthread_mutex_t { ptm_magic: ::c_uint, - ptm_errorcheck: ::c_uchar, + ptm_errorcheck: __pthread_spin_t, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad1: [u8; 3], - ptm_interlock: ::c_uchar, + // actually a union with a non-unused, 0-initialized field + ptm_unused: __pthread_spin_t, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad2: [u8; 3], ptm_owner: ::pthread_t, ptm_waiters: *mut u8, @@ -183,7 +188,7 @@ s! { pub struct pthread_cond_t { ptc_magic: ::c_uint, - ptc_lock: ::c_uchar, + ptc_lock: __pthread_spin_t, ptc_waiters_first: *mut u8, ptc_waiters_last: *mut u8, ptc_mutex: *mut ::pthread_mutex_t, @@ -197,7 +202,7 @@ s! { pub struct pthread_rwlock_t { ptr_magic: ::c_uint, - ptr_interlock: ::c_uchar, + ptr_interlock: __pthread_spin_t, ptr_rblocked_first: *mut u8, ptr_rblocked_last: *mut u8, ptr_wblocked_first: *mut u8, @@ -335,6 +340,9 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; pub const AT_REMOVEDIR: ::c_int = 0x800; +pub const EXTATTR_NAMESPACE_USER: ::c_int = 1; +pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2; + pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE); pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE); pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY); @@ -394,6 +402,9 @@ pub const TCP_KEEPIDLE: ::c_int = 3; pub const TCP_KEEPINTVL: ::c_int = 5; pub const TCP_KEEPCNT: ::c_int = 6; pub const TCP_KEEPINIT: ::c_int = 7; +pub const TCP_INFO: ::c_int = 9; +pub const TCP_MD5SIG: ::c_int = 0x10; +pub const TCP_CONGCTL: ::c_int = 0x20; pub const SOCK_CONN_DGRAM: ::c_int = 6; pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM; @@ -696,14 +707,19 @@ pub const ST_NOSUID: ::c_ulong = 8; pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { ptm_magic: 0x33330003, ptm_errorcheck: 0, - ptm_interlock: 0, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] + ptm_pad1: [0; 3], + ptm_unused: 0, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] + ptm_pad2: [0; 3], ptm_waiters: 0 as *mut _, ptm_owner: 0, - ptm_pad1: [0; 3], - ptm_pad2: [0; 3], ptm_recursed: 0, ptm_spare2: 0 as *mut _, }; + pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { ptc_magic: 0x55550005, ptc_lock: 0, @@ -970,6 +986,20 @@ pub const SOCK_NONBLOCK: ::c_int = 0x20000000; pub const SIGSTKSZ : ::size_t = 40960; +pub const PT_DUMPCORE: ::c_int = 12; +pub const PT_LWPINFO: ::c_int = 13; +pub const PT_SYSCALL: ::c_int = 14; +pub const PT_SYSCALLEMU: ::c_int = 15; +pub const PT_SET_EVENT_MASK: ::c_int = 16; +pub const PT_GET_EVENT_MASK: ::c_int = 17; +pub const PT_GET_PROCESS_STATE: ::c_int = 18; +pub const PT_FIRSTMACH: ::c_int = 32; + +// Flags for chflags(2) +pub const SF_SNAPSHOT: ::c_ulong = 0x00200000; +pub const SF_LOG: ::c_ulong = 0x00400000; +pub const SF_SNAPINVAL: ::c_ulong = 0x00800000; + // dirfd() is a macro on netbsd to access // the first field of the struct where dirp points to: // http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36 @@ -1005,6 +1035,55 @@ extern { pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent) -> ::c_int; + pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; + pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int; + pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; + + pub fn extattr_delete_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_get_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_namespace_to_string(attrnamespace: ::c_int, + string: *mut *mut ::c_char) -> ::c_int; + pub fn extattr_set_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::c_int; + pub fn extattr_set_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::c_int; + pub fn extattr_set_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::c_int; + pub fn extattr_string_to_namespace(string: *const ::c_char, + attrnamespace: *mut ::c_int) -> ::c_int; + + #[link_name = "__lutimes50"] pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; pub fn getnameinfo(sa: *const ::sockaddr, salen: ::socklen_t, @@ -1056,11 +1135,13 @@ extern { pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int; + #[link_name = "__mq_timedreceive50"] 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; + #[link_name = "__mq_timedsend50"] pub fn mq_timedsend(mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, @@ -1095,6 +1176,8 @@ extern { base: ::locale_t) -> ::locale_t; #[link_name = "__settimeofday50"] pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int; + + pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; } #[link(name = "util")] @@ -1110,5 +1193,26 @@ extern { result: *mut *mut ::group) -> ::c_int; } -mod other; -pub use self::other::*; +cfg_if! { + if #[cfg(target_arch = "aarch64")] { + mod aarch64; + pub use self::aarch64::*; + } 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 if #[cfg(target_arch = "sparc64")] { + mod sparc64; + pub use self::sparc64::*; + } else if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } else if #[cfg(target_arch = "x86")] { + mod x86; + pub use self::x86::*; + } else { + // Unknown target_arch + } +} diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs deleted file mode 100644 index 9b0b338b91..0000000000 --- a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub type c_long = i32; -pub type c_ulong = u32; diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs deleted file mode 100644 index b07c476aa4..0000000000 --- a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub type c_long = i64; -pub type c_ulong = u64; diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs deleted file mode 100644 index 3a9bf0866c..0000000000 --- a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/other/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -cfg_if! { - if #[cfg(any(target_arch = "sparc64", - target_arch = "x86_64"))] { - mod b64; - pub use self::b64::*; - } else if #[cfg(any(target_arch = "arm", - target_arch = "powerpc", - target_arch = "x86"))] { - mod b32; - pub use self::b32::*; - } else { - // Unknown target_arch - } -} diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs new file mode 100644 index 0000000000..54d069e607 --- /dev/null +++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs @@ -0,0 +1,10 @@ +use PT_FIRSTMACH; + +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_int; + +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; diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs new file mode 100644 index 0000000000..db8f2a94c5 --- /dev/null +++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs @@ -0,0 +1,4 @@ +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs new file mode 100644 index 0000000000..8bd105841d --- /dev/null +++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs @@ -0,0 +1,4 @@ +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs new file mode 100644 index 0000000000..8d3de8453a --- /dev/null +++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -0,0 +1,12 @@ +use PT_FIRSTMACH; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; + +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 --git a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs index 557420485a..e5f0219e03 100644 --- a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs +++ b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs @@ -85,6 +85,8 @@ pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast 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; diff --git a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs index b07c476aa4..d3971aa35b 100644 --- a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs +++ b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs @@ -1,2 +1,10 @@ +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 --git a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs index bf5ddd2e7a..85f0a02a12 100644 --- a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs +++ b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs @@ -14,6 +14,7 @@ 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 dirent { @@ -319,6 +320,10 @@ pub const IPPROTO_DIVERT: ::c_int = 258; pub const IP_RECVDSTADDR: ::c_int = 7; pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; +// 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; @@ -663,7 +668,8 @@ 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_MAXID: ::c_int = 85; +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; @@ -695,6 +701,8 @@ 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! { @@ -704,6 +712,10 @@ f! { } 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, @@ -734,6 +746,10 @@ extern { 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! { diff --git a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs index 5e6948115f..a2a7a30a10 100644 --- a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs +++ b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs @@ -248,6 +248,8 @@ pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast pub const SIGSTKSZ : ::size_t = 28672; +pub const PT_FIRSTMACH: ::c_int = 32; + extern { pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; @@ -261,6 +263,8 @@ extern { pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; + + pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; } cfg_if! { diff --git a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs index 27b9412668..3bc7f52471 100644 --- a/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs +++ b/vendor/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs @@ -1,3 +1,11 @@ +use PT_FIRSTMACH; + pub type c_long = i64; pub type c_ulong = u64; pub type c_char = i8; + +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 --git a/vendor/libc/src/unix/haiku/mod.rs b/vendor/libc/src/unix/haiku/mod.rs index 2ef36f8f38..e65bca7f40 100644 --- a/vendor/libc/src/unix/haiku/mod.rs +++ b/vendor/libc/src/unix/haiku/mod.rs @@ -351,6 +351,10 @@ pub const F_SETLK: ::c_int = 0x0080; pub const F_SETLKW: ::c_int = 0x0100; pub const F_DUPFD_CLOEXEC: ::c_int = 0x0200; +pub const F_RDLCK: ::c_int = 0x0040; +pub const F_UNLCK: ::c_int = 0x0200; +pub const F_WRLCK: ::c_int = 0x0400; + pub const AT_FDCWD: ::c_int = -1; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02; @@ -1082,6 +1086,14 @@ f! { } } +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); +} + #[link(name = "bsd")] extern { pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int; diff --git a/vendor/libc/src/unix/hermit/mod.rs b/vendor/libc/src/unix/hermit/mod.rs index bed6f7ae7f..aadfa1cf0f 100644 --- a/vendor/libc/src/unix/hermit/mod.rs +++ b/vendor/libc/src/unix/hermit/mod.rs @@ -696,6 +696,12 @@ f! { } 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 bind(s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t) -> ::c_int; diff --git a/vendor/libc/src/unix/mod.rs b/vendor/libc/src/unix/mod.rs index 9c68178ad1..370d7f48cb 100644 --- a/vendor/libc/src/unix/mod.rs +++ b/vendor/libc/src/unix/mod.rs @@ -5,6 +5,34 @@ use dox::Option; +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 pid_t = i32; pub type uid_t = u32; pub type gid_t = u32; @@ -188,6 +216,9 @@ s! { } } +pub const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub const SIG_IGN: sighandler_t = 1 as sighandler_t; pub const SIG_ERR: sighandler_t = !0 as sighandler_t; @@ -287,17 +318,18 @@ cfg_if! { // cargo build, don't pull in anything extra as the libstd dep // already pulls in all libs. } else if #[cfg(target_env = "musl")] { - #[cfg_attr(feature = "stdbuild", + #[cfg_attr(feature = "rustc-dep-of-std", link(name = "c", kind = "static", cfg(target_feature = "crt-static")))] - #[cfg_attr(feature = "stdbuild", + #[cfg_attr(feature = "rustc-dep-of-std", link(name = "c", cfg(not(target_feature = "crt-static"))))] extern {} } else if #[cfg(target_os = "emscripten")] { #[link(name = "c")] extern {} } else if #[cfg(all(target_os = "netbsd", - feature = "stdbuild", target_vendor = "rumprun"))] { + feature = "rustc-dep-of-std", + target_vendor = "rumprun"))] { // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled // in automatically by the linker. We avoid passing it explicitly, as it // causes some versions of binutils to crash with an assertion failure. @@ -315,10 +347,6 @@ cfg_if! { #[link(name = "root")] #[link(name = "network")] extern {} - } else if #[cfg(target_os = "fuchsia")] { - #[link(name = "c")] - #[link(name = "fdio")] - extern {} } else if #[cfg(target_env = "newlib")] { #[link(name = "c")] #[link(name = "m")] @@ -337,6 +365,138 @@ cfg_if! { } } +pub enum FILE {} +pub enum fpos_t {} // TODO: fill this out with a struct + +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; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "fopen$UNIX2003" + )] + pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "freopen$UNIX2003" + )] + 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; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "fputs$UNIX2003" + )] + 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; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "fwrite$UNIX2003" + )] + 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); + #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] + pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; + #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] + 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; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "strtod$UNIX2003" + )] + 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; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "system$UNIX2003" + )] + 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 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; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "strerror$UNIX2003" + )] + 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; +} + extern { #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] pub fn getpwnam(name: *const ::c_char) -> *mut passwd; @@ -551,6 +711,7 @@ extern { -> ::ssize_t; pub fn rmdir(path: *const c_char) -> ::c_int; pub fn seteuid(uid: uid_t) -> ::c_int; + pub fn setegid(gid: gid_t) -> ::c_int; pub fn setgid(gid: gid_t) -> ::c_int; pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; pub fn setsid() -> pid_t; @@ -641,6 +802,7 @@ extern { 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 signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; @@ -946,6 +1108,10 @@ extern { pub fn posix_openpt(flags: ::c_int) -> ::c_int; pub fn ptsname(fd: ::c_int) -> *mut ::c_char; pub fn unlockpt(fd: ::c_int) -> ::c_int; + + pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; + pub fn getline (lineptr: *mut *mut c_char, n: *mut size_t, + stream: *mut FILE) -> ssize_t; } cfg_if! { @@ -957,8 +1123,7 @@ cfg_if! { pub use self::newlib::*; } else if #[cfg(any(target_os = "linux", target_os = "android", - target_os = "emscripten", - target_os = "fuchsia"))] { + target_os = "emscripten"))] { mod notbsd; pub use self::notbsd::*; } else if #[cfg(any(target_os = "macos", @@ -983,3 +1148,21 @@ cfg_if! { // Unknown target_os } } + +cfg_if! { + if #[cfg(core_cvoid)] { + pub use core::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)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} diff --git a/vendor/libc/src/unix/newlib/mod.rs b/vendor/libc/src/unix/newlib/mod.rs index 9968d36685..77a4eb9901 100644 --- a/vendor/libc/src/unix/newlib/mod.rs +++ b/vendor/libc/src/unix/newlib/mod.rs @@ -654,6 +654,12 @@ f! { } 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 bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int; pub fn closesocket(sockfd: ::c_int) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; diff --git a/vendor/libc/src/unix/notbsd/android/mod.rs b/vendor/libc/src/unix/notbsd/android/mod.rs index 3e10acd505..70052e1966 100644 --- a/vendor/libc/src/unix/notbsd/android/mod.rs +++ b/vendor/libc/src/unix/notbsd/android/mod.rs @@ -177,7 +177,11 @@ s! { pub ssi_stime: ::c_ulonglong, pub ssi_addr: ::c_ulonglong, pub ssi_addr_lsb: ::uint16_t, - _pad: [::uint8_t; 46], + _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 { @@ -744,6 +748,10 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/emscripten.rs b/vendor/libc/src/unix/notbsd/emscripten.rs index b30fee3232..28791d8fd5 100644 --- a/vendor/libc/src/unix/notbsd/emscripten.rs +++ b/vendor/libc/src/unix/notbsd/emscripten.rs @@ -184,7 +184,12 @@ s! { pub ssi_utime: ::uint64_t, pub ssi_stime: ::uint64_t, pub ssi_addr: ::uint64_t, - _pad: [::uint8_t; 48], + 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 { @@ -1568,6 +1573,12 @@ f! { } 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; diff --git a/vendor/libc/src/unix/notbsd/linux/mips/mod.rs b/vendor/libc/src/unix/notbsd/linux/mips/mod.rs index 4c14d12ebc..b000d6df45 100644 --- a/vendor/libc/src/unix/notbsd/linux/mips/mod.rs +++ b/vendor/libc/src/unix/notbsd/linux/mips/mod.rs @@ -397,8 +397,6 @@ 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_TIMESTAMPING: ::c_int = 37; -pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; 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; diff --git a/vendor/libc/src/unix/notbsd/linux/mod.rs b/vendor/libc/src/unix/notbsd/linux/mod.rs index 6bc7db191c..1aeceb1a40 100644 --- a/vendor/libc/src/unix/notbsd/linux/mod.rs +++ b/vendor/libc/src/unix/notbsd/linux/mod.rs @@ -33,6 +33,10 @@ 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; pub enum fpos64_t {} // TODO: fill this out with a struct @@ -266,7 +270,12 @@ s! { pub ssi_utime: ::uint64_t, pub ssi_stime: ::uint64_t, pub ssi_addr: ::uint64_t, - _pad: [::uint8_t; 48], + 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 { @@ -479,6 +488,58 @@ s! { 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, @@ -501,6 +562,45 @@ s! { 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, @@ -958,10 +1058,12 @@ 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; @@ -1572,10 +1674,25 @@ 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; + f! { pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { for slot in cpuset.bits.iter_mut() { @@ -1654,6 +1771,12 @@ f! { } 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; @@ -1721,8 +1844,12 @@ extern { 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, @@ -2132,7 +2259,7 @@ extern { } cfg_if! { - if #[cfg(any(target_env = "musl", target_os = "fuchsia"))] { + if #[cfg(target_env = "musl")] { mod musl; pub use self::musl::*; } else if #[cfg(any(target_arch = "mips", diff --git a/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs b/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs index 20fa33a3f7..88d8798eca 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/b32/arm.rs @@ -467,6 +467,9 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs b/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs index bfde73c563..b0694d1ea8 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/b32/mips.rs @@ -478,6 +478,9 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs b/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs index 50b6b57ef1..d0f2d68293 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/b32/powerpc.rs @@ -470,6 +470,9 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs b/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs index 9f704c7fac..b6ea8c120f 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/b32/x86.rs @@ -481,6 +481,9 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs b/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs index 98c53dc4f2..f01a5c4374 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs @@ -459,6 +459,9 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs b/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs index 5c2e815fd6..043ca8d976 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/b64/mod.rs @@ -92,16 +92,25 @@ s! { 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, - __pad2: ::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, diff --git a/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs b/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs index 2ac39bf0cd..04eba48cc4 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs @@ -435,8 +435,8 @@ 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_ulong = 0x20006601; -pub const FIONBIO: ::c_ulong = 0x8004667e; +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; @@ -452,49 +452,52 @@ 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_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 TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; -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 = 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 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 = 0x4004667f; -pub const TIOCCONS: ::c_ulong = 0x541D; -pub const TIOCM_LE: ::c_ulong = 0x001; -pub const TIOCM_DTR: ::c_ulong = 0x002; -pub const TIOCM_RTS: ::c_ulong = 0x004; -pub const TIOCM_ST: ::c_ulong = 0x008; -pub const TIOCM_SR: ::c_ulong = 0x010; -pub const TIOCM_CTS: ::c_ulong = 0x020; -pub const TIOCM_CAR: ::c_ulong = 0x040; -pub const TIOCM_RNG: ::c_ulong = 0x080; -pub const TIOCM_DSR: ::c_ulong = 0x100; -pub const TIOCM_CD: ::c_ulong = TIOCM_CAR; -pub const TIOCM_RI: ::c_ulong = TIOCM_RNG; +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_ulong = ::FIONREAD; +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; @@ -568,5 +571,5 @@ pub const B3500000: ::speed_t = 0o00035; pub const B4000000: ::speed_t = 0o00036; extern { - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; } diff --git a/vendor/libc/src/unix/notbsd/linux/musl/mod.rs b/vendor/libc/src/unix/notbsd/linux/musl/mod.rs index 10d61ebebe..5ab5d0f691 100644 --- a/vendor/libc/src/unix/notbsd/linux/musl/mod.rs +++ b/vendor/libc/src/unix/notbsd/linux/musl/mod.rs @@ -121,6 +121,10 @@ 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; @@ -250,6 +254,13 @@ 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! { diff --git a/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs b/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs index 5b0142ab89..d078f75375 100644 --- a/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs +++ b/vendor/libc/src/unix/notbsd/linux/other/b32/mod.rs @@ -251,6 +251,10 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs b/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs index 2ba27a72b8..d6e37ff57b 100644 --- a/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs +++ b/vendor/libc/src/unix/notbsd/linux/other/b64/aarch64.rs @@ -284,8 +284,6 @@ 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_TIMESTAMPING: ::c_int = 37; -pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; pub const SO_PROTOCOL: ::c_int = 38; pub const SO_DOMAIN: ::c_int = 39; pub const SO_RXQ_OVFL: ::c_int = 40; @@ -340,6 +338,10 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs b/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs index 9dd91f0fdd..bc5b01c5a4 100644 --- a/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs +++ b/vendor/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs @@ -271,8 +271,6 @@ 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_TIMESTAMPING: ::c_int = 37; -pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; pub const SO_PROTOCOL: ::c_int = 38; pub const SO_DOMAIN: ::c_int = 39; pub const SO_RXQ_OVFL: ::c_int = 40; @@ -327,6 +325,10 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs b/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs index 34438a7353..325c7937fc 100644 --- a/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs +++ b/vendor/libc/src/unix/notbsd/linux/other/b64/sparc64.rs @@ -247,6 +247,7 @@ 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; @@ -305,6 +306,10 @@ 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; diff --git a/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs b/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs index 7596eba492..43b8b9f952 100644 --- a/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs +++ b/vendor/libc/src/unix/notbsd/linux/other/b64/x86_64.rs @@ -371,8 +371,6 @@ 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_TIMESTAMPING: ::c_int = 37; -pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; pub const SO_PROTOCOL: ::c_int = 38; pub const SO_DOMAIN: ::c_int = 39; pub const SO_RXQ_OVFL: ::c_int = 40; diff --git a/vendor/libc/src/unix/notbsd/linux/other/mod.rs b/vendor/libc/src/unix/notbsd/linux/other/mod.rs index 93b710b8df..c1e339311d 100644 --- a/vendor/libc/src/unix/notbsd/linux/other/mod.rs +++ b/vendor/libc/src/unix/notbsd/linux/other/mod.rs @@ -269,13 +269,13 @@ 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_BLUETOOTH: ::c_int = 274; 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_ALG: ::c_int = 279; pub const SOL_NFC: ::c_int = 280; +pub const SOL_XDP: ::c_int = 283; pub const MSG_TRYHARD: ::c_int = 4; @@ -824,6 +824,19 @@ 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)] @@ -856,6 +869,7 @@ extern { 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")] diff --git a/vendor/libc/src/unix/notbsd/mod.rs b/vendor/libc/src/unix/notbsd/mod.rs index eead3fd847..9557d1b3ad 100644 --- a/vendor/libc/src/unix/notbsd/mod.rs +++ b/vendor/libc/src/unix/notbsd/mod.rs @@ -53,8 +53,7 @@ s! { pub ai_addrlen: socklen_t, #[cfg(any(target_os = "linux", - target_os = "emscripten", - target_os = "fuchsia"))] + target_os = "emscripten"))] pub ai_addr: *mut ::sockaddr, pub ai_canonname: *mut c_char, @@ -514,6 +513,7 @@ 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 AF_UNSPEC: ::c_int = 0; pub const AF_UNIX: ::c_int = 1; @@ -977,6 +977,43 @@ pub const ARPHRD_VOID: u16 = 0xFFFF; pub const ARPHRD_NONE: u16 = 0xFFFE; 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_NXTHDR(mhdr: *const msghdr, + cmsg: *const cmsghdr) -> *mut cmsghdr { + if cmsg.is_null() { + return CMSG_FIRSTHDR(mhdr); + }; + let pad = mem::align_of::() - 1; + let next = cmsg as usize + (*cmsg).cmsg_len as usize + pad & !pad; + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if next < max { + next 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 { + let pad = mem::align_of::() as ::c_uint - 1; + mem::size_of::() as ::c_uint + ((length + pad) & !pad) + } + + pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint { + 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; @@ -1198,7 +1235,7 @@ cfg_if! { if #[cfg(target_os = "emscripten")] { mod emscripten; pub use self::emscripten::*; - } else if #[cfg(any(target_os = "linux", target_os = "fuchsia"))] { + } else if #[cfg(target_os = "linux")] { mod linux; pub use self::linux::*; } else if #[cfg(target_os = "android")] { diff --git a/vendor/libc/src/unix/solaris/mod.rs b/vendor/libc/src/unix/solaris/mod.rs index f285191677..c4ec111b42 100644 --- a/vendor/libc/src/unix/solaris/mod.rs +++ b/vendor/libc/src/unix/solaris/mod.rs @@ -1195,6 +1195,9 @@ pub const PORT_SOURCE_FILE: ::c_int = 7; pub const PORT_SOURCE_POSTWAIT: ::c_int = 8; pub const PORT_SOURCE_SIGNAL: ::c_int = 9; +pub const TIOCGWINSZ: ::c_int = 0x5468; +pub const TIOCSWINSZ: ::c_int = 0x5467; + pub const EPOLLIN: ::c_int = 0x1; pub const EPOLLPRI: ::c_int = 0x2; pub const EPOLLOUT: ::c_int = 0x4; @@ -1255,6 +1258,12 @@ f! { } 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 getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; pub fn freeifaddrs(ifa: *mut ::ifaddrs); @@ -1455,4 +1464,6 @@ extern { pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; + + pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; } diff --git a/vendor/libc/src/unix/uclibc/mips/mod.rs b/vendor/libc/src/unix/uclibc/mips/mod.rs index d197249d05..27f6fe5846 100644 --- a/vendor/libc/src/unix/uclibc/mips/mod.rs +++ b/vendor/libc/src/unix/uclibc/mips/mod.rs @@ -226,8 +226,8 @@ pub const SO_BPF_EXTENSIONS: ::c_int = 48; 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_ONSTACK: ::c_uint = 0x08000000; +pub const SA_SIGINFO: ::c_uint = 0x00000008; pub const SA_NOCLDWAIT: ::c_int = 0x00010000; pub const SIGCHLD: ::c_int = 18; diff --git a/vendor/libc/src/unix/uclibc/mod.rs b/vendor/libc/src/unix/uclibc/mod.rs index e3606c2266..9d8e97e781 100644 --- a/vendor/libc/src/unix/uclibc/mod.rs +++ b/vendor/libc/src/unix/uclibc/mod.rs @@ -391,7 +391,12 @@ s! { pub ssi_utime: ::uint64_t, pub ssi_stime: ::uint64_t, pub ssi_addr: ::uint64_t, - _pad: [::uint8_t; 48], + 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 { @@ -1546,6 +1551,12 @@ f! { } 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 fdatasync(fd: ::c_int) -> ::c_int; pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int; @@ -1634,6 +1645,8 @@ extern { 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(fildes: ::c_int, path: *const ::c_char, + buf: *mut stat64, flag: ::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; @@ -1853,6 +1866,8 @@ extern { pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); + pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; + pub fn telldir(dirp: *mut ::DIR) -> ::c_long; pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; @@ -1941,7 +1956,7 @@ extern { } cfg_if! { - if #[cfg(target_arch = "mips")] { + if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] { mod mips; pub use self::mips::*; } else if #[cfg(target_arch = "x86_64")] { diff --git a/vendor/libc/src/windows/gnu.rs b/vendor/libc/src/windows/gnu.rs new file mode 100644 index 0000000000..a67af15a8f --- /dev/null +++ b/vendor/libc/src/windows/gnu.rs @@ -0,0 +1,8 @@ +pub const L_tmpnam: ::c_uint = 14; +pub const TMP_MAX: ::c_uint = 0x7fff; + +extern { + 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; +} diff --git a/vendor/libc/src/windows.rs b/vendor/libc/src/windows/mod.rs similarity index 54% rename from vendor/libc/src/windows.rs rename to vendor/libc/src/windows/mod.rs index bdb0e02f1b..f46eb362d8 100644 --- a/vendor/libc/src/windows.rs +++ b/vendor/libc/src/windows/mod.rs @@ -1,5 +1,33 @@ //! 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; +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 = i32; pub type c_ulong = u32; @@ -66,6 +94,9 @@ s! { } } +pub const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + pub const EXIT_FAILURE: ::c_int = 1; pub const EXIT_SUCCESS: ::c_int = 0; pub const RAND_MAX: ::c_int = 32767; @@ -80,18 +111,6 @@ pub const BUFSIZ: ::c_uint = 512; pub const FOPEN_MAX: ::c_uint = 20; pub const FILENAME_MAX: ::c_uint = 260; -cfg_if! { - if #[cfg(all(target_env = "gnu"))] { - pub const L_tmpnam: ::c_uint = 14; - pub const TMP_MAX: ::c_uint = 0x7fff; - } else if #[cfg(all(target_env = "msvc"))] { - pub const L_tmpnam: ::c_uint = 260; - pub const TMP_MAX: ::c_uint = 0x7fff_ffff; - } else { - // Unknown target_env - } -} - pub const O_RDONLY: ::c_int = 0; pub const O_WRONLY: ::c_int = 1; pub const O_RDWR: ::c_int = 2; @@ -159,12 +178,115 @@ pub const EILSEQ: ::c_int = 42; pub const STRUNCATE: ::c_int = 80; // inline comment below appeases style checker -#[cfg(all(target_env = "msvc", feature = "stdbuild"))] // " if " +#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if " #[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))] #[link(name = "libcmt", cfg(target_feature = "crt-static"))] extern {} +pub enum FILE {} +pub enum fpos_t {} // TODO: fill this out with a struct + 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 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); + #[link_name = "_chmod"] pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int; #[link_name = "_wchmod"] @@ -246,3 +368,33 @@ extern { pub fn wsetlocale(category: ::c_int, locale: *const wchar_t) -> *mut wchar_t; } + +cfg_if! { + if #[cfg(core_cvoid)] { + pub use core::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)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} + +cfg_if! { + if #[cfg(all(target_env = "gnu"))] { + mod gnu; + pub use self::gnu::*; + } else if #[cfg(all(target_env = "msvc"))] { + mod msvc; + pub use self::msvc::*; + } else { + // Unknown target_env + } +} \ No newline at end of file diff --git a/vendor/libc/src/windows/msvc.rs b/vendor/libc/src/windows/msvc.rs new file mode 100644 index 0000000000..9e2a9b9e5d --- /dev/null +++ b/vendor/libc/src/windows/msvc.rs @@ -0,0 +1,10 @@ +pub const L_tmpnam: ::c_uint = 260; +pub const TMP_MAX: ::c_uint = 0x7fff_ffff; + +extern { + #[link_name = "_stricmp"] + pub fn stricmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int; + #[link_name = "_strnicmp"] + pub fn strnicmp(s1: *const ::c_char, s2: *const ::c_char, + n: ::size_t) -> ::c_int; +} \ No newline at end of file diff --git a/vendor/tar/.cargo-checksum.json b/vendor/tar/.cargo-checksum.json index 27dd792817..f26644c5d6 100644 --- a/vendor/tar/.cargo-checksum.json +++ b/vendor/tar/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo_vcs_info.json":"723e3dfd7efc6d3b0143b12a9582da24e78d5d2ea33b1b12e764604fac1d33ca",".travis.yml":"7e7b65c7e672f67b07618b95405fdf1dd500d20cc4bc9e21ae3bb0e8d994581b","Cargo.toml":"1967dcf5e3e1c431c025d4bf63c7b986608e0dab574a5cb09c859380e786b0a6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"e16ec1c38809cfef4b67a4a8b521d2c679832379eddedba5212444dbb3d1f436","appveyor.yml":"2b698d8ab9a0b4b3781eb592d5d688f8b79c7e8044c9ccb3f3c5b5593fe1fb3b","examples/extract_file.rs":"dc487f6631d824175afc3ee33de99e80718a8ca3f9e57fddd7cac0a46c07d3ae","examples/list.rs":"36e412205eaffea8ab7f39be4173594b74e36acb369e091362b1975ee4a7a14b","examples/raw_list.rs":"0a735576ac354457d6d5a4d395d044fae99bf67a7c69960ca784a6f6a1743651","examples/write.rs":"419ac3e4155035e32b52cd8e6ae987a2d99cf82f60abbfb315c2a2c4f8e8fd19","src/archive.rs":"950e9ec8ea384960a588a04700bde3cf3c9012cc95353a335c546f24584af19c","src/builder.rs":"d06a9b84cabbf416a6e16adf85b1cda5746147cefe2393d56882bb7cb8b125ad","src/entry.rs":"9ed91397b9193a98c71c1052e7490625f4d5375d6bed8ae754404975cb82a890","src/entry_type.rs":"0786688729a96b4a3135b28d40b95c3d4feaad66b9574c490cbea14814ab975f","src/error.rs":"64652621ecf5c605e8905c5dd004cacd9facfa1222b2ea215907d1d0b0ddbcc2","src/header.rs":"c4133eee35ad1c03ba8199138460870005517c2c2060b02cfa426e5cf2bcc1e1","src/lib.rs":"363287c4b12262fab344ead58de40da38abbe53e68f18813aa067af3e7627cc2","src/pax.rs":"a2ba8cdd4dd18963e115940548928af1a2ccf5c610d1168b649b5d555d87b328","tests/all.rs":"50cdbede1ea3d62df7627e92080127308a4e3722ebb8fd3c61a3bf4bdcdcbf28","tests/archives/directory.tar":"ada2bda5ee257056ef9fbe6338f66f7188c9f32614991d73f83005b7972802f3","tests/archives/duplicate_dirs.tar":"7732db3e60c56e4bdf027021347b301452bcce66e83f2cfb4d4aa44e1b219a28","tests/archives/empty_filename.tar":"c58a599a8d6342841a7bff96f49e94fd779b96ab5d4f93795577b504afe1060a","tests/archives/file_times.tar":"35e1d58c149dafe0ec57793eedd14f4c3e7d36768d4068650a6cde63de014ba9","tests/archives/link.tar":"06ce2045e1d97d617821e7257721d446c876065a665a38bea6d5e9ce31a52f59","tests/archives/pax.tar":"ae37540f6940aad3707491ce2f37d0998cbee480919b1e6566794748cae9a097","tests/archives/pax2.tar":"08449d2fb749a303d8ec2e0e64aac882b1e6be756d2a0d33df839b55fb415423","tests/archives/reading_files.tar":"543b51829fbd4c5df77f873c63380c960c6dbea244999030cf7672b0b3a456a2","tests/archives/simple.tar":"1c3b1e2a39e83b85a8ee5c920aa3ed809cee2eeaa40b0ed79f10dfea91826daf","tests/archives/simple_missing_last_header.tar":"84fd3abb8bde47caed14ecb1e32b1fbf9a2eab1341b70db8085d2375f0f88cd6","tests/archives/spaces.tar":"4f7d19a9fe2785e97a128d27263dee9d9df2fd8866dcece9fb44dcf20c2c0b24","tests/archives/sparse.tar":"64db241afcbfd9ced33a9482c577774f47c74cbd835207478ec235946c3c639d","tests/archives/xattrs.tar":"6df389a5be73fe184c0427d74a1689cce6af0d3488b270acdf3224e3b3f4acbb","tests/entry.rs":"f3bfbad2db9d4f8c63068f30e07930a26328b024bf01a6b1c2bf32d81f0d2e6b","tests/header/mod.rs":"8a8b396acb7db823f2b28da6199c18f5505f9a8e598acb705131e1a5f4835feb"},"package":"69e16840a1e0a1f1a880b739ef1cc6a4b85496c99b8aa786ccffce6e0c15624c"} \ No newline at end of file +{"files":{".cargo_vcs_info.json":"ae840ab6e4975df17d9fb534277d033547336e9a7960367d7612fa73875abc81",".travis.yml":"7e7b65c7e672f67b07618b95405fdf1dd500d20cc4bc9e21ae3bb0e8d994581b","Cargo.toml":"2104f2b8501d861ee4c5f1c7df609dbfbb182c0c3006c1272c24e4224c5a8ed1","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"e16ec1c38809cfef4b67a4a8b521d2c679832379eddedba5212444dbb3d1f436","appveyor.yml":"2b698d8ab9a0b4b3781eb592d5d688f8b79c7e8044c9ccb3f3c5b5593fe1fb3b","examples/extract_file.rs":"dc487f6631d824175afc3ee33de99e80718a8ca3f9e57fddd7cac0a46c07d3ae","examples/list.rs":"36e412205eaffea8ab7f39be4173594b74e36acb369e091362b1975ee4a7a14b","examples/raw_list.rs":"0a735576ac354457d6d5a4d395d044fae99bf67a7c69960ca784a6f6a1743651","examples/write.rs":"419ac3e4155035e32b52cd8e6ae987a2d99cf82f60abbfb315c2a2c4f8e8fd19","src/archive.rs":"950e9ec8ea384960a588a04700bde3cf3c9012cc95353a335c546f24584af19c","src/builder.rs":"d06a9b84cabbf416a6e16adf85b1cda5746147cefe2393d56882bb7cb8b125ad","src/entry.rs":"099ddd432a57f43183aec20afdc1289a1b0a57f36b39ff1fa279327d0a1b7cce","src/entry_type.rs":"0786688729a96b4a3135b28d40b95c3d4feaad66b9574c490cbea14814ab975f","src/error.rs":"64652621ecf5c605e8905c5dd004cacd9facfa1222b2ea215907d1d0b0ddbcc2","src/header.rs":"c4133eee35ad1c03ba8199138460870005517c2c2060b02cfa426e5cf2bcc1e1","src/lib.rs":"363287c4b12262fab344ead58de40da38abbe53e68f18813aa067af3e7627cc2","src/pax.rs":"a2ba8cdd4dd18963e115940548928af1a2ccf5c610d1168b649b5d555d87b328","tests/all.rs":"c12316d125b7ff13118371af6e5f1a2e2a7ee84386209648a08240769be3609e","tests/archives/directory.tar":"ada2bda5ee257056ef9fbe6338f66f7188c9f32614991d73f83005b7972802f3","tests/archives/duplicate_dirs.tar":"7732db3e60c56e4bdf027021347b301452bcce66e83f2cfb4d4aa44e1b219a28","tests/archives/empty_filename.tar":"c58a599a8d6342841a7bff96f49e94fd779b96ab5d4f93795577b504afe1060a","tests/archives/file_times.tar":"35e1d58c149dafe0ec57793eedd14f4c3e7d36768d4068650a6cde63de014ba9","tests/archives/link.tar":"06ce2045e1d97d617821e7257721d446c876065a665a38bea6d5e9ce31a52f59","tests/archives/pax.tar":"ae37540f6940aad3707491ce2f37d0998cbee480919b1e6566794748cae9a097","tests/archives/pax2.tar":"08449d2fb749a303d8ec2e0e64aac882b1e6be756d2a0d33df839b55fb415423","tests/archives/reading_files.tar":"543b51829fbd4c5df77f873c63380c960c6dbea244999030cf7672b0b3a456a2","tests/archives/simple.tar":"1c3b1e2a39e83b85a8ee5c920aa3ed809cee2eeaa40b0ed79f10dfea91826daf","tests/archives/simple_missing_last_header.tar":"84fd3abb8bde47caed14ecb1e32b1fbf9a2eab1341b70db8085d2375f0f88cd6","tests/archives/spaces.tar":"4f7d19a9fe2785e97a128d27263dee9d9df2fd8866dcece9fb44dcf20c2c0b24","tests/archives/sparse.tar":"64db241afcbfd9ced33a9482c577774f47c74cbd835207478ec235946c3c639d","tests/archives/xattrs.tar":"6df389a5be73fe184c0427d74a1689cce6af0d3488b270acdf3224e3b3f4acbb","tests/entry.rs":"f3bfbad2db9d4f8c63068f30e07930a26328b024bf01a6b1c2bf32d81f0d2e6b","tests/header/mod.rs":"8a8b396acb7db823f2b28da6199c18f5505f9a8e598acb705131e1a5f4835feb"},"package":"a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2"} \ No newline at end of file diff --git a/vendor/tar/.cargo_vcs_info.json b/vendor/tar/.cargo_vcs_info.json index c51af93f9f..3386cc1d3a 100644 --- a/vendor/tar/.cargo_vcs_info.json +++ b/vendor/tar/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "0f8e2360fe3e6dee74fb0a686c34c80aa5a5271f" + "sha1": "8417a7c3694b39fc32bf936533635c20e764166b" } } diff --git a/vendor/tar/Cargo.toml b/vendor/tar/Cargo.toml index a7a1c33f6a..18568f8fe3 100644 --- a/vendor/tar/Cargo.toml +++ b/vendor/tar/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "tar" -version = "0.4.19" +version = "0.4.20" authors = ["Alex Crichton "] 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" homepage = "https://github.com/alexcrichton/tar-rs" diff --git a/vendor/tar/src/entry.rs b/vendor/tar/src/entry.rs index 5cffbce272..fdddf6fde8 100644 --- a/vendor/tar/src/entry.rs +++ b/vendor/tar/src/entry.rs @@ -499,7 +499,7 @@ impl<'a> EntryFields<'a> { // 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.header.path_bytes().ends_with(b"/") + && self.path_bytes().ends_with(b"/") { return self.unpack_dir(dst); } diff --git a/vendor/tar/tests/all.rs b/vendor/tar/tests/all.rs index 20615c8408..2ae40235b1 100644 --- a/vendor/tar/tests/all.rs +++ b/vendor/tar/tests/all.rs @@ -934,3 +934,36 @@ fn append_path_symlink() { assert!(entries.next().is_none()); } + +#[test] +fn name_with_slash_doesnt_fool_long_link_and_bsd_compat() { + let td = t!(TempDir::new("tar-rs")); + + let mut ar = Builder::new(Vec::new()); + + let mut h = Header::new_gnu(); + t!(h.set_path("././@LongLink")); + h.set_size(4); + h.set_entry_type(EntryType::new(b'L')); + h.set_cksum(); + t!(ar.append(&h, "foo\0".as_bytes())); + + let mut header = Header::new_gnu(); + header.set_entry_type(EntryType::Regular); + t!(header.set_path("testdir/")); + header.set_size(0); + header.set_cksum(); + t!(ar.append(&header, &mut io::empty())); + + // Extracting + let rdr = Cursor::new(t!(ar.into_inner())); + let mut ar = Archive::new(rdr); + t!(ar.unpack(td.path())); + + // Iterating + let rdr = Cursor::new(ar.into_inner().into_inner()); + let mut ar = Archive::new(rdr); + assert!(t!(ar.entries()).all(|fr| fr.is_ok())); + + assert!(td.path().join("foo").is_file()); +} diff --git a/version b/version index b52b5e1067..a16c8d2ee7 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.32.0-beta.2 (a01e4761a 2018-12-08) \ No newline at end of file +1.32.0 (9fda7c223 2019-01-16) \ No newline at end of file