diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index ac98dd5801e40..0cb70de241596 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -440,6 +440,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } } + if Some(trait_ref.def_id()) == tcx.lang_items().drop_trait() + && predicate_is_const + { + err.note("`~const Drop` was renamed to `~const Destruct`"); + err.note("See for more details"); + } + let explanation = if let ObligationCauseCode::MainFunctionType = obligation.cause.code() { diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index dcae58ae590f1..488671d8d8d19 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -2593,14 +2593,15 @@ impl VecDeque { /// ``` /// /// If you want to insert an item to a sorted deque, while maintaining - /// sort order: + /// sort order, consider using [`partition_point`]: /// /// ``` /// use std::collections::VecDeque; /// /// let mut deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into(); /// let num = 42; - /// let idx = deque.binary_search(&num).unwrap_or_else(|x| x); + /// let idx = deque.partition_point(|&x| x < num); + /// // The above is equivalent to `let idx = deque.binary_search(&num).unwrap_or_else(|x| x);` /// deque.insert(idx, num); /// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); /// ``` @@ -2744,6 +2745,19 @@ impl VecDeque { /// assert!(deque.iter().take(i).all(|&x| x < 5)); /// assert!(deque.iter().skip(i).all(|&x| !(x < 5))); /// ``` + /// + /// If you want to insert an item to a sorted deque, while maintaining + /// sort order: + /// + /// ``` + /// use std::collections::VecDeque; + /// + /// let mut deque: VecDeque<_> = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into(); + /// let num = 42; + /// let idx = deque.partition_point(|&x| x < num); + /// deque.insert(idx, num); + /// assert_eq!(deque, &[0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); + /// ``` #[stable(feature = "vecdeque_binary_search", since = "1.54.0")] pub fn partition_point

(&self, mut pred: P) -> usize where diff --git a/library/alloc/tests/thin_box.rs b/library/alloc/tests/thin_box.rs index 0fe6aaa4d0048..51d2e9324bf2e 100644 --- a/library/alloc/tests/thin_box.rs +++ b/library/alloc/tests/thin_box.rs @@ -1,5 +1,5 @@ -use alloc::boxed::ThinBox; use core::mem::size_of; +use std::boxed::ThinBox; #[test] fn want_niche_optimization() { diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 2240c297a2531..2a4030de00b4e 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -2331,12 +2331,13 @@ impl [T] { /// ``` /// /// If you want to insert an item to a sorted vector, while maintaining - /// sort order: + /// sort order, consider using [`partition_point`]: /// /// ``` /// let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let num = 42; - /// let idx = s.binary_search(&num).unwrap_or_else(|x| x); + /// let idx = s.partition_point(|&x| x < num); + /// // The above is equivalent to `let idx = s.binary_search(&num).unwrap_or_else(|x| x);` /// s.insert(idx, num); /// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); /// ``` @@ -3743,6 +3744,17 @@ impl [T] { /// assert!(v[..i].iter().all(|&x| x < 5)); /// assert!(v[i..].iter().all(|&x| !(x < 5))); /// ``` + /// + /// If you want to insert an item to a sorted vector, while maintaining + /// sort order: + /// + /// ``` + /// let mut s = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; + /// let num = 42; + /// let idx = s.partition_point(|&x| x < num); + /// s.insert(idx, num); + /// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]); + /// ``` #[stable(feature = "partition_point", since = "1.52.0")] #[must_use] pub fn partition_point

(&self, mut pred: P) -> usize diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 8c06a0070139d..0276d15a5b472 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -621,9 +621,9 @@ impl<'a> Builder<'a> { pub fn get_help(build: &Build, subcommand: &str) -> Option { let kind = match subcommand { - "build" => Kind::Build, - "doc" => Kind::Doc, - "test" => Kind::Test, + "build" | "b" => Kind::Build, + "doc" | "d" => Kind::Doc, + "test" | "t" => Kind::Test, "bench" => Kind::Bench, "dist" => Kind::Dist, "install" => Kind::Install, diff --git a/src/doc/rustc/src/linker-plugin-lto.md b/src/doc/rustc/src/linker-plugin-lto.md index 941c65922d8f0..e7bf8d9a36f25 100644 --- a/src/doc/rustc/src/linker-plugin-lto.md +++ b/src/doc/rustc/src/linker-plugin-lto.md @@ -136,7 +136,7 @@ able to get around this problem by setting `-Clinker=lld-link` in RUSTFLAGS ```sh rustup toolchain install --profile minimal nightly MINOR_VERSION=$(rustc +nightly --version | cut -d . -f 2) -LOWER_BOUND=44 +LOWER_BOUND=61 llvm_version() { toolchain="$1" @@ -179,5 +179,19 @@ The following table shows known good combinations of toolchain versions. | Rust 1.44 | Clang 9 | | Rust 1.45 | Clang 10 | | Rust 1.46 | Clang 10 | +| Rust 1.47 | Clang 11 | +| Rust 1.48 | Clang 11 | +| Rust 1.49 | Clang 11 | +| Rust 1.50 | Clang 11 | +| Rust 1.51 | Clang 11 | +| Rust 1.52 | Clang 12 | +| Rust 1.53 | Clang 12 | +| Rust 1.54 | Clang 12 | +| Rust 1.55 | Clang 12 | +| Rust 1.56 | Clang 13 | +| Rust 1.57 | Clang 13 | +| Rust 1.58 | Clang 13 | +| Rust 1.59 | Clang 13 | +| Rust 1.60 | Clang 14 | Note that the compatibility policy for this feature might change in the future. diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 32def67ed65e3..b3c4a52c414b2 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -31,18 +31,20 @@ All tier 1 targets with host tools support the full standard library. target | notes -------|------- `aarch64-unknown-linux-gnu` | ARM64 Linux (kernel 4.2, glibc 2.17+) [^missing-stack-probes] -`i686-pc-windows-gnu` | 32-bit MinGW (Windows 7+) -`i686-pc-windows-msvc` | 32-bit MSVC (Windows 7+) +`i686-pc-windows-gnu` | 32-bit MinGW (Windows 7+) [^windows-support] +`i686-pc-windows-msvc` | 32-bit MSVC (Windows 7+) [^windows-support] `i686-unknown-linux-gnu` | 32-bit Linux (kernel 2.6.32+, glibc 2.11+) `x86_64-apple-darwin` | 64-bit macOS (10.7+, Lion+) -`x86_64-pc-windows-gnu` | 64-bit MinGW (Windows 7+) -`x86_64-pc-windows-msvc` | 64-bit MSVC (Windows 7+) +`x86_64-pc-windows-gnu` | 64-bit MinGW (Windows 7+) [^windows-support] +`x86_64-pc-windows-msvc` | 64-bit MSVC (Windows 7+) [^windows-support] `x86_64-unknown-linux-gnu` | 64-bit Linux (kernel 2.6.32+, glibc 2.11+) [^missing-stack-probes]: Stack probes support is missing on `aarch64-unknown-linux-gnu`, but it's planned to be implemented in the near future. The implementation is tracked on [issue #77071][77071]. +[^windows-support]: Only Windows 10 currently undergoes automated testing. Earlier versions of Windows rely on testing and support from the community. + [77071]: https://github.com/rust-lang/rust/issues/77071 ## Tier 1 diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e6ef3c26e290a..85a3e05e8b213 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -302,23 +302,13 @@ impl<'a> Clean> for ty::Predicate<'a> { impl<'a> Clean> for ty::PolyTraitPredicate<'a> { fn clean(&self, cx: &mut DocContext<'_>) -> Option { - // `T: ~const Drop` is not equivalent to `T: Drop`, and we don't currently document `~const` bounds - // because of its experimental status, so just don't show these. // `T: ~const Destruct` is hidden because `T: Destruct` is a no-op. if self.skip_binder().constness == ty::BoundConstness::ConstIfConst - && [cx.tcx.lang_items().drop_trait(), cx.tcx.lang_items().destruct_trait()] - .iter() - .any(|tr| *tr == Some(self.skip_binder().def_id())) + && Some(self.skip_binder().def_id()) == cx.tcx.lang_items().destruct_trait() { return None; } - #[cfg(bootstrap)] - { - // FIXME: remove `lang_items().drop_trait()` from above logic, - // as well as the comment about `~const Drop` because it was renamed to `Destruct`. - } - let poly_trait_ref = self.map_bound(|pred| pred.trait_ref); Some(WherePredicate::BoundPredicate { ty: poly_trait_ref.skip_binder().self_ty().clean(cx), diff --git a/src/test/rustdoc/rfc-2632-const-trait-impl.rs b/src/test/rustdoc/rfc-2632-const-trait-impl.rs index c5353c4d5b523..f9173feeeec81 100644 --- a/src/test/rustdoc/rfc-2632-const-trait-impl.rs +++ b/src/test/rustdoc/rfc-2632-const-trait-impl.rs @@ -1,5 +1,5 @@ // Test that we do not currently display `~const` in rustdoc -// as that syntax is currently provisional; `~const Drop` has +// as that syntax is currently provisional; `~const Destruct` has // no effect on stable code so it should be hidden as well. // // To future blessers: make sure that `const_trait_impl` is @@ -8,6 +8,8 @@ #![feature(const_trait_impl)] #![crate_name = "foo"] +use std::marker::Destruct; + pub struct S(T); // @!has foo/trait.Tr.html '//pre[@class="rust trait"]/code/a[@class="trait"]' '~const' @@ -20,22 +22,36 @@ pub trait Tr { // @!has - '//div[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const' // @has - '//div[@id="method.a"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' #[default_method_body_is_const] - fn a() where Option: ~const Clone {} + fn a() + where + Option: ~const Clone + ~const Destruct, + { + } } // @!has - '//section[@id="impl-Tr%3CT%3E"]/h3[@class="code-header in-band"]' '~const' // @has - '//section[@id="impl-Tr%3CT%3E"]/h3[@class="code-header in-band"]/a[@class="trait"]' 'Clone' // @!has - '//section[@id="impl-Tr%3CT%3E"]/h3[@class="code-header in-band"]/span[@class="where"]' '~const' // @has - '//section[@id="impl-Tr%3CT%3E"]/h3[@class="code-header in-band"]/span[@class="where fmt-newline"]' ': Clone' -impl const Tr for T where Option: ~const Clone { - fn a() where Option: ~const Clone {} +impl const Tr for T +where + Option: ~const Clone + ~const Destruct, +{ + fn a() + where + Option: ~const Clone + ~const Destruct, + { + } } // @!has foo/fn.foo.html '//pre[@class="rust fn"]/code/a[@class="trait"]' '~const' // @has - '//pre[@class="rust fn"]/code/a[@class="trait"]' 'Clone' // @!has - '//pre[@class="rust fn"]/code/span[@class="where fmt-newline"]' '~const' // @has - '//pre[@class="rust fn"]/code/span[@class="where fmt-newline"]' ': Clone' -pub const fn foo() where Option: ~const Clone { +pub const fn foo() +where + Option: ~const Clone + ~const Destruct, +{ F::a() } @@ -44,7 +60,10 @@ impl S { // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/a[@class="trait"]' 'Clone' // @!has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where"]' '~const' // @has - '//section[@id="method.foo"]/h4[@class="code-header"]/span[@class="where fmt-newline"]' ': Clone' - pub const fn foo() where B: ~const Clone { + pub const fn foo() + where + B: ~const Clone + ~const Destruct, + { B::a() } }