Skip to content

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

Diff for: Cargo.lock

+1
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",

Diff for: compiler/rustc_ast/src/expand/mod.rs

+2-2
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
}

Diff for: compiler/rustc_ast_lowering/src/delegation.rs

+8-7
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
}

Diff for: compiler/rustc_ast_lowering/src/item.rs

+3-3
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
}

Diff for: compiler/rustc_ast_lowering/src/lib.rs

+2-2
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)),

Diff for: compiler/rustc_ast_pretty/src/pprust/tests.rs

+2-2
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
})

Diff for: compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+5-5
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}`"));

Diff for: compiler/rustc_borrowck/src/diagnostics/mod.rs

+1-1
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 {

Diff for: compiler/rustc_builtin_macros/src/proc_macro_harness.rs

+12-12
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
}

Diff for: compiler/rustc_codegen_cranelift/src/main_shim.rs

+1-1
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,

Diff for: compiler/rustc_data_structures/src/sync/freeze.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl<T> FreezeLock<T> {
8888
#[inline]
8989
#[track_caller]
9090
pub fn write(&self) -> FreezeWriteGuard<'_, T> {
91-
self.try_write().expect("still mutable")
91+
self.try_write().expect("data should not be frozen if we're still attempting to mutate it")
9292
}
9393

9494
#[inline]

Diff for: compiler/rustc_driver_impl/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
348348
// Make sure name resolution and macro expansion is run.
349349
let _ = tcx.resolver_for_lowering();
350350

351-
if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
352-
dump_feature_usage_metrics(tcx, metrics_dir);
353-
}
354-
355351
if callbacks.after_expansion(compiler, tcx) == Compilation::Stop {
356352
return early_exit();
357353
}
@@ -370,6 +366,10 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
370366

371367
tcx.ensure_ok().analysis(());
372368

369+
if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
370+
dump_feature_usage_metrics(tcx, metrics_dir);
371+
}
372+
373373
if callbacks.after_analysis(compiler, tcx) == Compilation::Stop {
374374
return early_exit();
375375
}

Diff for: compiler/rustc_expand/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ pub trait ResolverExpand {
11021102
/// HIR proc macros items back to their harness items.
11031103
fn declare_proc_macro(&mut self, id: NodeId);
11041104

1105-
fn append_stripped_cfg_item(&mut self, parent_node: NodeId, name: Ident, cfg: ast::MetaItem);
1105+
fn append_stripped_cfg_item(&mut self, parent_node: NodeId, ident: Ident, cfg: ast::MetaItem);
11061106

11071107
/// Tools registered with `#![register_tool]` and used by tool attributes and lints.
11081108
fn registered_tools(&self) -> &RegisteredTools;

Diff for: compiler/rustc_expand/src/expand.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1169,9 +1169,9 @@ trait InvocationCollectorNode: HasAttrs + HasNodeId + Sized {
11691169
collector.cx.dcx().emit_err(RemoveNodeNotSupported { span, descr: Self::descr() });
11701170
}
11711171

1172-
/// All of the names (items) declared by this node.
1172+
/// All of the identifiers (items) declared by this node.
11731173
/// This is an approximation and should only be used for diagnostics.
1174-
fn declared_names(&self) -> Vec<Ident> {
1174+
fn declared_idents(&self) -> Vec<Ident> {
11751175
vec![]
11761176
}
11771177
}
@@ -1306,7 +1306,7 @@ impl InvocationCollectorNode for P<ast::Item> {
13061306
res
13071307
}
13081308

1309-
fn declared_names(&self) -> Vec<Ident> {
1309+
fn declared_idents(&self) -> Vec<Ident> {
13101310
if let ItemKind::Use(ut) = &self.kind {
13111311
fn collect_use_tree_leaves(ut: &ast::UseTree, idents: &mut Vec<Ident>) {
13121312
match &ut.kind {
@@ -2061,10 +2061,10 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
20612061
}
20622062

20632063
if let Some(meta_item) = meta_item {
2064-
for name in node.declared_names() {
2064+
for ident in node.declared_idents() {
20652065
self.cx.resolver.append_stripped_cfg_item(
20662066
self.cx.current_expansion.lint_node_id,
2067-
name,
2067+
ident,
20682068
meta_item.clone(),
20692069
)
20702070
}

Diff for: compiler/rustc_hir/src/hir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3399,9 +3399,9 @@ pub struct BareFnTy<'hir> {
33993399
pub abi: ExternAbi,
34003400
pub generic_params: &'hir [GenericParam<'hir>],
34013401
pub decl: &'hir FnDecl<'hir>,
3402-
// `Option` because bare fn parameter names are optional. We also end up
3402+
// `Option` because bare fn parameter identifiers are optional. We also end up
34033403
// with `None` in some error cases, e.g. invalid parameter patterns.
3404-
pub param_names: &'hir [Option<Ident>],
3404+
pub param_idents: &'hir [Option<Ident>],
34053405
}
34063406

34073407
#[derive(Debug, Clone, Copy, HashStable_Generic)]

Diff for: compiler/rustc_hir/src/intravisit.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -652,10 +652,10 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(
652652
try_visit!(visitor.visit_ident(foreign_item.ident));
653653

654654
match foreign_item.kind {
655-
ForeignItemKind::Fn(ref sig, param_names, ref generics) => {
655+
ForeignItemKind::Fn(ref sig, param_idents, ref generics) => {
656656
try_visit!(visitor.visit_generics(generics));
657657
try_visit!(visitor.visit_fn_decl(sig.decl));
658-
for ident in param_names.iter().copied() {
658+
for ident in param_idents.iter().copied() {
659659
visit_opt!(visitor, visit_ident, ident);
660660
}
661661
}
@@ -1169,9 +1169,9 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(
11691169
try_visit!(visitor.visit_ty_unambig(ty));
11701170
visit_opt!(visitor, visit_nested_body, default);
11711171
}
1172-
TraitItemKind::Fn(ref sig, TraitFn::Required(param_names)) => {
1172+
TraitItemKind::Fn(ref sig, TraitFn::Required(param_idents)) => {
11731173
try_visit!(visitor.visit_fn_decl(sig.decl));
1174-
for ident in param_names.iter().copied() {
1174+
for ident in param_idents.iter().copied() {
11751175
visit_opt!(visitor, visit_ident, ident);
11761176
}
11771177
}

0 commit comments

Comments
 (0)