Skip to content

Commit 28386ac

Browse files
authored
Merge branch 'master' into EO412_replacement_with_EO425
2 parents 6fd6509 + ab67c37 commit 28386ac

File tree

448 files changed

+7714
-3372
lines changed

Some content is hidden

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

448 files changed

+7714
-3372
lines changed

.mailmap

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Aaron Todd <[email protected]>
99
Abhishek Chanda <[email protected]> Abhishek Chanda <[email protected]>
1010
Abhijeet Bhagat <[email protected]>
1111
Abroskin Alexander <[email protected]>
12-
Adolfo Ochagavía <[email protected]>
12+
1313
Adrian Heine né Lang <[email protected]>
1414
Adrien Tétar <[email protected]>
1515
@@ -36,6 +36,7 @@ Amanda Stjerna <[email protected]> <[email protected]>
3636
3737
3838
39+
3940
Ana-Maria Mihalache <[email protected]>
4041
Anatoly Ikorsky <[email protected]>
4142
Andre Bogus <[email protected]>
@@ -276,7 +277,8 @@ Irina Popa <[email protected]>
276277
Ivan Ivaschenko <[email protected]>
277278
ivan tkachenko <[email protected]>
278279
J. J. Weber <[email protected]>
279-
280+
281+
280282
281283
Jacob Hoffman-Andrews <[email protected]> <[email protected]>
282284
Jacob Greenfield <[email protected]>
@@ -292,6 +294,8 @@ Jakub Adam Wieczorek <[email protected]>
292294
Jakub Adam Wieczorek <[email protected]> <[email protected]>
293295
Jakub Adam Wieczorek <[email protected]> <[email protected]>
294296
Jakub Adam Wieczorek <[email protected]> <[email protected]>
297+
Jakub Adam Wieczorek <[email protected]> <[email protected]>
298+
Jakub Adam Wieczorek <[email protected]> <[email protected]>
295299
296300
James [Undefined] <[email protected]>
297301
@@ -303,6 +307,7 @@ Jamie Hill-Daniel <[email protected]> <[email protected]>
303307
Jana Dönszelmann <[email protected]>
304308
305309
310+
306311
307312
Jaro Fietz <[email protected]>
308313
Jason Fager <[email protected]>
@@ -313,6 +318,7 @@ Jason Toffaletti <[email protected]> Jason Toffaletti <[email protected]>
313318
Jauhien Piatlicki <[email protected]> Jauhien Piatlicki <[email protected]>
314319
315320
Jeremy Letang <[email protected]>
321+
316322
Jeremy Sorensen <[email protected]>
317323
318324
@@ -336,6 +342,7 @@ John Kåre Alsaker <[email protected]>
336342
John Kåre Alsaker <[email protected]> <[email protected]>
337343
John Talling <[email protected]>
338344
John Van Enk <[email protected]>
345+
339346
Jonas Tepe <[email protected]>
340347
341348
Jonathan Chan Kwan Yin <[email protected]>
@@ -424,7 +431,7 @@ Malo Jaffré <[email protected]>
424431
Manish Goregaokar <[email protected]>
425432
426433
Marcell Pardavi <[email protected]>
427-
Marco Ieni <[email protected]>
434+
428435
Marcus Klaas de Vries <[email protected]>
429436
Margaret Meyerhofer <[email protected]> <mmeyerho@andrew>
430437
@@ -531,6 +538,7 @@ Oliver Scherer <[email protected]> <[email protected]>
531538
532539
533540
Oliver Scherer <[email protected]>
541+
534542
535543
Onur Özkan <[email protected]>
536544
Ömer Sinan Ağacan <[email protected]>
@@ -591,6 +599,7 @@ Rusty Blitzerr <[email protected]>
591599
RustyYato <[email protected]>
592600
Ruud van Asseldonk <[email protected]> Ruud van Asseldonk <[email protected]>
593601
Ryan Leung <[email protected]>
602+
594603
Ryan Scheel <[email protected]>
595604
Ryan Sullivant <[email protected]>
596605
Ryan Wiedemann <[email protected]>
@@ -686,6 +695,8 @@ Weihang Lo <[email protected]>
686695
687696
688697
whitequark <[email protected]>
698+
699+
689700
690701
691702
@@ -695,6 +706,8 @@ Xinye Tao <[email protected]>
695706
Xuefeng Wu <[email protected]> Xuefeng Wu <[email protected]>
696707
Xuefeng Wu <[email protected]> XuefengWu <[email protected]>
697708
York Xiang <[email protected]>
709+
710+
698711
699712
700713
Youngsuk Kim <[email protected]>

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,9 +2334,9 @@ dependencies = [
23342334

23352335
[[package]]
23362336
name = "memchr"
2337-
version = "2.7.5"
2337+
version = "2.7.6"
23382338
source = "registry+https://github.com/rust-lang/crates.io-index"
2339-
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
2339+
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
23402340

23412341
[[package]]
23422342
name = "memmap2"

RELEASES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Version 1.91.1 (2025-11-10)
2+
===========================
3+
4+
<a id="1.91.1"></a>
5+
6+
- [Enable file locking support in illumos](https://github.com/rust-lang/rust/pull/148322). This fixes Cargo not locking the build directory on illumos.
7+
- [Fix `wasm_import_module` attribute cross-crate](https://github.com/rust-lang/rust/pull/148363). This fixes linker errors on WASM targets.
8+
19
Version 1.91.0 (2025-10-30)
210
==========================
311

compiler/rustc_ast/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2024"
66
[dependencies]
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
9-
memchr = "2.7.4"
9+
memchr = "2.7.6"
1010
rustc-literal-escaper = "0.0.5"
1111
rustc_ast_ir = { path = "../rustc_ast_ir" }
1212
rustc_data_structures = { path = "../rustc_data_structures" }

compiler/rustc_ast/src/ast.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,15 @@ impl Pat {
714714
}
715715
}
716716

717+
/// Strip off all reference patterns (`&`, `&mut`) and return the inner pattern.
718+
pub fn peel_refs(&self) -> &Pat {
719+
let mut current = self;
720+
while let PatKind::Ref(inner, _) = &current.kind {
721+
current = inner;
722+
}
723+
current
724+
}
725+
717726
/// Is this a `..` pattern?
718727
pub fn is_rest(&self) -> bool {
719728
matches!(self.kind, PatKind::Rest)
@@ -3759,10 +3768,29 @@ pub struct ConstItem {
37593768
pub ident: Ident,
37603769
pub generics: Generics,
37613770
pub ty: Box<Ty>,
3762-
pub expr: Option<Box<Expr>>,
3771+
pub rhs: Option<ConstItemRhs>,
37633772
pub define_opaque: Option<ThinVec<(NodeId, Path)>>,
37643773
}
37653774

3775+
#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
3776+
pub enum ConstItemRhs {
3777+
TypeConst(AnonConst),
3778+
Body(Box<Expr>),
3779+
}
3780+
3781+
impl ConstItemRhs {
3782+
pub fn span(&self) -> Span {
3783+
self.expr().span
3784+
}
3785+
3786+
pub fn expr(&self) -> &Expr {
3787+
match self {
3788+
ConstItemRhs::TypeConst(anon_const) => &anon_const.value,
3789+
ConstItemRhs::Body(expr) => expr,
3790+
}
3791+
}
3792+
}
3793+
37663794
// Adding a new variant? Please update `test_item` in `tests/ui/macros/stringify.rs`.
37673795
#[derive(Clone, Encodable, Decodable, Debug)]
37683796
pub enum ItemKind {

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ macro_rules! common_visitor_and_walkers {
423423
Closure,
424424
Const,
425425
ConstItem,
426+
ConstItemRhs,
426427
Defaultness,
427428
Delegation,
428429
DelegationMac,

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -170,37 +170,36 @@ impl<'hir> LoweringContext<'_, 'hir> {
170170
}
171171
ItemKind::Static(box ast::StaticItem {
172172
ident,
173-
ty: t,
173+
ty,
174174
safety: _,
175175
mutability: m,
176176
expr: e,
177177
define_opaque,
178178
}) => {
179179
let ident = self.lower_ident(*ident);
180-
let (ty, body_id) =
181-
self.lower_const_item(t, span, e.as_deref(), ImplTraitPosition::StaticTy);
180+
let ty =
181+
self.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::StaticTy));
182+
let body_id = self.lower_const_body(span, e.as_deref());
182183
self.lower_define_opaque(hir_id, define_opaque);
183184
hir::ItemKind::Static(*m, ident, ty, body_id)
184185
}
185186
ItemKind::Const(box ast::ConstItem {
186-
ident,
187-
generics,
188-
ty,
189-
expr,
190-
define_opaque,
191-
..
187+
ident, generics, ty, rhs, define_opaque, ..
192188
}) => {
193189
let ident = self.lower_ident(*ident);
194-
let (generics, (ty, body_id)) = self.lower_generics(
190+
let (generics, (ty, rhs)) = self.lower_generics(
195191
generics,
196192
id,
197193
ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
198194
|this| {
199-
this.lower_const_item(ty, span, expr.as_deref(), ImplTraitPosition::ConstTy)
195+
let ty = this
196+
.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy));
197+
let rhs = this.lower_const_item_rhs(attrs, rhs.as_ref(), span);
198+
(ty, rhs)
200199
},
201200
);
202201
self.lower_define_opaque(hir_id, &define_opaque);
203-
hir::ItemKind::Const(ident, generics, ty, body_id)
202+
hir::ItemKind::Const(ident, generics, ty, rhs)
204203
}
205204
ItemKind::Fn(box Fn {
206205
sig: FnSig { decl, header, span: fn_sig_span },
@@ -462,17 +461,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
462461
}
463462
}
464463

465-
fn lower_const_item(
466-
&mut self,
467-
ty: &Ty,
468-
span: Span,
469-
body: Option<&Expr>,
470-
impl_trait_position: ImplTraitPosition,
471-
) -> (&'hir hir::Ty<'hir>, hir::BodyId) {
472-
let ty = self.lower_ty(ty, ImplTraitContext::Disallowed(impl_trait_position));
473-
(ty, self.lower_const_body(span, body))
474-
}
475-
476464
#[instrument(level = "debug", skip(self))]
477465
fn lower_use_tree(
478466
&mut self,
@@ -804,12 +792,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
804792

805793
let (ident, generics, kind, has_default) = match &i.kind {
806794
AssocItemKind::Const(box ConstItem {
807-
ident,
808-
generics,
809-
ty,
810-
expr,
811-
define_opaque,
812-
..
795+
ident, generics, ty, rhs, define_opaque, ..
813796
}) => {
814797
let (generics, kind) = self.lower_generics(
815798
generics,
@@ -818,14 +801,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
818801
|this| {
819802
let ty = this
820803
.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy));
821-
let body = expr.as_ref().map(|x| this.lower_const_body(i.span, Some(x)));
822-
823-
hir::TraitItemKind::Const(ty, body)
804+
let rhs = rhs
805+
.as_ref()
806+
.map(|rhs| this.lower_const_item_rhs(attrs, Some(rhs), i.span));
807+
hir::TraitItemKind::Const(ty, rhs)
824808
},
825809
);
826810

827811
if define_opaque.is_some() {
828-
if expr.is_some() {
812+
if rhs.is_some() {
829813
self.lower_define_opaque(hir_id, &define_opaque);
830814
} else {
831815
self.dcx().span_err(
@@ -835,7 +819,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
835819
}
836820
}
837821

838-
(*ident, generics, kind, expr.is_some())
822+
(*ident, generics, kind, rhs.is_some())
839823
}
840824
AssocItemKind::Fn(box Fn {
841825
sig, ident, generics, body: None, define_opaque, ..
@@ -1022,12 +1006,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10221006

10231007
let (ident, (generics, kind)) = match &i.kind {
10241008
AssocItemKind::Const(box ConstItem {
1025-
ident,
1026-
generics,
1027-
ty,
1028-
expr,
1029-
define_opaque,
1030-
..
1009+
ident, generics, ty, rhs, define_opaque, ..
10311010
}) => (
10321011
*ident,
10331012
self.lower_generics(
@@ -1037,9 +1016,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
10371016
|this| {
10381017
let ty = this
10391018
.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy));
1040-
let body = this.lower_const_body(i.span, expr.as_deref());
10411019
this.lower_define_opaque(hir_id, &define_opaque);
1042-
hir::ImplItemKind::Const(ty, body)
1020+
let rhs = this.lower_const_item_rhs(attrs, rhs.as_ref(), i.span);
1021+
hir::ImplItemKind::Const(ty, rhs)
10431022
},
10441023
),
10451024
),

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,6 +2327,33 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23272327
self.arena.alloc(hir::ConstArg { hir_id: self.next_id(), kind: ct_kind })
23282328
}
23292329

2330+
fn lower_const_item_rhs(
2331+
&mut self,
2332+
attrs: &[hir::Attribute],
2333+
rhs: Option<&ConstItemRhs>,
2334+
span: Span,
2335+
) -> hir::ConstItemRhs<'hir> {
2336+
match rhs {
2337+
Some(ConstItemRhs::TypeConst(anon)) => {
2338+
hir::ConstItemRhs::TypeConst(self.lower_anon_const_to_const_arg(anon))
2339+
}
2340+
None if attr::contains_name(attrs, sym::type_const) => {
2341+
let const_arg = ConstArg {
2342+
hir_id: self.next_id(),
2343+
kind: hir::ConstArgKind::Error(
2344+
DUMMY_SP,
2345+
self.dcx().span_delayed_bug(DUMMY_SP, "no block"),
2346+
),
2347+
};
2348+
hir::ConstItemRhs::TypeConst(self.arena.alloc(const_arg))
2349+
}
2350+
Some(ConstItemRhs::Body(body)) => {
2351+
hir::ConstItemRhs::Body(self.lower_const_body(span, Some(body)))
2352+
}
2353+
None => hir::ConstItemRhs::Body(self.lower_const_body(span, None)),
2354+
}
2355+
}
2356+
23302357
/// See [`hir::ConstArg`] for when to use this function vs
23312358
/// [`Self::lower_anon_const_to_anon_const`].
23322359
fn lower_anon_const_to_const_arg(&mut self, anon: &AnonConst) -> &'hir hir::ConstArg<'hir> {

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,9 +1239,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
12391239
}
12401240
});
12411241
}
1242-
ItemKind::Const(box ConstItem { defaultness, expr, .. }) => {
1242+
ItemKind::Const(box ConstItem { defaultness, rhs, .. }) => {
12431243
self.check_defaultness(item.span, *defaultness);
1244-
if expr.is_none() {
1244+
if rhs.is_none() {
12451245
self.dcx().emit_err(errors::ConstWithoutBody {
12461246
span: item.span,
12471247
replace_span: self.ending_semi_or_hi(item.span),
@@ -1581,7 +1581,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
15811581

15821582
if let AssocCtxt::Impl { .. } = ctxt {
15831583
match &item.kind {
1584-
AssocItemKind::Const(box ConstItem { expr: None, .. }) => {
1584+
AssocItemKind::Const(box ConstItem { rhs: None, .. }) => {
15851585
self.dcx().emit_err(errors::AssocConstWithoutBody {
15861586
span: item.span,
15871587
replace_span: self.ending_semi_or_hi(item.span),

0 commit comments

Comments
 (0)