diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dacf929278ab9..32c18cab09902 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -326,7 +326,7 @@ jobs: NO_DEBUG_ASSERTIONS: 1 NO_OVERFLOW_CHECKS: 1 DIST_REQUIRE_ALL_TOOLS: 1 - os: macos-12-xl + os: macos-latest - name: dist-apple-various env: SCRIPT: "./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim" @@ -337,7 +337,7 @@ jobs: NO_LLVM_ASSERTIONS: 1 NO_DEBUG_ASSERTIONS: 1 NO_OVERFLOW_CHECKS: 1 - os: macos-12-xl + os: macos-latest - name: dist-x86_64-apple-alt env: SCRIPT: "./x.py dist bootstrap --include-default-paths" @@ -348,7 +348,7 @@ jobs: NO_LLVM_ASSERTIONS: 1 NO_DEBUG_ASSERTIONS: 1 NO_OVERFLOW_CHECKS: 1 - os: macos-12-xl + os: macos-latest - name: x86_64-apple-1 env: SCRIPT: "./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps" @@ -359,7 +359,7 @@ jobs: NO_LLVM_ASSERTIONS: 1 NO_DEBUG_ASSERTIONS: 1 NO_OVERFLOW_CHECKS: 1 - os: macos-12-xl + os: macos-latest - name: x86_64-apple-2 env: SCRIPT: "./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps" @@ -370,7 +370,7 @@ jobs: NO_LLVM_ASSERTIONS: 1 NO_DEBUG_ASSERTIONS: 1 NO_OVERFLOW_CHECKS: 1 - os: macos-12-xl + os: macos-latest - name: dist-aarch64-apple env: SCRIPT: "./x.py dist bootstrap --include-default-paths --stage 2" @@ -385,7 +385,7 @@ jobs: NO_OVERFLOW_CHECKS: 1 DIST_REQUIRE_ALL_TOOLS: 1 JEMALLOC_SYS_WITH_LG_PAGE: 14 - os: macos-12-xl + os: macos-latest - name: x86_64-msvc-1 env: RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler" diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 79eb31bb1050e..51418c01eedb4 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1400,7 +1400,8 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE pub fn rustc_short_optgroups() -> Vec { vec![ opt::flag_s("h", "help", "Display this message"), - opt::multi_s("", "cfg", "Configure the compilation environment", "SPEC"), + opt::multi_s("", "cfg", "Configure the compilation environment. + SPEC supports the syntax `NAME[=\"VALUE\"]`.", "SPEC"), opt::multi("", "check-cfg", "Provide list of valid cfg options for checking", "SPEC"), opt::multi_s( "L", diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs index f6698589ccd92..75c104ce2fad0 100644 --- a/library/core/src/hint.rs +++ b/library/core/src/hint.rs @@ -217,17 +217,14 @@ pub fn spin_loop() { /// Note however, that `black_box` is only (and can only be) provided on a "best-effort" basis. The /// extent to which it can block optimisations may vary depending upon the platform and code-gen /// backend used. Programs cannot rely on `black_box` for *correctness*, beyond it behaving as the -/// identity function. +/// identity function. As such, it **must not be relied upon to control critical program behavior.** +/// This _immediately_ precludes any direct use of this function for cryptographic or security +/// purposes. /// /// [`std::convert::identity`]: crate::convert::identity /// /// # When is this useful? /// -/// First and foremost: `black_box` does _not_ guarantee any exact behavior and, in some cases, may -/// do nothing at all. As such, it **must not be relied upon to control critical program behavior.** -/// This _immediately_ precludes any direct use of this function for cryptographic or security -/// purposes. -/// /// While not suitable in those mission-critical cases, `black_box`'s functionality can generally be /// relied upon for benchmarking, and should be used there. It will try to ensure that the /// compiler doesn't optimize away part of the intended test code based on context. For diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 55580b23a6249..42a68496fc491 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2515,9 +2515,10 @@ impl AsInnerMut for DirBuilder { /// This function will traverse symbolic links to query information about the /// destination file. In case of broken symbolic links this will return `Ok(false)`. /// -/// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors -/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission -/// denied on some of the parent directories.) +/// As opposed to the [`Path::exists`] method, this will only return `Ok(true)` or `Ok(false)` +/// if the path was _verified_ to exist or not exist. If its existence can neither be confirmed +/// nor denied, an `Err(_)` will be propagated instead. This can be the case if e.g. listing +/// permission is denied on one of the parent directories. /// /// Note that while this avoids some pitfalls of the `exists()` method, it still can not /// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 8014ba992eaf8..e5abd02a1bc53 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2844,9 +2844,11 @@ impl Path { /// This function will traverse symbolic links to query information about the /// destination file. In case of broken symbolic links this will return `Ok(false)`. /// - /// As opposed to the [`exists()`] method, this one doesn't silently ignore errors - /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission - /// denied on some of the parent directories.) + /// [`Path::exists()`] only checks whether or not a path was both found and readable. By + /// contrast, `try_exists` will return `Ok(true)` or `Ok(false)`, respectively, if the path + /// was _verified_ to exist or not exist. If its existence can neither be confirmed nor + /// denied, it will propagate an `Err(_)` instead. This can be the case if e.g. listing + /// permission is denied on one of the parent directories. /// /// Note that while this avoids some pitfalls of the `exists()` method, it still can not /// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios diff --git a/library/std/src/sys/wasi/mod.rs b/library/std/src/sys/wasi/mod.rs index 1dc3f2b20266d..c468ae395fc8d 100644 --- a/library/std/src/sys/wasi/mod.rs +++ b/library/std/src/sys/wasi/mod.rs @@ -32,8 +32,6 @@ pub mod io; #[path = "../unsupported/locks/mod.rs"] pub mod locks; pub mod net; -#[path = "../unsupported/once.rs"] -pub mod once; pub mod os; #[path = "../unix/os_str.rs"] pub mod os_str; @@ -51,6 +49,13 @@ pub mod thread_local_dtor; pub mod thread_local_key; pub mod time; +cfg_if::cfg_if! { + if #[cfg(not(target_feature = "atomics"))] { + #[path = "../unsupported/once.rs"] + pub mod once; + } +} + #[path = "../unsupported/common.rs"] #[deny(unsafe_op_in_unsafe_fn)] #[allow(unused)] diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 8c7798aad8bdf..8409b9ca56993 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -82,7 +82,7 @@ x--expand-yaml-anchors--remove: <<: *base-job - &job-macos-xl - os: macos-12-xl + os: macos-latest # We use the standard runner for now <<: *base-job - &job-windows-8c diff --git a/src/doc/rustdoc/src/how-to-read-rustdoc.md b/src/doc/rustdoc/src/how-to-read-rustdoc.md index 56342f65d9998..393192af01e98 100644 --- a/src/doc/rustdoc/src/how-to-read-rustdoc.md +++ b/src/doc/rustdoc/src/how-to-read-rustdoc.md @@ -43,7 +43,7 @@ including automatic and blanket implementations that `rustdoc` knows about. Subheadings, variants, fields, and many other things in this documentation are anchors and can be clicked on and deep-linked to, which is a great way to communicate exactly what you're talking about. -The typograpical character "§" appears next to lines with anchors on them +The typographical character "§" appears next to lines with anchors on them when hovered or given keyboard focus. ## The Navigation Bar diff --git a/src/doc/rustdoc/src/references.md b/src/doc/rustdoc/src/references.md index 45cf4e88eef6b..2e0cb1c0af4cd 100644 --- a/src/doc/rustdoc/src/references.md +++ b/src/doc/rustdoc/src/references.md @@ -13,15 +13,15 @@ If you know of other great resources, please submit a pull request! ## Community - [API Guidelines] -- [Github tagged RFCs] -- [Github tagged issues] +- [GitHub tagged RFCs] +- [GitHub tagged issues] - [RFC (stalled) front page styleguide] - [Guide on how to write documentation for a Rust crate] [API Guidelines]: https://rust-lang.github.io/api-guidelines/documentation.html -[Github tagged RFCs]: https://github.com/rust-lang/rfcs/issues?q=label%3AT-rustdoc -[Github tagged issues]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AT-rustdoc +[GitHub tagged RFCs]: https://github.com/rust-lang/rfcs/issues?q=label%3AT-rustdoc +[GitHub tagged issues]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AT-rustdoc [Guide on how to write documentation for a Rust crate]: https://blog.guillaume-gomez.fr/articles/2020-03-12+Guide+on+how+to+write+documentation+for+a+Rust+crate [Learn Rust]: https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments [RFC 1574: More API Documentation Conventions]: https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html diff --git a/tests/rustdoc-json/reexport/auxiliary/enum_with_discriminant.rs b/tests/rustdoc-json/reexport/auxiliary/enum_with_discriminant.rs new file mode 100644 index 0000000000000..4fa26204be917 --- /dev/null +++ b/tests/rustdoc-json/reexport/auxiliary/enum_with_discriminant.rs @@ -0,0 +1,6 @@ +//! Should not be inlined + +/// Should not be inlined +pub enum O { + L = -1, +} diff --git a/tests/rustdoc-json/reexport/doc_inline_external_crate.rs b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs new file mode 100644 index 0000000000000..40b681d7dbbef --- /dev/null +++ b/tests/rustdoc-json/reexport/doc_inline_external_crate.rs @@ -0,0 +1,10 @@ +// Regression Test for https://github.com/rust-lang/rust/issues/110138 +// aux-build: enum_with_discriminant.rs + +#[doc(inline)] +pub extern crate enum_with_discriminant; + +// @!has '$.index[*][?(@.docs == "Should not be inlined")]' +// @is '$.index[*][?(@.name == "enum_with_discriminant")].kind' '"extern_crate"' +// @set enum_with_discriminant = '$.index[*][?(@.name == "enum_with_discriminant")].id' +// @is '$.index[*][?(@.name == "doc_inline_external_crate")].inner.items[*]' $enum_with_discriminant diff --git a/tests/rustdoc-json/reexport/extern_crate_glob.rs b/tests/rustdoc-json/reexport/extern_crate_glob.rs new file mode 100644 index 0000000000000..8efb94fd3f17a --- /dev/null +++ b/tests/rustdoc-json/reexport/extern_crate_glob.rs @@ -0,0 +1,10 @@ +// aux-build: enum_with_discriminant.rs + +extern crate enum_with_discriminant; + +#[doc(inline)] +pub use enum_with_discriminant::*; + +// @!has '$.index[*][?(@.docs == "Should not be inlined")]' +// @set use = '$.index[*][?(@.inner.name == "enum_with_discriminant")].id' +// @is '$.index[*][?(@.name == "extern_crate_glob")].inner.items[*]' $use diff --git a/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs b/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs deleted file mode 100644 index 6c48f5aa01f98..0000000000000 --- a/tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub enum O { - L = -1, -} diff --git a/tests/rustdoc-ui/intra-doc/inline-external-enum.rs b/tests/rustdoc-ui/intra-doc/inline-external-enum.rs deleted file mode 100644 index 363dd7f64c225..0000000000000 --- a/tests/rustdoc-ui/intra-doc/inline-external-enum.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check-pass -// aux-build: inner-crate-enum.rs -// compile-flags:-Z unstable-options --output-format json - -#[doc(inline)] -pub extern crate inner_crate_enum; - -fn main() {} diff --git a/tests/ui/associated-inherent-types/const-generics.rs b/tests/ui/associated-inherent-types/const-generics.rs new file mode 100644 index 0000000000000..5b7c00bccba70 --- /dev/null +++ b/tests/ui/associated-inherent-types/const-generics.rs @@ -0,0 +1,23 @@ +// Regression test for issue #109759. +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Foo; + +struct Bar([(); X]); + +impl Bar { + pub fn new() -> Self { + Self([(); X]) + } +} + +impl Foo { + type Bar = Bar; +} + +fn main() { + let _ = Foo::Bar::<10>::new(); +} diff --git a/tests/ui/associated-inherent-types/generic-const-exprs.rs b/tests/ui/associated-inherent-types/generic-const-exprs.rs new file mode 100644 index 0000000000000..a4ac0ecfa4cf9 --- /dev/null +++ b/tests/ui/associated-inherent-types/generic-const-exprs.rs @@ -0,0 +1,28 @@ +// check-pass + +#![feature(inherent_associated_types, generic_const_exprs)] +#![allow(incomplete_features)] + +struct Parent; + +impl Parent { + type Mapping = Store<{ O + I }> + where + [(); O + I]: + ; +} + +struct Store; + +impl Store { + const REIFIED: usize = N; + + fn reify() -> usize { + N + } +} + +fn main() { + let _ = Parent::<2>::Mapping::<{ 12 * 2 }>::REIFIED; + let _ = Parent::<1>::Mapping::<{ 2 * 5 }>::reify(); +} diff --git a/tests/ui/process/process-sigpipe.rs b/tests/ui/process/process-sigpipe.rs index 7ae14c6b84d2f..4f4db11911594 100644 --- a/tests/ui/process/process-sigpipe.rs +++ b/tests/ui/process/process-sigpipe.rs @@ -8,14 +8,14 @@ // libstd ignores SIGPIPE, and other libraries may set signal masks. // Make sure that these behaviors don't get inherited to children // spawned via std::process, since they're needed for traditional UNIX -// filter behavior. This test checks that `yes | head` terminates +// filter behavior. +// This test checks that `while echo y ; do : ; done | head` terminates // (instead of running forever), and that it does not print an error // message about a broken pipe. // ignore-emscripten no threads support // ignore-vxworks no 'sh' // ignore-fuchsia no 'sh' -// ignore-nto no 'yes' use std::process; use std::thread; @@ -27,7 +27,11 @@ fn main() { thread::sleep_ms(5000); process::exit(1); }); - let output = process::Command::new("sh").arg("-c").arg("yes | head").output().unwrap(); + let output = process::Command::new("sh") + .arg("-c") + .arg("while echo y ; do : ; done | head") + .output() + .unwrap(); assert!(output.status.success()); assert!(output.stderr.len() == 0); }