diff --git a/RELEASES.md b/RELEASES.md index c6c0007d11520..024610bc7a417 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -50,6 +50,8 @@ Libraries - [`io::Empty` now implements `io::Seek`.][78044] - [`rc::Weak` and `sync::Weak`'s methods such as `as_ptr` are now implemented for `T: ?Sized` types.][80764] +- [`Div` and `Rem` by their `NonZero` variant is now implemented for all unsigned integers.][79134] + Stabilized APIs --------------- @@ -72,6 +74,8 @@ Stabilized APIs - [`str::split_inclusive`] - [`sync::OnceState`] - [`task::Wake`] +- [`VecDeque::range`] +- [`VecDeque::range_mut`] Cargo ----- @@ -115,6 +119,7 @@ Compatibility Notes - `thumbv7neon-unknown-linux-gnueabihf` - `armv7-unknown-linux-gnueabi` - `x86_64-unknown-linux-gnux32` +- [`atomic::spin_loop_hint` has been deprecated.][80966] It's recommended to use `hint::spin_loop` instead. Internal Only ------------- @@ -145,6 +150,8 @@ Internal Only [80764]: https://github.com/rust-lang/rust/pull/80764 [80749]: https://github.com/rust-lang/rust/pull/80749 [80662]: https://github.com/rust-lang/rust/pull/80662 +[79134]: https://github.com/rust-lang/rust/pull/79134 +[80966]: https://github.com/rust-lang/rust/pull/80966 [cargo/8997]: https://github.com/rust-lang/cargo/pull/8997 [cargo/9112]: https://github.com/rust-lang/cargo/pull/9112 [feature-resolver@2.0]: https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2 @@ -166,6 +173,8 @@ Internal Only [`Seek::stream_position`]: https://doc.rust-lang.org/nightly/std/io/trait.Seek.html#method.stream_position [`Peekable::next_if`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if [`Peekable::next_if_eq`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if_eq +[`VecDeque::range`]: https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#method.range +[`VecDeque::range_mut`]: https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#method.range_mut Version 1.50.0 (2021-02-11) ============================ diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 77e85c06ff5ae..70a5ac6f15ec2 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -666,21 +666,23 @@ impl<'a> Parser<'a> { ); match x { Ok((_, _, false)) => { - self.bump(); // `>` - match self.parse_expr() { - Ok(_) => { - e.span_suggestion_verbose( - binop.span.shrink_to_lo(), - TURBOFISH_SUGGESTION_STR, - "::".to_string(), - Applicability::MaybeIncorrect, - ); - e.emit(); - *expr = self.mk_expr_err(expr.span.to(self.prev_token.span)); - return Ok(()); - } - Err(mut err) => { - err.cancel(); + if self.eat(&token::Gt) { + match self.parse_expr() { + Ok(_) => { + e.span_suggestion_verbose( + binop.span.shrink_to_lo(), + TURBOFISH_SUGGESTION_STR, + "::".to_string(), + Applicability::MaybeIncorrect, + ); + e.emit(); + *expr = + self.mk_expr_err(expr.span.to(self.prev_token.span)); + return Ok(()); + } + Err(mut err) => { + err.cancel(); + } } } } diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs index 845375f3e322b..7a297f2c65f13 100644 --- a/compiler/rustc_typeck/src/astconv/generics.rs +++ b/compiler/rustc_typeck/src/astconv/generics.rs @@ -82,7 +82,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if param_type.is_suggestable() { err.span_suggestion( tcx.def_span(src_def_id), - "consider changing this type paramater to a `const`-generic", + "consider changing this type parameter to be a `const` generic", format!("const {}: {}", param_name, param_type), Applicability::MaybeIncorrect, ); diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index a0dbb289252f6..971244718b4ad 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -940,7 +940,6 @@ impl BTreeMap { /// # Examples /// /// ``` - /// #![feature(btree_retain)] /// use std::collections::BTreeMap; /// /// let mut map: BTreeMap = (0..8).map(|x| (x, x*10)).collect(); @@ -949,7 +948,7 @@ impl BTreeMap { /// assert!(map.into_iter().eq(vec![(0, 0), (2, 20), (4, 40), (6, 60)])); /// ``` #[inline] - #[unstable(feature = "btree_retain", issue = "79025")] + #[stable(feature = "btree_retain", since = "1.53.0")] pub fn retain(&mut self, mut f: F) where K: Ord, diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index a331b8d8e4bbb..737932d931c02 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -851,7 +851,6 @@ impl BTreeSet { /// # Examples /// /// ``` - /// #![feature(btree_retain)] /// use std::collections::BTreeSet; /// /// let xs = [1, 2, 3, 4, 5, 6]; @@ -860,7 +859,7 @@ impl BTreeSet { /// set.retain(|&k| k % 2 == 0); /// assert!(set.iter().eq([2, 4, 6].iter())); /// ``` - #[unstable(feature = "btree_retain", issue = "79025")] + #[stable(feature = "btree_retain", since = "1.53.0")] pub fn retain(&mut self, mut f: F) where T: Ord, diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index d696ffa82774b..59493bb0425f3 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -2268,7 +2268,7 @@ impl Debug for RefMut<'_, T> { } #[stable(feature = "core_impl_debug", since = "1.9.0")] -impl Debug for UnsafeCell { +impl Debug for UnsafeCell { fn fmt(&self, f: &mut Formatter<'_>) -> Result { f.pad("UnsafeCell") } diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 2219353b055ad..fa6a6c2cccc01 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -124,14 +124,13 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_zero)] /// use std::time::Duration; /// /// let duration = Duration::ZERO; /// assert!(duration.is_zero()); /// assert_eq!(duration.as_nanos(), 0); /// ``` - #[unstable(feature = "duration_zero", issue = "73544")] + #[stable(feature = "duration_zero", since = "1.53.0")] pub const ZERO: Duration = Duration::from_nanos(0); /// The maximum duration. @@ -269,7 +268,6 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_zero)] /// use std::time::Duration; /// /// assert!(Duration::ZERO.is_zero()); @@ -281,7 +279,8 @@ impl Duration { /// assert!(!Duration::from_nanos(1).is_zero()); /// assert!(!Duration::from_secs(1).is_zero()); /// ``` - #[unstable(feature = "duration_zero", issue = "73544")] + #[stable(feature = "duration_zero", since = "1.53.0")] + #[rustc_const_stable(feature = "duration_zero", since = "1.53.0")] #[inline] pub const fn is_zero(&self) -> bool { self.secs == 0 && self.nanos == 0 @@ -536,7 +535,6 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_zero)] /// use std::time::Duration; /// /// assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1)); diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 6053cbdbbf435..f6bfe67e1b12c 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -24,7 +24,6 @@ #![feature(div_duration)] #![feature(duration_consts_2)] #![feature(duration_constants)] -#![feature(duration_zero)] #![feature(exact_size_is_empty)] #![feature(extern_types)] #![feature(flt2dec)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 18ad2077d83de..90603cd983677 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -261,7 +261,6 @@ #![cfg_attr(not(bootstrap), feature(doc_notable_trait))] #![feature(dropck_eyepatch)] #![feature(duration_constants)] -#![feature(duration_zero)] #![feature(edition_panic)] #![feature(exact_size_is_empty)] #![feature(exhaustive_patterns)] diff --git a/src/test/ui/const-generics/diagnostics.stderr b/src/test/ui/const-generics/diagnostics.stderr index 7d038ff955d6c..c8ee6ad61ec73 100644 --- a/src/test/ui/const-generics/diagnostics.stderr +++ b/src/test/ui/const-generics/diagnostics.stderr @@ -31,9 +31,12 @@ error[E0747]: type provided when a constant was expected --> $DIR/diagnostics.rs:12:19 | LL | impl Foo for B {} - | - ^ - | | - | help: consider changing this type paramater to a `const`-generic: `const N: u8` + | ^ + | +help: consider changing this type parameter to be a `const` generic + | +LL | impl Foo for B {} + | ^^^^^^^^^^^ error[E0747]: unresolved item provided when a constant was expected --> $DIR/diagnostics.rs:16:32 diff --git a/src/test/ui/parser/issue-84117.rs b/src/test/ui/parser/issue-84117.rs new file mode 100644 index 0000000000000..0f20073591598 --- /dev/null +++ b/src/test/ui/parser/issue-84117.rs @@ -0,0 +1,9 @@ +fn main() { + let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } + //~^ ERROR expected one of `>`, a const expression + //~| ERROR expected one of `>`, a const expression, lifetime, or type, found `}` + //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,` + //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,` + //~| ERROR expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,` +} +//~^ ERROR expected one of `,`, `:`, `=`, or `>`, found `}` diff --git a/src/test/ui/parser/issue-84117.stderr b/src/test/ui/parser/issue-84117.stderr new file mode 100644 index 0000000000000..d667a4977d0d3 --- /dev/null +++ b/src/test/ui/parser/issue-84117.stderr @@ -0,0 +1,49 @@ +error: expected one of `>`, a const expression, lifetime, or type, found `}` + --> $DIR/issue-84117.rs:2:67 + | +LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } + | ------------ ^ expected one of `>`, a const expression, lifetime, or type + | | | + | | help: use `=` if you meant to assign + | while parsing the type for `inner_local` + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,` + --> $DIR/issue-84117.rs:2:65 + | +LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } + | ^ expected one of 7 possible tokens + +error: expected one of `,`, `:`, `=`, or `>`, found `}` + --> $DIR/issue-84117.rs:8:1 + | +LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } + | ------------ help: use `=` if you meant to assign - expected one of `,`, `:`, `=`, or `>` + | | + | while parsing the type for `outer_local` +... +LL | } + | ^ unexpected token + +error: expected one of `>`, a const expression, lifetime, or type, found `}` + --> $DIR/issue-84117.rs:2:67 + | +LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } + | ------------ ^ expected one of `>`, a const expression, lifetime, or type + | | | + | | help: use `=` if you meant to assign + | while parsing the type for `inner_local` + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,` + --> $DIR/issue-84117.rs:2:65 + | +LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } + | ^ expected one of 7 possible tokens + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, or an operator, found `,` + --> $DIR/issue-84117.rs:2:33 + | +LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } + | ^ expected one of 7 possible tokens + +error: aborting due to 6 previous errors +