diff --git a/RELEASES.md b/RELEASES.md
index 2124195bcb209..c0851a1506e13 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -10,8 +10,7 @@ Language
Compiler
--------
-- [Added tier 3\* support for `powerpc-unknown-freebsd`.][87370]
-- [Added tier 3 support for `powerpc64le-unknown-freebsd`.][83572]
+- [Added tier 3\* support for `powerpc64le-unknown-freebsd`.][83572]
\* Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.
@@ -24,17 +23,6 @@ Libraries
no longer reject certain valid floating point values, and reduce
the produced code size for non-stripped artifacts.
- [`string::Drain` now implements `AsRef` and `AsRef<[u8]>`.][86858]
-- [`collections::{BinaryHeap, BTreeSet, HashSet, LinkedList, VecDeque}` now
- implement `From<[T; N]>`.][84111]
-- [`collections::{BTreeMap, HashMap}` now implement `From<[(K, V); N]>`.][84111]
- This allows you to write the following;
- ```rust
- let highscores = std::collections::HashMap::from([
- ("Alice", 9000u32),
- ("Bob", 7250),
- ("Charlie", 5500),
- ]);
- ```
Stabilised APIs
---------------
@@ -60,7 +48,6 @@ Stabilised APIs
The following previously stable functions are now `const`.
- [`str::from_utf8_unchecked`]
-- [`mem::transmute`]
Cargo
@@ -131,7 +118,6 @@ Compatibility Notes
[`MaybeUninit::assume_init_ref`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
[`MaybeUninit::write`]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.write
[`Seek::rewind`]: https://doc.rust-lang.org/stable/std/io/trait.Seek.html#method.rewind
-[`mem::transmute`]: https://doc.rust-lang.org/stable/std/mem/fn.transmute.html
[`ops::ControlFlow`]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html
[`str::from_utf8_unchecked`]: https://doc.rust-lang.org/stable/std/str/fn.from_utf8_unchecked.html
[`x86::_bittest`]: https://doc.rust-lang.org/stable/core/arch/x86/fn._bittest.html
diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs
index 710a592e258b4..3a65ffe41ae87 100644
--- a/compiler/rustc_ast/src/token.rs
+++ b/compiler/rustc_ast/src/token.rs
@@ -586,6 +586,13 @@ impl Token {
self.is_non_raw_ident_where(|id| id.name.is_bool_lit())
}
+ pub fn is_numeric_lit(&self) -> bool {
+ matches!(
+ self.kind,
+ Literal(Lit { kind: LitKind::Integer, .. }) | Literal(Lit { kind: LitKind::Float, .. })
+ )
+ }
+
/// Returns `true` if the token is a non-raw identifier for which `pred` holds.
pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(Ident) -> bool) -> bool {
match self.ident() {
diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs
index 8e498a5446ea8..efab0200ff502 100644
--- a/compiler/rustc_feature/src/removed.rs
+++ b/compiler/rustc_feature/src/removed.rs
@@ -104,7 +104,7 @@ declare_features! (
(removed, quote, "1.33.0", Some(29601), None, None),
/// Allows const generic types (e.g. `struct Foo(...);`).
(removed, const_generics, "1.34.0", Some(44580), None,
- Some("removed in favor of `#![feature(adt_const_params]` and `#![feature(generic_const_exprs)]`")),
+ Some("removed in favor of `#![feature(adt_const_params)]` and `#![feature(generic_const_exprs)]`")),
/// Allows `[x; N]` where `x` is a constant (RFC 2203).
(removed, const_in_array_repeat_expressions, "1.37.0", Some(49147), None,
Some("removed due to causing promotable bugs")),
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index a1d3e9adba013..05156745105a1 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -516,6 +516,26 @@ impl<'a> Parser<'a> {
token::BinOp(token::And) | token::AndAnd => {
make_it!(this, attrs, |this, _| this.parse_borrow_expr(lo))
}
+ token::BinOp(token::Plus) if this.look_ahead(1, |tok| tok.is_numeric_lit()) => {
+ let mut err = this.struct_span_err(lo, "leading `+` is not supported");
+ err.span_label(lo, "unexpected `+`");
+
+ // a block on the LHS might have been intended to be an expression instead
+ if let Some(sp) = this.sess.ambiguous_block_expr_parse.borrow().get(&lo) {
+ this.sess.expr_parentheses_needed(&mut err, *sp);
+ } else {
+ err.span_suggestion_verbose(
+ lo,
+ "try removing the `+`",
+ "".to_string(),
+ Applicability::MachineApplicable,
+ );
+ }
+ err.emit();
+
+ this.bump();
+ this.parse_prefix_expr(None)
+ } // `+expr`
token::Ident(..) if this.token.is_keyword(kw::Box) => {
make_it!(this, attrs, |this, _| this.parse_box_expr(lo))
}
diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs
index 46e64c33b84d7..b6bb06f9d64bc 100644
--- a/library/core/src/num/uint_macros.rs
+++ b/library/core/src/num/uint_macros.rs
@@ -1924,7 +1924,8 @@ macro_rules! uint_impl {
}
/// Calculates the smallest value greater than or equal to `self` that
- /// is a multiple of `rhs`. If `rhs` is negative,
+ /// is a multiple of `rhs`. Returns `None` is `rhs` is zero or the
+ /// operation would result in overflow.
///
/// # Examples
///
diff --git a/library/core/src/ops/bit.rs b/library/core/src/ops/bit.rs
index 51f8043817345..92f45ac9e7ea9 100644
--- a/library/core/src/ops/bit.rs
+++ b/library/core/src/ops/bit.rs
@@ -30,6 +30,7 @@
/// ```
#[lang = "not"]
#[stable(feature = "rust1", since = "1.0.0")]
+#[doc(alias = "!")]
pub trait Not {
/// The resulting type after applying the `!` operator.
#[stable(feature = "rust1", since = "1.0.0")]
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 9d5e03dd0de79..907726f0c345c 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -1173,7 +1173,7 @@ impl Option {
// Entry-like operations to insert a value and return a reference
/////////////////////////////////////////////////////////////////////////
- /// Inserts `value` into the option then returns a mutable reference to it.
+ /// Inserts `value` into the option, then returns a mutable reference to it.
///
/// If the option already contains a value, the old value is dropped.
///
@@ -1397,7 +1397,7 @@ impl Option {
}
impl Option<(T, U)> {
- /// Unzips an option containing a tuple of two options
+ /// Unzips an option containing a tuple of two options.
///
/// If `self` is `Some((a, b))` this method returns `(Some(a), Some(b))`.
/// Otherwise, `(None, None)` is returned.
@@ -1500,7 +1500,7 @@ impl Option<&mut T> {
}
impl Option {
- /// Returns the contained [`Some`] value or a default
+ /// Returns the contained [`Some`] value or a default.
///
/// Consumes the `self` argument then, if [`Some`], returns the contained
/// value, otherwise if [`None`], returns the [default value] for that
@@ -1561,7 +1561,7 @@ impl Option {
/// Converts from `Option` (or `&mut Option`) to `Option<&mut T::Target>`.
///
/// Leaves the original `Option` in-place, creating a new one containing a mutable reference to
- /// the inner type's `Deref::Target` type.
+ /// the inner type's [`Deref::Target`] type.
///
/// # Examples
///
@@ -1701,7 +1701,7 @@ impl<'a, T> IntoIterator for &'a mut Option {
#[stable(since = "1.12.0", feature = "option_from")]
impl From for Option {
- /// Copies `val` into a new `Some`.
+ /// Moves `val` into a new [`Some`].
///
/// # Examples
///
@@ -1942,8 +1942,8 @@ unsafe impl TrustedLen for IntoIter {}
impl> FromIterator
"
);
- if ty_layout.layout.abi.is_unsized() {
- writeln!(w, "