Skip to content

Commit 352545f

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents c462002 + 1bc5618 commit 352545f

File tree

357 files changed

+3352
-1743
lines changed

Some content is hidden

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

357 files changed

+3352
-1743
lines changed

Diff for: .github/ISSUE_TEMPLATE/tracking_issue.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ for larger features an implementation could be broken up into multiple PRs.
4141
- [ ] Implement the RFC (cc @rust-lang/XXX -- can anyone write up mentoring
4242
instructions?)
4343
- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
44-
- [ ] Formatting for new syntax has been added to the [Style Guide] ([nightly-style-procedure])
44+
- [ ] Style updates for any new syntax ([nightly-style-procedure])
45+
- [ ] Style team decision on new formatting
46+
- [ ] Formatting for new syntax has been added to the [Style Guide]
47+
- [ ] (non-blocking) Formatting has been implemented in `rustfmt`
4548
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])
4649

4750
[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr

Diff for: Cargo.lock

+2-14
Original file line numberDiff line numberDiff line change
@@ -3217,17 +3217,6 @@ dependencies = [
32173217
"tikv-jemalloc-sys",
32183218
]
32193219

3220-
[[package]]
3221-
name = "rustc-rayon"
3222-
version = "0.5.1"
3223-
source = "registry+https://github.com/rust-lang/crates.io-index"
3224-
checksum = "2cd9fb077db982d7ceb42a90471e5a69a990b58f71e06f0d8340bb2cf35eb751"
3225-
dependencies = [
3226-
"either",
3227-
"indexmap",
3228-
"rustc-rayon-core",
3229-
]
3230-
32313220
[[package]]
32323221
name = "rustc-rayon-core"
32333222
version = "0.5.0"
@@ -3599,7 +3588,7 @@ dependencies = [
35993588
"parking_lot",
36003589
"portable-atomic",
36013590
"rustc-hash 2.1.1",
3602-
"rustc-rayon",
3591+
"rustc-rayon-core",
36033592
"rustc-stable-hash",
36043593
"rustc_arena",
36053594
"rustc_graphviz",
@@ -3945,7 +3934,6 @@ dependencies = [
39453934
name = "rustc_interface"
39463935
version = "0.0.0"
39473936
dependencies = [
3948-
"rustc-rayon",
39493937
"rustc-rayon-core",
39503938
"rustc_abi",
39513939
"rustc_ast",
@@ -4409,7 +4397,6 @@ dependencies = [
44094397
"rustc_feature",
44104398
"rustc_fluent_macro",
44114399
"rustc_hir",
4412-
"rustc_index",
44134400
"rustc_macros",
44144401
"rustc_metadata",
44154402
"rustc_middle",
@@ -4456,6 +4443,7 @@ dependencies = [
44564443
"bitflags",
44574444
"getopts",
44584445
"libc",
4446+
"rand 0.9.0",
44594447
"rustc_abi",
44604448
"rustc_ast",
44614449
"rustc_data_structures",

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

+5-3
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)),
@@ -2034,7 +2034,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20342034
}
20352035

20362036
fn lower_array_length_to_const_arg(&mut self, c: &AnonConst) -> &'hir hir::ConstArg<'hir> {
2037-
match c.value.kind {
2037+
// We cannot just match on `ExprKind::Underscore` as `(_)` is represented as
2038+
// `ExprKind::Paren(ExprKind::Underscore)` and should also be lowered to `GenericArg::Infer`
2039+
match c.value.peel_parens().kind {
20382040
ExprKind::Underscore => {
20392041
if !self.tcx.features().generic_arg_infer() {
20402042
feature_err(

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/autodiff.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ mod llvm_enzyme {
234234
let meta_item_vec: ThinVec<MetaItemInner> = match meta_item.kind {
235235
ast::MetaItemKind::List(ref vec) => vec.clone(),
236236
_ => {
237-
dcx.emit_err(errors::AutoDiffInvalidApplication { span: item.span() });
237+
dcx.emit_err(errors::AutoDiffMissingConfig { span: item.span() });
238238
return vec![item];
239239
}
240240
};

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
}

0 commit comments

Comments
 (0)