Skip to content

Commit a730daa

Browse files
authored
Merge pull request #2539 from rust-lang/rustc-pull
Rustc pull update
2 parents 976bcee + e296468 commit a730daa

File tree

591 files changed

+11366
-7812
lines changed

Some content is hidden

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

591 files changed

+11366
-7812
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
[submodule "src/llvm-project"]
2626
path = src/llvm-project
2727
url = https://github.com/rust-lang/llvm-project.git
28-
branch = rustc/20.1-2025-07-13
28+
branch = rustc/21.1-2025-08-01
2929
shallow = true
3030
[submodule "src/doc/embedded-book"]
3131
path = src/doc/embedded-book

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4519,6 +4519,7 @@ name = "rustc_resolve"
45194519
version = "0.0.0"
45204520
dependencies = [
45214521
"bitflags",
4522+
"indexmap",
45224523
"itertools",
45234524
"pulldown-cmark",
45244525
"rustc_arena",

RELEASES.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,140 @@
1+
Version 1.89.0 (2025-08-07)
2+
==========================
3+
4+
<a id="1.89.0-Language"></a>
5+
6+
Language
7+
--------
8+
- [Stabilize explicitly inferred const arguments (`feature(generic_arg_infer)`)](https://github.com/rust-lang/rust/pull/141610)
9+
- [Add a warn-by-default `mismatched_lifetime_syntaxes` lint.](https://github.com/rust-lang/rust/pull/138677)
10+
This lint detects when the same lifetime is referred to by different syntax categories between function arguments and return values, which can be confusing to read, especially in unsafe code.
11+
This lint supersedes the warn-by-default `elided_named_lifetimes` lint.
12+
- [Expand `unpredictable_function_pointer_comparisons` to also lint on function pointer comparisons in external macros](https://github.com/rust-lang/rust/pull/134536)
13+
- [Make the `dangerous_implicit_autorefs` lint deny-by-default](https://github.com/rust-lang/rust/pull/141661)
14+
- [Stabilize the avx512 target features](https://github.com/rust-lang/rust/pull/138940)
15+
- [Stabilize `kl` and `widekl` target features for x86](https://github.com/rust-lang/rust/pull/140766)
16+
- [Stabilize `sha512`, `sm3` and `sm4` target features for x86](https://github.com/rust-lang/rust/pull/140767)
17+
- [Stabilize LoongArch target features `f`, `d`, `frecipe`, `lasx`, `lbt`, `lsx`, and `lvz`](https://github.com/rust-lang/rust/pull/135015)
18+
- [Remove `i128` and `u128` from `improper_ctypes_definitions`](https://github.com/rust-lang/rust/pull/137306)
19+
- [Stabilize `repr128` (`#[repr(u128)]`, `#[repr(i128)]`)](https://github.com/rust-lang/rust/pull/138285)
20+
- [Allow `#![doc(test(attr(..)))]` everywhere](https://github.com/rust-lang/rust/pull/140560)
21+
- [Extend temporary lifetime extension to also go through tuple struct and tuple variant constructors](https://github.com/rust-lang/rust/pull/140593)
22+
- [`extern "C"` functions on the `wasm32-unknown-unknown` target now have a standards compliant ABI](https://blog.rust-lang.org/2025/04/04/c-abi-changes-for-wasm32-unknown-unknown/)
23+
24+
<a id="1.89.0-Compiler"></a>
25+
26+
Compiler
27+
--------
28+
- [Default to non-leaf frame pointers on aarch64-linux](https://github.com/rust-lang/rust/pull/140832)
29+
- [Enable non-leaf frame pointers for Arm64EC Windows](https://github.com/rust-lang/rust/pull/140862)
30+
- [Set Apple frame pointers by architecture](https://github.com/rust-lang/rust/pull/141797)
31+
32+
33+
<a id="1.89.0-Platform-Support"></a>
34+
35+
Platform Support
36+
----------------
37+
- [Add new Tier-3 targets `loongarch32-unknown-none` and `loongarch32-unknown-none-softfloat`](https://github.com/rust-lang/rust/pull/142053)
38+
- [`x86_64-apple-darwin` is in the process of being demoted to Tier 2 with host tools](https://github.com/rust-lang/rfcs/pull/3841)
39+
40+
Refer to Rust's [platform support page][platform-support-doc]
41+
for more information on Rust's tiered platform support.
42+
43+
[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html
44+
45+
<a id="1.89.0-Libraries"></a>
46+
47+
Libraries
48+
---------
49+
- [Specify the base path for `file!`](https://github.com/rust-lang/rust/pull/134442)
50+
- [Allow storing `format_args!()` in a variable](https://github.com/rust-lang/rust/pull/140748)
51+
- [Add `#[must_use]` to `[T; N]::map`](https://github.com/rust-lang/rust/pull/140957)
52+
- [Implement `DerefMut` for `Lazy{Cell,Lock}`](https://github.com/rust-lang/rust/pull/129334)
53+
- [Implement `Default` for `array::IntoIter`](https://github.com/rust-lang/rust/pull/141574)
54+
- [Implement `Clone` for `slice::ChunkBy`](https://github.com/rust-lang/rust/pull/138016)
55+
- [Implement `io::Seek` for `io::Take`](https://github.com/rust-lang/rust/pull/138023)
56+
57+
58+
<a id="1.89.0-Stabilized-APIs"></a>
59+
60+
Stabilized APIs
61+
---------------
62+
63+
- [`NonZero<char>`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html)
64+
- Many intrinsics for x86, not enumerated here
65+
- [AVX512 intrinsics](https://github.com/rust-lang/rust/issues/111137)
66+
- [`SHA512`, `SM3` and `SM4` intrinsics](https://github.com/rust-lang/rust/issues/126624)
67+
- [`File::lock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.lock)
68+
- [`File::lock_shared`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.lock_shared)
69+
- [`File::try_lock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.try_lock)
70+
- [`File::try_lock_shared`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.try_lock_shared)
71+
- [`File::unlock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.unlock)
72+
- [`NonNull::from_ref`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.from_ref)
73+
- [`NonNull::from_mut`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.from_mut)
74+
- [`NonNull::without_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.without_provenance)
75+
- [`NonNull::with_exposed_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.with_exposed_provenance)
76+
- [`NonNull::expose_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.expose_provenance)
77+
- [`OsString::leak`](https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.leak)
78+
- [`PathBuf::leak`](https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#method.leak)
79+
- [`Result::flatten`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.flatten)
80+
- [`std::os::linux::net::TcpStreamExt::quickack`](https://doc.rust-lang.org/stable/std/os/linux/net/trait.TcpStreamExt.html#tymethod.quickack)
81+
- [`std::os::linux::net::TcpStreamExt::set_quickack`](https://doc.rust-lang.org/stable/std/os/linux/net/trait.TcpStreamExt.html#tymethod.set_quickack)
82+
83+
These previously stable APIs are now stable in const contexts:
84+
85+
- [`<[T; N]>::as_mut_slice`](https://doc.rust-lang.org/stable/std/primitive.array.html#method.as_mut_slice)
86+
- [`<[u8]>::eq_ignore_ascii_case`](https://doc.rust-lang.org/stable/std/primitive.slice.html#impl-%5Bu8%5D/method.eq_ignore_ascii_case)
87+
- [`str::eq_ignore_ascii_case`](https://doc.rust-lang.org/stable/std/primitive.str.html#impl-str/method.eq_ignore_ascii_case)
88+
89+
90+
<a id="1.89.0-Cargo"></a>
91+
92+
Cargo
93+
-----
94+
- [`cargo fix` and `cargo clippy --fix` now default to the same Cargo target selection as other build commands.](https://github.com/rust-lang/cargo/pull/15192/) Previously it would apply to all targets (like binaries, examples, tests, etc.). The `--edition` flag still applies to all targets.
95+
- [Stabilize doctest-xcompile.](https://github.com/rust-lang/cargo/pull/15462/) Doctests are now tested when cross-compiling. Just like other tests, it will use the [`runner` setting](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) to run the tests. If you need to disable tests for a target, you can use the [ignore doctest attribute](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#ignoring-targets) to specify the targets to ignore.
96+
97+
98+
<a id="1.89.0-Rustdoc"></a>
99+
100+
Rustdoc
101+
-----
102+
- [On mobile, make the sidebar full width and linewrap](https://github.com/rust-lang/rust/pull/139831). This makes long section and item names much easier to deal with on mobile.
103+
104+
105+
<a id="1.89.0-Compatibility-Notes"></a>
106+
107+
Compatibility Notes
108+
-------------------
109+
- [Make `missing_fragment_specifier` an unconditional error](https://github.com/rust-lang/rust/pull/128425)
110+
- [Enabling the `neon` target feature on `aarch64-unknown-none-softfloat` causes a warning](https://github.com/rust-lang/rust/pull/135160) because mixing code with and without that target feature is not properly supported by LLVM
111+
- [Sized Hierarchy: Part I](https://github.com/rust-lang/rust/pull/137944)
112+
- Introduces a small breaking change affecting `?Sized` bounds on impls on recursive types which contain associated type projections. It is not expected to affect any existing published crates. Can be fixed by refactoring the involved types or opting into the `sized_hierarchy` unstable feature. See the [FCP report](https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485) for a code example.
113+
- The warn-by-default `elided_named_lifetimes` lint is [superseded by the warn-by-default `mismatched_lifetime_syntaxes` lint.](https://github.com/rust-lang/rust/pull/138677)
114+
- [Error on recursive opaque types earlier in the type checker](https://github.com/rust-lang/rust/pull/139419)
115+
- [Type inference side effects from requiring element types of array repeat expressions are `Copy` are now only available at the end of type checking](https://github.com/rust-lang/rust/pull/139635)
116+
- [The deprecated accidentally-stable `std::intrinsics::{copy,copy_nonoverlapping,write_bytes}` are now proper intrinsics](https://github.com/rust-lang/rust/pull/139916). There are no debug assertions guarding against UB, and they cannot be coerced to function pointers.
117+
- [Remove long-deprecated `std::intrinsics::drop_in_place`](https://github.com/rust-lang/rust/pull/140151)
118+
- [Make well-formedness predicates no longer coinductive](https://github.com/rust-lang/rust/pull/140208)
119+
- [Remove hack when checking impl method compatibility](https://github.com/rust-lang/rust/pull/140557)
120+
- [Remove unnecessary type inference due to built-in trait object impls](https://github.com/rust-lang/rust/pull/141352)
121+
- [Lint against "stdcall", "fastcall", and "cdecl" on non-x86-32 targets](https://github.com/rust-lang/rust/pull/141435)
122+
- [Future incompatibility warnings relating to the never type (`!`) are now reported in dependencies](https://github.com/rust-lang/rust/pull/141937)
123+
- [Ensure `std::ptr::copy_*` intrinsics also perform the static self-init checks](https://github.com/rust-lang/rust/pull/142575)
124+
- [`extern "C"` functions on the `wasm32-unknown-unknown` target now have a standards compliant ABI](https://blog.rust-lang.org/2025/04/04/c-abi-changes-for-wasm32-unknown-unknown/)
125+
126+
<a id="1.89.0-Internal-Changes"></a>
127+
128+
Internal Changes
129+
----------------
130+
131+
These changes do not affect any public interfaces of Rust, but they represent
132+
significant improvements to the performance or internals of rustc and related
133+
tools.
134+
135+
- [Correctly un-remap compiler sources paths with the `rustc-dev` component](https://github.com/rust-lang/rust/pull/142377)
136+
137+
1138
Version 1.88.0 (2025-06-26)
2139
==========================
3140

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
9898
}
9999

100100
let expr_hir_id = self.lower_node_id(e.id);
101-
self.lower_attrs(expr_hir_id, &e.attrs, e.span);
101+
let attrs = self.lower_attrs(expr_hir_id, &e.attrs, e.span);
102102

103103
let kind = match &e.kind {
104104
ExprKind::Array(exprs) => hir::ExprKind::Array(self.lower_exprs(exprs)),
@@ -232,10 +232,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
232232
*fn_arg_span,
233233
),
234234
None => self.lower_expr_closure(
235+
attrs,
235236
binder,
236237
*capture_clause,
237238
e.id,
238-
expr_hir_id,
239239
*constness,
240240
*movability,
241241
fn_decl,
@@ -1052,10 +1052,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
10521052

10531053
fn lower_expr_closure(
10541054
&mut self,
1055+
attrs: &[rustc_hir::Attribute],
10551056
binder: &ClosureBinder,
10561057
capture_clause: CaptureBy,
10571058
closure_id: NodeId,
1058-
closure_hir_id: hir::HirId,
10591059
constness: Const,
10601060
movability: Movability,
10611061
decl: &FnDecl,
@@ -1067,15 +1067,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
10671067
let (binder_clause, generic_params) = self.lower_closure_binder(binder);
10681068

10691069
let (body_id, closure_kind) = self.with_new_scopes(fn_decl_span, move |this| {
1070-
let mut coroutine_kind = if this
1071-
.attrs
1072-
.get(&closure_hir_id.local_id)
1073-
.is_some_and(|attrs| attrs.iter().any(|attr| attr.has_name(sym::coroutine)))
1074-
{
1075-
Some(hir::CoroutineKind::Coroutine(Movability::Movable))
1076-
} else {
1077-
None
1078-
};
1070+
1071+
let mut coroutine_kind = find_attr!(attrs, AttributeKind::Coroutine(_) => hir::CoroutineKind::Coroutine(Movability::Movable));
1072+
10791073
// FIXME(contracts): Support contracts on closures?
10801074
let body_id = this.lower_fn_body(decl, None, |this| {
10811075
this.coroutine_kind = coroutine_kind;

compiler/rustc_ast_passes/messages.ftl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ ast_passes_tilde_const_disallowed = `[const]` is not allowed here
241241
.trait_assoc_ty = associated types in non-`const` traits cannot have `[const]` trait bounds
242242
.trait_impl_assoc_ty = associated types in non-const impls cannot have `[const]` trait bounds
243243
.inherent_assoc_ty = inherent associated types cannot have `[const]` trait bounds
244+
.struct = structs cannot have `[const]` trait bounds
245+
.enum = enums cannot have `[const]` trait bounds
246+
.union = unions cannot have `[const]` trait bounds
247+
.anon_const = anonymous constants cannot have `[const]` trait bounds
244248
.object = trait objects cannot have `[const]` trait bounds
245249
.item = this item cannot have `[const]` trait bounds
246250

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
11241124
);
11251125
}
11261126
}
1127-
visit::walk_item(self, item)
1127+
self.with_tilde_const(Some(TildeConstReason::Enum { span: item.span }), |this| {
1128+
visit::walk_item(this, item)
1129+
});
11281130
}
11291131
ItemKind::Trait(box Trait {
11301132
constness,
@@ -1175,26 +1177,32 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
11751177
}
11761178
visit::walk_item(self, item)
11771179
}
1178-
ItemKind::Struct(ident, generics, vdata) => match vdata {
1179-
VariantData::Struct { fields, .. } => {
1180-
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
1181-
self.visit_generics(generics);
1182-
walk_list!(self, visit_field_def, fields);
1183-
}
1184-
_ => visit::walk_item(self, item),
1185-
},
1180+
ItemKind::Struct(ident, generics, vdata) => {
1181+
self.with_tilde_const(Some(TildeConstReason::Struct { span: item.span }), |this| {
1182+
match vdata {
1183+
VariantData::Struct { fields, .. } => {
1184+
this.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
1185+
this.visit_generics(generics);
1186+
walk_list!(this, visit_field_def, fields);
1187+
}
1188+
_ => visit::walk_item(this, item),
1189+
}
1190+
})
1191+
}
11861192
ItemKind::Union(ident, generics, vdata) => {
11871193
if vdata.fields().is_empty() {
11881194
self.dcx().emit_err(errors::FieldlessUnion { span: item.span });
11891195
}
1190-
match vdata {
1191-
VariantData::Struct { fields, .. } => {
1192-
self.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
1193-
self.visit_generics(generics);
1194-
walk_list!(self, visit_field_def, fields);
1196+
self.with_tilde_const(Some(TildeConstReason::Union { span: item.span }), |this| {
1197+
match vdata {
1198+
VariantData::Struct { fields, .. } => {
1199+
this.visit_attrs_vis_ident(&item.attrs, &item.vis, ident);
1200+
this.visit_generics(generics);
1201+
walk_list!(this, visit_field_def, fields);
1202+
}
1203+
_ => visit::walk_item(this, item),
11951204
}
1196-
_ => visit::walk_item(self, item),
1197-
}
1205+
});
11981206
}
11991207
ItemKind::Const(box ConstItem { defaultness, expr, .. }) => {
12001208
self.check_defaultness(item.span, *defaultness);
@@ -1623,6 +1631,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
16231631
_ => self.with_in_trait_impl(None, |this| visit::walk_assoc_item(this, item, ctxt)),
16241632
}
16251633
}
1634+
1635+
fn visit_anon_const(&mut self, anon_const: &'a AnonConst) {
1636+
self.with_tilde_const(
1637+
Some(TildeConstReason::AnonConst { span: anon_const.value.span }),
1638+
|this| visit::walk_anon_const(this, anon_const),
1639+
)
1640+
}
16261641
}
16271642

16281643
/// When encountering an equality constraint in a `where` clause, emit an error. If the code seems

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,26 @@ pub(crate) enum TildeConstReason {
623623
#[primary_span]
624624
span: Span,
625625
},
626+
#[note(ast_passes_struct)]
627+
Struct {
628+
#[primary_span]
629+
span: Span,
630+
},
631+
#[note(ast_passes_enum)]
632+
Enum {
633+
#[primary_span]
634+
span: Span,
635+
},
636+
#[note(ast_passes_union)]
637+
Union {
638+
#[primary_span]
639+
span: Span,
640+
},
641+
#[note(ast_passes_anon_const)]
642+
AnonConst {
643+
#[primary_span]
644+
span: Span,
645+
},
626646
#[note(ast_passes_object)]
627647
TraitObject,
628648
#[note(ast_passes_item)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! Attributes that can be found in function body.
2+
3+
use rustc_hir::attrs::AttributeKind;
4+
use rustc_span::{Symbol, sym};
5+
6+
use super::{NoArgsAttributeParser, OnDuplicate};
7+
use crate::context::Stage;
8+
9+
pub(crate) struct CoroutineParser;
10+
11+
impl<S: Stage> NoArgsAttributeParser<S> for CoroutineParser {
12+
const PATH: &[Symbol] = &[sym::coroutine];
13+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
14+
const CREATE: fn(rustc_span::Span) -> AttributeKind = |span| AttributeKind::Coroutine(span);
15+
}

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use crate::parser::ArgParser;
2626
use crate::session_diagnostics::UnusedMultiple;
2727

2828
pub(crate) mod allow_unstable;
29+
pub(crate) mod body;
2930
pub(crate) mod cfg;
3031
pub(crate) mod cfg_old;
3132
pub(crate) mod codegen_attrs;

0 commit comments

Comments
 (0)