Skip to content

Commit 3f6301d

Browse files
authored
Merge branch 'rust-lang:master' into duration-from-nanos-u128
2 parents 00773f8 + c9cd707 commit 3f6301d

File tree

242 files changed

+2934
-2828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+2934
-2828
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
shallow = true
4646
[submodule "src/tools/enzyme"]
4747
path = src/tools/enzyme
48-
url = https://github.com/EnzymeAD/Enzyme.git
48+
url = https://github.com/rust-lang/Enzyme.git
4949
shallow = true
5050
[submodule "src/gcc"]
5151
path = src/gcc

RELEASES.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,126 @@
1+
Version 1.86.0 (2025-04-03)
2+
==========================
3+
4+
<a id="1.86.0-Language"></a>
5+
6+
Language
7+
--------
8+
- [Stabilize upcasting trait objects to supertraits.](https://github.com/rust-lang/rust/pull/134367)
9+
- [Allow safe functions to be marked with the `#[target_feature]` attribute.](https://github.com/rust-lang/rust/pull/134090)
10+
- [The `missing_abi` lint now warns-by-default.](https://github.com/rust-lang/rust/pull/132397)
11+
- Rust now lints about double negations, to catch cases that might have intended to be a prefix decrement operator (`--x`) as written in other languages. This was previously a clippy lint, `clippy::double_neg`, and is [now available directly in Rust as `double_negations`.](https://github.com/rust-lang/rust/pull/126604)
12+
- [More pointers are now detected as definitely not-null based on their alignment in const eval.](https://github.com/rust-lang/rust/pull/133700)
13+
- [Empty `repr()` attribute applied to invalid items are now correctly rejected.](https://github.com/rust-lang/rust/pull/133925)
14+
- [Inner attributes `#![test]` and `#![rustfmt::skip]` are no longer accepted in more places than intended.](https://github.com/rust-lang/rust/pull/134276)
15+
16+
<a id="1.86.0-Compiler"></a>
17+
18+
Compiler
19+
--------
20+
- [Debug-assert that raw pointers are non-null on access.](https://github.com/rust-lang/rust/pull/134424)
21+
- [Change `-O` to mean `-C opt-level=3` instead of `-C opt-level=2` to match Cargo's defaults.](https://github.com/rust-lang/rust/pull/135439)
22+
- [Fix emission of `overflowing_literals` under certain macro environments.](https://github.com/rust-lang/rust/pull/136393)
23+
24+
<a id="1.86.0-Platform-Support"></a>
25+
26+
Platform Support
27+
----------------
28+
- [Replace `i686-unknown-redox` target with `i586-unknown-redox`.](https://github.com/rust-lang/rust/pull/136698)
29+
- [Increase baseline CPU of `i686-unknown-hurd-gnu` to Pentium 4.](https://github.com/rust-lang/rust/pull/136700)
30+
- New tier 3 targets:
31+
- [`{aarch64-unknown,x86_64-pc}-nto-qnx710_iosock`](https://github.com/rust-lang/rust/pull/133631).
32+
For supporting Neutrino QNX 7.1 with `io-socket` network stack.
33+
- [`{aarch64-unknown,x86_64-pc}-nto-qnx800`](https://github.com/rust-lang/rust/pull/133631).
34+
For supporting Neutrino QNX 8.0 (`no_std`-only).
35+
- [`{x86_64,i686}-win7-windows-gnu`](https://github.com/rust-lang/rust/pull/134609).
36+
Intended for backwards compatibility with Windows 7. `{x86_64,i686}-win7-windows-msvc` are the Windows MSVC counterparts that already exist as Tier 3 targets.
37+
- [`amdgcn-amd-amdhsa`](https://github.com/rust-lang/rust/pull/134740).
38+
- [`x86_64-pc-cygwin`](https://github.com/rust-lang/rust/pull/134999).
39+
- [`{mips,mipsel}-mti-none-elf`](https://github.com/rust-lang/rust/pull/135074).
40+
Initial bare-metal support.
41+
- [`m68k-unknown-none-elf`](https://github.com/rust-lang/rust/pull/135085).
42+
- [`armv7a-nuttx-{eabi,eabihf}`, `aarch64-unknown-nuttx`, and `thumbv7a-nuttx-{eabi,eabihf}`](https://github.com/rust-lang/rust/pull/135757).
43+
44+
Refer to Rust's [platform support page][platform-support-doc]
45+
for more information on Rust's tiered platform support.
46+
47+
<a id="1.86.0-Libraries"></a>
48+
49+
Libraries
50+
---------
51+
- The type of `FromBytesWithNulError` in `CStr::from_bytes_with_nul(bytes: &[u8]) -> Result<&Self, FromBytesWithNulError>` was [changed from an opaque struct to an enum](https://github.com/rust-lang/rust/pull/134143), allowing users to examine why the conversion failed.
52+
- [Remove `RustcDecodable` and `RustcEncodable`.](https://github.com/rust-lang/rust/pull/134272)
53+
- [Deprecate libtest's `--logfile` option.](https://github.com/rust-lang/rust/pull/134283)
54+
- [On recent versions of Windows, `std::fs::remove_file` will now remove read-only files.](https://github.com/rust-lang/rust/pull/134679)
55+
56+
<a id="1.86.0-Stabilized-APIs"></a>
57+
58+
Stabilized APIs
59+
---------------
60+
61+
- [`{float}::next_down`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_down)
62+
- [`{float}::next_up`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.next_up)
63+
- [`<[_]>::get_disjoint_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_mut)
64+
- [`<[_]>::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_disjoint_unchecked_mut)
65+
- [`slice::GetDisjointMutError`](https://doc.rust-lang.org/stable/std/slice/enum.GetDisjointMutError.html)
66+
- [`HashMap::get_disjoint_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_mut)
67+
- [`HashMap::get_disjoint_unchecked_mut`](https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.get_disjoint_unchecked_mut)
68+
- [`NonZero::count_ones`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.count_ones)
69+
- [`Vec::pop_if`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.pop_if)
70+
- [`sync::Once::wait`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait)
71+
- [`sync::Once::wait_force`](https://doc.rust-lang.org/stable/std/sync/struct.Once.html#method.wait_force)
72+
- [`sync::OnceLock::wait`](https://doc.rust-lang.org/stable/std/sync/struct.OnceLock.html#method.wait)
73+
74+
These APIs are now stable in const contexts:
75+
76+
- [`hint::black_box`](https://doc.rust-lang.org/stable/std/hint/fn.black_box.html)
77+
- [`io::Cursor::get_mut`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_mut)
78+
- [`io::Cursor::set_position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.set_position)
79+
- [`str::is_char_boundary`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.is_char_boundary)
80+
- [`str::split_at`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at)
81+
- [`str::split_at_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_checked)
82+
- [`str::split_at_mut`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut)
83+
- [`str::split_at_mut_checked`](https://doc.rust-lang.org/stable/std/primitive.str.html#method.split_at_mut_checked)
84+
85+
<a id="1.86.0-Cargo"></a>
86+
87+
Cargo
88+
-----
89+
- [When merging, replace rather than combine configuration keys that refer to a program path and its arguments.](https://github.com/rust-lang/cargo/pull/15066/)
90+
- [Error if both `--package` and `--workspace` are passed but the requested package is missing.](https://github.com/rust-lang/cargo/pull/15071/) This was previously silently ignored, which was considered a bug since missing packages should be reported.
91+
- [Deprecate the token argument in `cargo login` to avoid shell history leaks.](https://github.com/rust-lang/cargo/pull/15057/)
92+
- [Simplify the implementation of `SourceID` comparisons.](https://github.com/rust-lang/cargo/pull/14980/) This may potentially change behavior if the canonicalized URL compares differently in alternative registries.
93+
94+
<a id="1.86.0-Rustdoc"></a>
95+
96+
Rustdoc
97+
-----
98+
- [Add a sans-serif font setting.](https://github.com/rust-lang/rust/pull/133636)
99+
100+
<a id="1.86.0-Compatibility-Notes"></a>
101+
102+
Compatibility Notes
103+
-------------------
104+
- [The `wasm_c_abi` future compatibility warning is now a hard error.](https://github.com/rust-lang/rust/pull/133951)
105+
Users of `wasm-bindgen` should upgrade to at least version 0.2.89, otherwise compilation will fail.
106+
- [Remove long-deprecated no-op attributes `#![no_start]` and `#![crate_id]`.](https://github.com/rust-lang/rust/pull/134300)
107+
- [The future incompatibility lint `cenum_impl_drop_cast` has been made into a hard error.](https://github.com/rust-lang/rust/pull/135964) This means it is now an error to cast a field-less enum to an integer if the enum implements `Drop`.
108+
- [SSE2 is now required for "i686" 32-bit x86 hard-float targets; disabling it causes a warning that will become a hard error eventually.](https://github.com/rust-lang/rust/pull/137037)
109+
To compile for pre-SSE2 32-bit x86, use a "i586" target instead.
110+
111+
<a id="1.86.0-Internal-Changes"></a>
112+
113+
Internal Changes
114+
----------------
115+
116+
These changes do not affect any public interfaces of Rust, but they represent
117+
significant improvements to the performance or internals of rustc and related
118+
tools.
119+
120+
- [Build the rustc on AArch64 Linux with ThinLTO + PGO.](https://github.com/rust-lang/rust/pull/133807)
121+
The ARM 64-bit compiler (AArch64) on Linux is now optimized with ThinLTO and PGO, similar to the optimizations we have already performed for the x86-64 compiler on Linux. This should make it up to 30% faster.
122+
123+
1124
Version 1.85.1 (2025-03-18)
2125
==========================
3126

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,11 @@ impl HasTokens for Attribute {
209209
impl HasTokens for Nonterminal {
210210
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
211211
match self {
212-
Nonterminal::NtExpr(expr) | Nonterminal::NtLiteral(expr) => expr.tokens(),
213212
Nonterminal::NtBlock(block) => block.tokens(),
214213
}
215214
}
216215
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
217216
match self {
218-
Nonterminal::NtExpr(expr) | Nonterminal::NtLiteral(expr) => expr.tokens_mut(),
219217
Nonterminal::NtBlock(block) => block.tokens_mut(),
220218
}
221219
}

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,6 @@ pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
899899
fn visit_nonterminal<T: MutVisitor>(vis: &mut T, nt: &mut token::Nonterminal) {
900900
match nt {
901901
token::NtBlock(block) => vis.visit_block(block),
902-
token::NtExpr(expr) => vis.visit_expr(expr),
903-
token::NtLiteral(expr) => vis.visit_expr(expr),
904902
}
905903
}
906904

compiler/rustc_ast/src/token.rs

Lines changed: 26 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,17 @@ impl Lit {
198198
}
199199
}
200200

201-
/// Keep this in sync with `Token::can_begin_literal_maybe_minus` excluding unary negation.
201+
/// Keep this in sync with `Token::can_begin_literal_maybe_minus` and
202+
/// `Parser::eat_token_lit` (excluding unary negation).
202203
pub fn from_token(token: &Token) -> Option<Lit> {
203204
match token.uninterpolate().kind {
204205
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => Some(Lit::new(Bool, name, None)),
205206
Literal(token_lit) => Some(token_lit),
206-
Interpolated(ref nt)
207-
if let NtExpr(expr) | NtLiteral(expr) = &**nt
208-
&& let ast::ExprKind::Lit(token_lit) = expr.kind =>
209-
{
210-
Some(token_lit)
207+
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
208+
MetaVarKind::Literal | MetaVarKind::Expr { .. },
209+
))) => {
210+
// Unreachable with the current test suite.
211+
panic!("from_token metavar");
211212
}
212213
_ => None,
213214
}
@@ -447,8 +448,9 @@ pub enum TokenKind {
447448

448449
/// Identifier token.
449450
/// Do not forget about `NtIdent` when you want to match on identifiers.
450-
/// It's recommended to use `Token::(ident,uninterpolate,uninterpolated_span)` to
451-
/// treat regular and interpolated identifiers in the same way.
451+
/// It's recommended to use `Token::{ident,uninterpolate}` and
452+
/// `Parser::token_uninterpolated_span` to treat regular and interpolated
453+
/// identifiers in the same way.
452454
Ident(Symbol, IdentIsRaw),
453455
/// This identifier (and its span) is the identifier passed to the
454456
/// declarative macro. The span in the surrounding `Token` is the span of
@@ -457,8 +459,9 @@ pub enum TokenKind {
457459

458460
/// Lifetime identifier token.
459461
/// Do not forget about `NtLifetime` when you want to match on lifetime identifiers.
460-
/// It's recommended to use `Token::(lifetime,uninterpolate,uninterpolated_span)` to
461-
/// treat regular and interpolated lifetime identifiers in the same way.
462+
/// It's recommended to use `Token::{ident,uninterpolate}` and
463+
/// `Parser::token_uninterpolated_span` to treat regular and interpolated
464+
/// identifiers in the same way.
462465
Lifetime(Symbol, IdentIsRaw),
463466
/// This identifier (and its span) is the lifetime passed to the
464467
/// declarative macro. The span in the surrounding `Token` is the span of
@@ -584,20 +587,6 @@ impl Token {
584587
Token::new(Ident(ident.name, ident.is_raw_guess().into()), ident.span)
585588
}
586589

587-
/// For interpolated tokens, returns a span of the fragment to which the interpolated
588-
/// token refers. For all other tokens this is just a regular span.
589-
/// It is particularly important to use this for identifiers and lifetimes
590-
/// for which spans affect name resolution and edition checks.
591-
/// Note that keywords are also identifiers, so they should use this
592-
/// if they keep spans or perform edition checks.
593-
pub fn uninterpolated_span(&self) -> Span {
594-
match self.kind {
595-
NtIdent(ident, _) | NtLifetime(ident, _) => ident.span,
596-
Interpolated(ref nt) => nt.use_span(),
597-
_ => self.span,
598-
}
599-
}
600-
601590
pub fn is_range_separator(&self) -> bool {
602591
[DotDot, DotDotDot, DotDotEq].contains(&self.kind)
603592
}
@@ -642,12 +631,7 @@ impl Token {
642631
PathSep | // global path
643632
Lifetime(..) | // labeled loop
644633
Pound => true, // expression attributes
645-
Interpolated(ref nt) =>
646-
matches!(&**nt,
647-
NtBlock(..) |
648-
NtExpr(..) |
649-
NtLiteral(..)
650-
),
634+
Interpolated(ref nt) => matches!(&**nt, NtBlock(..)),
651635
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
652636
MetaVarKind::Block |
653637
MetaVarKind::Expr { .. } |
@@ -677,11 +661,6 @@ impl Token {
677661
Lt | // path (UFCS constant)
678662
Shl => true, // path (double UFCS)
679663
Or => matches!(pat_kind, PatWithOr), // leading vert `|` or-pattern
680-
Interpolated(nt) =>
681-
matches!(&**nt,
682-
| NtExpr(..)
683-
| NtLiteral(..)
684-
),
685664
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
686665
MetaVarKind::Expr { .. } |
687666
MetaVarKind::Literal |
@@ -724,7 +703,7 @@ impl Token {
724703
match self.kind {
725704
OpenDelim(Delimiter::Brace) | Literal(..) | Minus => true,
726705
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true,
727-
Interpolated(ref nt) => matches!(&**nt, NtExpr(..) | NtBlock(..) | NtLiteral(..)),
706+
Interpolated(ref nt) => matches!(&**nt, NtBlock(..)),
728707
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(
729708
MetaVarKind::Expr { .. } | MetaVarKind::Block | MetaVarKind::Literal,
730709
))) => true,
@@ -768,22 +747,12 @@ impl Token {
768747
///
769748
/// In other words, would this token be a valid start of `parse_literal_maybe_minus`?
770749
///
771-
/// Keep this in sync with and `Lit::from_token`, excluding unary negation.
750+
/// Keep this in sync with `Lit::from_token` and `Parser::eat_token_lit`
751+
/// (excluding unary negation).
772752
pub fn can_begin_literal_maybe_minus(&self) -> bool {
773753
match self.uninterpolate().kind {
774754
Literal(..) | Minus => true,
775755
Ident(name, IdentIsRaw::No) if name.is_bool_lit() => true,
776-
Interpolated(ref nt) => match &**nt {
777-
NtLiteral(_) => true,
778-
NtExpr(e) => match &e.kind {
779-
ast::ExprKind::Lit(_) => true,
780-
ast::ExprKind::Unary(ast::UnOp::Neg, e) => {
781-
matches!(&e.kind, ast::ExprKind::Lit(_))
782-
}
783-
_ => false,
784-
},
785-
_ => false,
786-
},
787756
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(mv_kind))) => match mv_kind {
788757
MetaVarKind::Literal => true,
789758
MetaVarKind::Expr { can_begin_literal_maybe_minus, .. } => {
@@ -798,14 +767,6 @@ impl Token {
798767
pub fn can_begin_string_literal(&self) -> bool {
799768
match self.uninterpolate().kind {
800769
Literal(..) => true,
801-
Interpolated(ref nt) => match &**nt {
802-
NtLiteral(_) => true,
803-
NtExpr(e) => match &e.kind {
804-
ast::ExprKind::Lit(_) => true,
805-
_ => false,
806-
},
807-
_ => false,
808-
},
809770
OpenDelim(Delimiter::Invisible(InvisibleOrigin::MetaVar(mv_kind))) => match mv_kind {
810771
MetaVarKind::Literal => true,
811772
MetaVarKind::Expr { can_begin_string_literal, .. } => can_begin_string_literal,
@@ -869,19 +830,25 @@ impl Token {
869830

870831
/// Is this a pre-parsed expression dropped into the token stream
871832
/// (which happens while parsing the result of macro expansion)?
872-
pub fn is_whole_expr(&self) -> bool {
833+
pub fn is_metavar_expr(&self) -> bool {
873834
#[allow(irrefutable_let_patterns)] // FIXME: temporary
874835
if let Interpolated(nt) = &self.kind
875-
&& let NtExpr(_) | NtLiteral(_) | NtBlock(_) = &**nt
836+
&& let NtBlock(_) = &**nt
876837
{
877838
true
839+
} else if matches!(
840+
self.is_metavar_seq(),
841+
Some(MetaVarKind::Expr { .. } | MetaVarKind::Literal | MetaVarKind::Path)
842+
) {
843+
true
878844
} else {
879845
matches!(self.is_metavar_seq(), Some(MetaVarKind::Path))
880846
}
881847
}
882848

883849
/// Is the token an interpolated block (`$b:block`)?
884850
pub fn is_whole_block(&self) -> bool {
851+
#[allow(irrefutable_let_patterns)] // FIXME: temporary
885852
if let Interpolated(nt) = &self.kind
886853
&& let NtBlock(..) = &**nt
887854
{
@@ -1100,8 +1067,6 @@ pub enum NtExprKind {
11001067
/// For interpolation during macro expansion.
11011068
pub enum Nonterminal {
11021069
NtBlock(P<ast::Block>),
1103-
NtExpr(P<ast::Expr>),
1104-
NtLiteral(P<ast::Expr>),
11051070
}
11061071

11071072
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
@@ -1191,15 +1156,12 @@ impl Nonterminal {
11911156
pub fn use_span(&self) -> Span {
11921157
match self {
11931158
NtBlock(block) => block.span,
1194-
NtExpr(expr) | NtLiteral(expr) => expr.span,
11951159
}
11961160
}
11971161

11981162
pub fn descr(&self) -> &'static str {
11991163
match self {
12001164
NtBlock(..) => "block",
1201-
NtExpr(..) => "expression",
1202-
NtLiteral(..) => "literal",
12031165
}
12041166
}
12051167
}
@@ -1218,8 +1180,6 @@ impl fmt::Debug for Nonterminal {
12181180
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12191181
match *self {
12201182
NtBlock(..) => f.pad("NtBlock(..)"),
1221-
NtExpr(..) => f.pad("NtExpr(..)"),
1222-
NtLiteral(..) => f.pad("NtLiteral(..)"),
12231183
}
12241184
}
12251185
}
@@ -1242,7 +1202,7 @@ mod size_asserts {
12421202
// tidy-alphabetical-start
12431203
static_assert_size!(Lit, 12);
12441204
static_assert_size!(LitKind, 2);
1245-
static_assert_size!(Nonterminal, 16);
1205+
static_assert_size!(Nonterminal, 8);
12461206
static_assert_size!(Token, 24);
12471207
static_assert_size!(TokenKind, 16);
12481208
// tidy-alphabetical-end

0 commit comments

Comments
 (0)