Skip to content

Commit 656fe2f

Browse files
authored
Merge pull request #4677 from rust-lang/rustup-2025-11-10
Automatic Rustup
2 parents 69be846 + 3c56919 commit 656fe2f

File tree

633 files changed

+8814
-4496
lines changed

Some content is hidden

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

633 files changed

+8814
-4496
lines changed

.mailmap

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Aaron Todd <github@opprobrio.us>
99
Abhishek Chanda <abhishek.becs@gmail.com> Abhishek Chanda <abhishek@cloudscaling.com>
1010
Abhijeet Bhagat <abhijeet.bhagat@gmx.com>
1111
Abroskin Alexander <arkweid@evilmartians.com>
12-
Adolfo Ochagavía <aochagavia92@gmail.com>
12+
Adolfo Ochagavía <aochagavia92@gmail.com> <github@adolfo.ochagavia.xyz>
1313
Adrian Heine né Lang <mail@adrianheine.de>
1414
Adrien Tétar <adri-from-59@hotmail.fr>
1515
Ahmed Charles <ahmedcharles@gmail.com> <acharles@outlook.com>
@@ -36,6 +36,7 @@ Amanda Stjerna <mail@amandastjerna.se> <albin.stjerna@gmail.com>
3636
Amanda Stjerna <mail@amandastjerna.se> <amanda.stjerna@it.uu.se>
3737
Amanieu d'Antras <amanieu@gmail.com> <amanieu.dantras@huawei.com>
3838
Amos Onn <amosonn@gmail.com>
39+
Amos Wenger <amoswenger@gmail.com> <fasterthanlime@users.noreply.github.com>
3940
Ana-Maria Mihalache <mihalacheana.maria@yahoo.com>
4041
Anatoly Ikorsky <aikorsky@gmail.com>
4142
Andre Bogus <bogusandre@gmail.com>
@@ -138,7 +139,6 @@ Christian Poveda <git@pvdrz.com> <31802960+christianpoveda@users.noreply.github.
138139
Christian Poveda <git@pvdrz.com> <christianpoveda@uhura.edef.eu>
139140
Christian Vallentin <vallentinsource@gmail.com>
140141
Christoffer Buchholz <chris@chrisbuchholz.me>
141-
Christopher Durham <cad97@cad97.com>
142142
Clark Gaebel <cg.wowus.cg@gmail.com> <cgaebel@mozilla.com>
143143
Clement Miao <clementmiao@gmail.com>
144144
Clément Renault <renault.cle@gmail.com>
@@ -147,6 +147,7 @@ Clinton Ryan <clint.ryan3@gmail.com>
147147
Taylor Cramer <cramertaylorj@gmail.com> <cramertj@google.com>
148148
ember arlynx <ember@lunar.town> <corey@octayn.net>
149149
Crazycolorz5 <Crazycolorz5@gmail.com>
150+
Crystal Durham <cad97@cad97.com>
150151
csmoe <35686186+csmoe@users.noreply.github.com>
151152
Cyryl Płotnicki <cyplo@cyplo.net>
152153
Damien Schoof <damien.schoof@gmail.com>
@@ -276,7 +277,8 @@ Irina Popa <irinagpopa@gmail.com>
276277
Ivan Ivaschenko <defuz.net@gmail.com>
277278
ivan tkachenko <me@ratijas.tk>
278279
J. J. Weber <jjweber@gmail.com>
279-
Jack Huey <jack.huey@umassmed.edu> <jackh726@gmail.com>
280+
Jack Huey <jackh726@gmail.com> <jack.huey@umassmed.edu>
281+
Jack Huey <jackh726@gmail.com> <31162821+jackh726@users.noreply.github.com>
280282
Jacob <jacob.macritchie@gmail.com>
281283
Jacob Hoffman-Andrews <rust@hoffman-andrews.com> <github@hoffman-andrews.com>
282284
Jacob Greenfield <xales@naveria.com>
@@ -292,6 +294,8 @@ Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com>
292294
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub.bukaj@yahoo.com>
293295
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakub@jakub.cc>
294296
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <jakubw@jakubw.net>
297+
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <ja.wieczorek@student.uw.edu.pl>
298+
Jakub Adam Wieczorek <jakub.adam.wieczorek@gmail.com> <software@jacobadam.net>
295299
Jakub Beránek <berykubik@gmail.com> <jakub.beranek@vsb.cz>
296300
James [Undefined] <tpzker@thepuzzlemaker.info>
297301
James Deng <cnjamesdeng@gmail.com> <cnJamesDeng@gmail.com>
@@ -303,6 +307,7 @@ Jamie Hill-Daniel <jamie@hill-daniel.co.uk> <clubby789@gmail.com>
303307
Jana Dönszelmann <jana@donsz.nl>
304308
Jana Dönszelmann <jana@donsz.nl> <jonathan@donsz.nl>
305309
Jana Dönszelmann <jana@donsz.nl> <jonabent@gmail.com>
310+
Jane Lusby <jlusby42@gmail.com> <jlusby@yaah.dev>
306311
Jan-Erik Rediger <janerik@fnordig.de> <badboy@archlinux.us>
307312
Jaro Fietz <jaro.fietz@gmx.de>
308313
Jason Fager <jfager@gmail.com>
@@ -313,6 +318,7 @@ Jason Toffaletti <toffaletti@gmail.com> Jason Toffaletti <jason@topsy.com>
313318
Jauhien Piatlicki <jauhien@gentoo.org> Jauhien Piatlicki <jpiatlicki@zertisa.com>
314319
Jay True <glacjay@gmail.com>
315320
Jeremy Letang <letang.jeremy@gmail.com>
321+
Jeremy Soller <jackpot51@gmail.com> <jeremy@system76.com>
316322
Jeremy Sorensen <jeremy.a.sorensen@gmail.com>
317323
Jeremy Stucki <dev@jeremystucki.ch> <stucki.jeremy@gmail.com>
318324
Jeremy Stucki <dev@jeremystucki.ch> <jeremy@myelin.ch>
@@ -336,6 +342,7 @@ John Kåre Alsaker <john.kare.alsaker@gmail.com>
336342
John Kåre Alsaker <john.kare.alsaker@gmail.com> <zoxc32@gmail.com>
337343
John Talling <inrustwetrust@users.noreply.github.com>
338344
John Van Enk <vanenkj@gmail.com>
345+
Jon Gjengset <jon@thesquareplanet.com> <jongje@amazon.com>
339346
Jonas Tepe <jonasprogrammer@gmail.com>
340347
Jonathan Bailey <jbailey@mozilla.com> <jbailey@jbailey-20809.local>
341348
Jonathan Chan Kwan Yin <sofe2038@gmail.com>
@@ -424,7 +431,7 @@ Malo Jaffré <jaffre.malo@gmail.com>
424431
Manish Goregaokar <manishsmail@gmail.com>
425432
Mara Bos <m-ou.se@m-ou.se>
426433
Marcell Pardavi <marcell.pardavi@gmail.com>
427-
Marco Ieni <11428655+MarcoIeni@users.noreply.github.com>
434+
Marco Ieni <marcoieni@rustfoundation.org> <11428655+MarcoIeni@users.noreply.github.com>
428435
Marcus Klaas de Vries <mail@marcusklaas.nl>
429436
Margaret Meyerhofer <mmeyerho@andrew.cmu.edu> <mmeyerho@andrew>
430437
Marijn Schouten <mhkbst@gmail.com> <hkBst@users.noreply.github.com>
@@ -531,6 +538,7 @@ Oliver Scherer <oli-obk@users.noreply.github.com> <oliver.schneider@kit.edu>
531538
Oliver Scherer <oli-obk@users.noreply.github.com> <obk8176014uqher834@olio-obk.de>
532539
Oliver Scherer <oli-obk@users.noreply.github.com> <rustc-contact@oli-obk.de>
533540
Oliver Scherer <oli-obk@users.noreply.github.com>
541+
Onur Özkan <onurozkan.dev@outlook.com> <contact@onurozkan.dev>
534542
Onur Özkan <onurozkan.dev@outlook.com> <work@onurozkan.dev>
535543
Onur Özkan <onurozkan.dev@outlook.com>
536544
Ömer Sinan Ağacan <omeragacan@gmail.com>
@@ -591,6 +599,7 @@ Rusty Blitzerr <rusty.blitzerr@gmail.com>
591599
RustyYato <krishna.sd.2012@gmail.com>
592600
Ruud van Asseldonk <dev@veniogames.com> Ruud van Asseldonk <ruuda@google.com>
593601
Ryan Leung <rleungx@gmail.com>
602+
Ryan Levick <me@ryanlevick.com> <rylev@users.noreply.github.com>
594603
Ryan Scheel <ryan.havvy@gmail.com>
595604
Ryan Sullivant <rsulli55@gmail.com>
596605
Ryan Wiedemann <Ryan1729@gmail.com>
@@ -686,6 +695,8 @@ Weihang Lo <me@weihanglo.tw>
686695
Weihang Lo <me@weihanglo.tw> <weihanglo@users.noreply.github.com>
687696
Wesley Wiser <wwiser@gmail.com> <wesleywiser@microsoft.com>
688697
whitequark <whitequark@whitequark.org>
698+
Will Crichton <crichton.will@gmail.com> <wcrichto@stanford.edu>
699+
Will Crichton <crichton.will@gmail.com> <wcrichto@cs.stanford.edu>
689700
William Ting <io@williamting.com> <william.h.ting@gmail.com>
690701
Wim Looman <wim@nemo157.com> <rust-lang@nemo157.com>
691702
Wim Looman <wim@nemo157.com> <git@nemo157.com>
@@ -695,6 +706,8 @@ Xinye Tao <xy.tao@outlook.com>
695706
Xuefeng Wu <benewu@gmail.com> Xuefeng Wu <xfwu@thoughtworks.com>
696707
Xuefeng Wu <benewu@gmail.com> XuefengWu <benewu@gmail.com>
697708
York Xiang <bombless@126.com>
709+
Yoshua Wuyts <yoshuawuyts@gmail.com> <yoshuawuyts+github@gmail.com>
710+
Yoshua Wuyts <yoshuawuyts@gmail.com> <2467194+yoshuawuyts@users.noreply.github.com>
698711
Yotam Ofek <yotam.ofek@gmail.com> <yotamofek@microsoft.com>
699712
Youngsoo Son <ysson83@gmail.com> <ysoo.son@samsung.com>
700713
Youngsuk Kim <joseph942010@gmail.com>

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/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ ast_passes_trait_fn_const =
290290
*[false] {""}
291291
}
292292
.make_impl_const_sugg = ... and declare the impl to be const instead
293-
.make_trait_const_sugg = ... and declare the trait to be a `#[const_trait]` instead
293+
.make_trait_const_sugg = ... and declare the trait to be const instead
294294
295295
ast_passes_trait_object_single_bound = only a single explicit lifetime bound is permitted
296296

0 commit comments

Comments
 (0)