Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 2205455

Browse files
committed
Auto merge of rust-lang#139634 - matthiaskrgr:rollup-45shqa5, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#139502 (fix "still mutable" ice while metrics are enabled) - rust-lang#139510 (Rename some `name` variables as `ident`.) - rust-lang#139606 (Update compiletest to Edition 2024) - rust-lang#139609 (compiletest: don't use stringly paths for `compose_and_run`) - rust-lang#139614 (Avoid empty identifiers for delegate params and args.) - rust-lang#139626 (Remove unnecessary `mut` in test.) - rust-lang#139630 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 69b3959 + c9613f8 commit 2205455

File tree

94 files changed

+2014
-508
lines changed

Some content is hidden

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

94 files changed

+2014
-508
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,6 +2312,7 @@ name = "miri"
23122312
version = "0.1.0"
23132313
dependencies = [
23142314
"aes",
2315+
"bitflags",
23152316
"chrono",
23162317
"chrono-tz",
23172318
"colored",

compiler/rustc_ast/src/expand/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ pub mod typetree;
1313
#[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)]
1414
pub struct StrippedCfgItem<ModId = DefId> {
1515
pub parent_module: ModId,
16-
pub name: Ident,
16+
pub ident: Ident,
1717
pub cfg: MetaItem,
1818
}
1919

2020
impl<ModId> StrippedCfgItem<ModId> {
2121
pub fn map_mod_id<New>(self, f: impl FnOnce(ModId) -> New) -> StrippedCfgItem<New> {
22-
StrippedCfgItem { parent_module: f(self.parent_module), name: self.name, cfg: self.cfg }
22+
StrippedCfgItem { parent_module: f(self.parent_module), ident: self.ident, cfg: self.cfg }
2323
}
2424
}

compiler/rustc_ast_lowering/src/delegation.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use rustc_errors::ErrorGuaranteed;
4747
use rustc_hir::def_id::DefId;
4848
use rustc_middle::span_bug;
4949
use rustc_middle::ty::{Asyncness, ResolverAstLowering};
50-
use rustc_span::{Ident, Span};
50+
use rustc_span::{Ident, Span, Symbol};
5151
use {rustc_ast as ast, rustc_hir as hir};
5252

5353
use super::{GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode};
@@ -234,22 +234,23 @@ impl<'hir> LoweringContext<'_, 'hir> {
234234
hir::FnSig { decl, header, span }
235235
}
236236

237-
fn generate_param(&mut self, span: Span) -> (hir::Param<'hir>, NodeId) {
237+
fn generate_param(&mut self, idx: usize, span: Span) -> (hir::Param<'hir>, NodeId) {
238238
let pat_node_id = self.next_node_id();
239239
let pat_id = self.lower_node_id(pat_node_id);
240+
let ident = Ident::with_dummy_span(Symbol::intern(&format!("arg{idx}")));
240241
let pat = self.arena.alloc(hir::Pat {
241242
hir_id: pat_id,
242-
kind: hir::PatKind::Binding(hir::BindingMode::NONE, pat_id, Ident::empty(), None),
243+
kind: hir::PatKind::Binding(hir::BindingMode::NONE, pat_id, ident, None),
243244
span,
244245
default_binding_modes: false,
245246
});
246247

247248
(hir::Param { hir_id: self.next_id(), pat, ty_span: span, span }, pat_node_id)
248249
}
249250

250-
fn generate_arg(&mut self, param_id: HirId, span: Span) -> hir::Expr<'hir> {
251+
fn generate_arg(&mut self, idx: usize, param_id: HirId, span: Span) -> hir::Expr<'hir> {
251252
let segments = self.arena.alloc_from_iter(iter::once(hir::PathSegment {
252-
ident: Ident::empty(),
253+
ident: Ident::with_dummy_span(Symbol::intern(&format!("arg{idx}"))),
253254
hir_id: self.next_id(),
254255
res: Res::Local(param_id),
255256
args: None,
@@ -273,7 +274,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
273274
let mut args: Vec<hir::Expr<'_>> = Vec::with_capacity(param_count);
274275

275276
for idx in 0..param_count {
276-
let (param, pat_node_id) = this.generate_param(span);
277+
let (param, pat_node_id) = this.generate_param(idx, span);
277278
parameters.push(param);
278279

279280
let arg = if let Some(block) = block
@@ -289,7 +290,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
289290
this.ident_and_label_to_local_id.insert(pat_node_id, param.pat.hir_id.local_id);
290291
this.lower_target_expr(&block)
291292
} else {
292-
this.generate_arg(param.pat.hir_id, span)
293+
this.generate_arg(idx, param.pat.hir_id, span)
293294
};
294295
args.push(arg);
295296
}

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
645645
(
646646
// Disallow `impl Trait` in foreign items.
647647
this.lower_fn_decl(fdec, i.id, sig.span, FnDeclKind::ExternFn, None),
648-
this.lower_fn_params_to_names(fdec),
648+
this.lower_fn_params_to_idents(fdec),
649649
)
650650
});
651651

@@ -833,7 +833,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
833833
}) => {
834834
// FIXME(contracts): Deny contract here since it won't apply to
835835
// any impl method or callees.
836-
let names = self.lower_fn_params_to_names(&sig.decl);
836+
let idents = self.lower_fn_params_to_idents(&sig.decl);
837837
let (generics, sig) = self.lower_method_sig(
838838
generics,
839839
sig,
@@ -851,7 +851,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
851851
(
852852
*ident,
853853
generics,
854-
hir::TraitItemKind::Fn(sig, hir::TraitFn::Required(names)),
854+
hir::TraitItemKind::Fn(sig, hir::TraitFn::Required(idents)),
855855
false,
856856
)
857857
}

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12471247
safety: self.lower_safety(f.safety, hir::Safety::Safe),
12481248
abi: self.lower_extern(f.ext),
12491249
decl: self.lower_fn_decl(&f.decl, t.id, t.span, FnDeclKind::Pointer, None),
1250-
param_names: self.lower_fn_params_to_names(&f.decl),
1250+
param_idents: self.lower_fn_params_to_idents(&f.decl),
12511251
}))
12521252
}
12531253
TyKind::UnsafeBinder(f) => {
@@ -1494,7 +1494,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14941494
}))
14951495
}
14961496

1497-
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> &'hir [Option<Ident>] {
1497+
fn lower_fn_params_to_idents(&mut self, decl: &FnDecl) -> &'hir [Option<Ident>] {
14981498
self.arena.alloc_from_iter(decl.inputs.iter().map(|param| match param.pat.kind {
14991499
PatKind::Missing => None,
15001500
PatKind::Ident(_, ident, _) => Some(self.lower_ident(ident)),

compiler/rustc_ast_pretty/src/pprust/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use super::*;
77
fn fun_to_string(
88
decl: &ast::FnDecl,
99
header: ast::FnHeader,
10-
name: Ident,
10+
ident: Ident,
1111
generics: &ast::Generics,
1212
) -> String {
1313
to_string(|s| {
1414
s.head("");
15-
s.print_fn(decl, header, Some(name), generics);
15+
s.print_fn(decl, header, Some(ident), generics);
1616
s.end(); // Close the head box.
1717
s.end(); // Close the outer box.
1818
})

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,11 +2500,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
25002500
);
25012501
let ty::Tuple(params) = tupled_params.kind() else { return };
25022502

2503-
// Find the first argument with a matching type, get its name
2504-
let Some(this_name) = params.iter().zip(tcx.hir_body_param_names(closure.body)).find_map(
2505-
|(param_ty, name)| {
2503+
// Find the first argument with a matching type and get its identifier.
2504+
let Some(this_name) = params.iter().zip(tcx.hir_body_param_idents(closure.body)).find_map(
2505+
|(param_ty, ident)| {
25062506
// FIXME: also support deref for stuff like `Rc` arguments
2507-
if param_ty.peel_refs() == local_ty { name } else { None }
2507+
if param_ty.peel_refs() == local_ty { ident } else { None }
25082508
},
25092509
) else {
25102510
return;
@@ -3774,7 +3774,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
37743774
method_args,
37753775
*fn_span,
37763776
call_source.from_hir_call(),
3777-
self.infcx.tcx.fn_arg_names(method_did)[0],
3777+
self.infcx.tcx.fn_arg_idents(method_did)[0],
37783778
)
37793779
{
37803780
err.note(format!("borrow occurs due to deref coercion to `{deref_target_ty}`"));

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10261026
method_args,
10271027
*fn_span,
10281028
call_source.from_hir_call(),
1029-
self.infcx.tcx.fn_arg_names(method_did)[0],
1029+
self.infcx.tcx.fn_arg_idents(method_did)[0],
10301030
);
10311031

10321032
return FnSelfUse {

compiler/rustc_builtin_macros/src/proc_macro_harness.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ use crate::errors;
2020
struct ProcMacroDerive {
2121
id: NodeId,
2222
trait_name: Symbol,
23-
function_name: Ident,
23+
function_ident: Ident,
2424
span: Span,
2525
attrs: Vec<Symbol>,
2626
}
2727

2828
struct ProcMacroDef {
2929
id: NodeId,
30-
function_name: Ident,
30+
function_ident: Ident,
3131
span: Span,
3232
}
3333

@@ -95,7 +95,7 @@ impl<'a> CollectProcMacros<'a> {
9595
fn collect_custom_derive(
9696
&mut self,
9797
item: &'a ast::Item,
98-
function_name: Ident,
98+
function_ident: Ident,
9999
attr: &'a ast::Attribute,
100100
) {
101101
let Some((trait_name, proc_attrs)) =
@@ -109,7 +109,7 @@ impl<'a> CollectProcMacros<'a> {
109109
id: item.id,
110110
span: item.span,
111111
trait_name,
112-
function_name,
112+
function_ident,
113113
attrs: proc_attrs,
114114
}));
115115
} else {
@@ -123,12 +123,12 @@ impl<'a> CollectProcMacros<'a> {
123123
}
124124
}
125125

126-
fn collect_attr_proc_macro(&mut self, item: &'a ast::Item, function_name: Ident) {
126+
fn collect_attr_proc_macro(&mut self, item: &'a ast::Item, function_ident: Ident) {
127127
if self.in_root && item.vis.kind.is_pub() {
128128
self.macros.push(ProcMacro::Attr(ProcMacroDef {
129129
id: item.id,
130130
span: item.span,
131-
function_name,
131+
function_ident,
132132
}));
133133
} else {
134134
let msg = if !self.in_root {
@@ -141,12 +141,12 @@ impl<'a> CollectProcMacros<'a> {
141141
}
142142
}
143143

144-
fn collect_bang_proc_macro(&mut self, item: &'a ast::Item, function_name: Ident) {
144+
fn collect_bang_proc_macro(&mut self, item: &'a ast::Item, function_ident: Ident) {
145145
if self.in_root && item.vis.kind.is_pub() {
146146
self.macros.push(ProcMacro::Bang(ProcMacroDef {
147147
id: item.id,
148148
span: item.span,
149-
function_name,
149+
function_ident,
150150
}));
151151
} else {
152152
let msg = if !self.in_root {
@@ -303,7 +303,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
303303
ProcMacro::Derive(m) => m.span,
304304
ProcMacro::Attr(m) | ProcMacro::Bang(m) => m.span,
305305
};
306-
let local_path = |cx: &ExtCtxt<'_>, name| cx.expr_path(cx.path(span, vec![name]));
306+
let local_path = |cx: &ExtCtxt<'_>, ident| cx.expr_path(cx.path(span, vec![ident]));
307307
let proc_macro_ty_method_path = |cx: &ExtCtxt<'_>, method| {
308308
cx.expr_path(cx.path(
309309
span.with_ctxt(harness_span.ctxt()),
@@ -327,7 +327,7 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
327327
.map(|&s| cx.expr_str(span, s))
328328
.collect::<ThinVec<_>>(),
329329
),
330-
local_path(cx, cd.function_name),
330+
local_path(cx, cd.function_ident),
331331
],
332332
)
333333
}
@@ -345,8 +345,8 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
345345
harness_span,
346346
proc_macro_ty_method_path(cx, ident),
347347
thin_vec![
348-
cx.expr_str(span, ca.function_name.name),
349-
local_path(cx, ca.function_name),
348+
cx.expr_str(span, ca.function_ident.name),
349+
local_path(cx, ca.function_ident),
350350
],
351351
)
352352
}

compiler/rustc_codegen_cranelift/src/main_shim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub(crate) fn maybe_create_entry_wrapper(
104104
let termination_trait = tcx.require_lang_item(LangItem::Termination, None);
105105
let report = tcx
106106
.associated_items(termination_trait)
107-
.find_by_name_and_kind(
107+
.find_by_ident_and_kind(
108108
tcx,
109109
Ident::from_str("report"),
110110
AssocKind::Fn,

0 commit comments

Comments
 (0)