Skip to content

Rollup of 15 pull requests #142971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 102 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
4f24d14
Merge commit '979dcf8e2f213e4f4b645cb62e7fe9f4f2c0c785' into sync_cg_…
bjorn3 May 25, 2025
2357fb6
Merge branch 'sync_from_rust'
bjorn3 May 25, 2025
ea26272
clif: Provide better output messages for failed copies
tgross35 May 18, 2025
99e783d
atomic_load intrinsic: use const generic parameter for ordering
RalfJung May 24, 2025
26242be
Sync from rust 70b3f4666e24ce22fc32f5e357dbcf85d3254e63
bjorn3 May 31, 2025
bc74556
Rustup to rustc 1.89.0-nightly (70b3f4666 2025-05-30)
bjorn3 May 31, 2025
814ef9f
Rustup to rustc 1.89.0-nightly (5d707b07e 2025-06-02)
bjorn3 Jun 3, 2025
ad43500
Only borrow EncodedMetadata in codegen_crate
bjorn3 May 30, 2025
2974c99
Move metadata object generation for dylibs to the linker code
bjorn3 May 30, 2025
b97136c
Add impl for `llvm.roundeven` in cg_clif
sayantn Jun 3, 2025
12be26f
cg_clif: convert to CanonAbi
workingjubilee May 21, 2025
decbfcd
Auto merge of #141229 - tgross35:builtins-josh-subtree, r=Kobzol
bors Jun 3, 2025
582ad1f
Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3
matthiaskrgr Jun 3, 2025
112e5e8
Auto merge of #141984 - matthiaskrgr:rollup-wy6j9ca, r=matthiaskrgr
bors Jun 3, 2025
57d0559
Change `tag_field` to `FieldIdx` in `Variants::Multiple`
scottmcm Jun 4, 2025
8f889f8
Sync from rust 4b27a04cc8ed4da10a546a871e23e665d03f7a79
bjorn3 Jun 5, 2025
bcac194
Rustup to rustc 1.89.0-nightly (4b27a04cc 2025-06-04)
bjorn3 Jun 5, 2025
59549af
Replace some `Option<Span>` with `Span` and use DUMMY_SP instead of None
oli-obk Jun 4, 2025
2192d86
Update `InterpCx::project_field` to take `FieldIdx`
scottmcm Jun 4, 2025
3630039
Rollup merge of #142103 - scottmcm:fieldidx-in-interp, r=oli-obk
GuillaumeGomez Jun 6, 2025
83be7a8
Auto merge of #141964 - sayantn:update-stdarch, r=Amanieu
bors Jun 7, 2025
46e0b21
Sync from rust 44f415c1d617ebc7b931a243b7b321ef8a6ca47c
bjorn3 Jun 7, 2025
4e3bf2d
Rustup to rustc 1.89.0-nightly (44f415c1d 2025-06-06)
bjorn3 Jun 7, 2025
18b1221
intrinsics: use const generic to set atomic ordering
RalfJung May 28, 2025
d004022
Sync from rust cdd545be1b4f024d38360aa9f000dcb782fbc81b
bjorn3 Jun 8, 2025
7988b8c
Rustup to rustc 1.89.0-nightly (cdd545be1 2025-06-07)
bjorn3 Jun 8, 2025
d5e9833
Remove rustc's notion of "preferred" alignment AKA `__alignof`
workingjubilee Feb 12, 2025
30c48bc
Use Operand::constant() in a couple of places
bjorn3 Jun 10, 2025
2457bb2
Apply ABI attributes on return types in `rustc_codegen_cranelift`
beetrees Jun 11, 2025
a9fd42e
intrinsics: rename min_align_of to align_of
RalfJung Jun 12, 2025
047a106
Sync from rust e703dff8fe220b78195c53478e83fb2f68d8499c
bjorn3 Jun 12, 2025
9594d67
Rustup to rustc 1.89.0-nightly (e703dff8f 2025-06-11)
bjorn3 Jun 12, 2025
dcc4874
add `extern "custom"` functions
folkertdev May 7, 2025
a6ecde3
Unimplement unsized_locals
mejrs Jun 12, 2025
595e88a
Windows: make read_dir stop iterating on error
ChrisDenton Jun 13, 2025
393e46e
Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgr
bors Jun 13, 2025
8b24077
Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errors
matthiaskrgr Jun 14, 2025
2f2a0b9
Sync from rust 8da623945f83933dd38644d5745532ee032e855b
bjorn3 Jun 14, 2025
600a8a7
Rustup to rustc 1.89.0-nightly (8da623945 2025-06-13)
bjorn3 Jun 14, 2025
3e59f14
Update to abi-cafe 1.0
bjorn3 Jun 15, 2025
8a39619
Use the new abi-cafe-rules.toml support
bjorn3 Jun 15, 2025
aafdccf
Merge pull request #1582 from rust-lang/update_abi_cafe
bjorn3 Jun 15, 2025
9795908
Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=wo…
fmease Jun 15, 2025
262e821
Rollup merge of #142389 - beetrees:cranelift-arg-ext, r=bjorn3
fmease Jun 15, 2025
ab385a9
Sync from rust 586ad391f5ee4519acc7cae340e34673bae762b1
bjorn3 Jun 16, 2025
1ade48f
Rustup to rustc 1.89.0-nightly (586ad391f 2025-06-15)
bjorn3 Jun 16, 2025
b7cfe2f
Use the new --debug flag of abi-cafe
bjorn3 Jun 16, 2025
e391603
Fix RISC-V C function ABI when passing/returning structs containing f…
beetrees Apr 3, 2025
db5a427
Change __rust_no_alloc_shim_is_unstable to be a function
dpaoliello May 15, 2025
cfa4c8f
cranelift/gcc: `{Meta,Pointee,}Sized` in minicore
davidtwco Mar 5, 2025
7ed06e5
Sync from rust 45acf54eea118ed27927282b5e0bfdcd80b7987c
bjorn3 Jun 17, 2025
da831be
Rustup to rustc 1.89.0-nightly (45acf54ee 2025-06-16)
bjorn3 Jun 17, 2025
1ba842d
Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
bors Jun 17, 2025
42bb66a
Also emit suggestions for usages in the `non_upper_case_globals` lint
Urgau Jun 17, 2025
ca578bf
Auto merge of #141061 - dpaoliello:shimasfn, r=bjorn3
bors Jun 18, 2025
4df9f2f
Emit the usages suggestions as tool-only suggestions
Urgau Jun 18, 2025
856ffb6
Sync from rust c68340350c78eea402c4a85f8d9c1b7d3d607635
bjorn3 Jun 19, 2025
8dea73a
Rustup to rustc 1.89.0-nightly (c68340350 2025-06-18)
bjorn3 Jun 19, 2025
09d0a73
Switch `non_upper_case_globals` suggestions to being machine-applicable
Urgau Jun 20, 2025
a56bf51
Make some `use _` tests multi-edition
estebank Jun 20, 2025
8b88265
Lazily collect `NonUpperCaseGlobalSubTool` diagnostics
Urgau Jun 21, 2025
1b5ec3f
Add `emit_span_lint_lazy` to lazily create `LintDiagnostic` structs
Urgau Jun 21, 2025
d40bee8
Use the .drectve section for exporting symbols from dlls on Windows
bjorn3 Jun 16, 2025
3719abb
Update to Cranelift 0.121
bjorn3 Jun 7, 2025
e388261
cranelift: fix target feature name type: "fxsr"
marxin Jun 22, 2025
6ffd0e6
Address review comments
Urgau Jun 21, 2025
a7baff8
Avoid panic when debug info is missing
kornelski Jun 22, 2025
d18a43c
Init local_names lazily for borrowck diagnostics
kornelski Jun 22, 2025
fc8631b
Sync from rust be19eda0dc4c22c5cf5f1b48fd163acf9bd4b0a6
bjorn3 Jun 23, 2025
9f5fc01
Rustup to rustc 1.89.0-nightly (be19eda0d 2025-06-22)
bjorn3 Jun 23, 2025
cb88811
Generate symbols.o for proc-macros too
bjorn3 Jun 17, 2025
ba5556d
Add `#[loop_match]` for improved DFA codegen
bjorn3 Feb 18, 2025
81a7cb6
Enable reproducible-build-2 for Windows
dpaoliello Jun 21, 2025
c3200c3
Tweak `-Zmacro-stats` measurement.
nnethercote Jun 23, 2025
be927ca
mbe: Unnest nested matches with let-else and let chains
tgross35 Jun 18, 2025
b9e9be3
mbe: Clean up code with non-optional `NonterminalKind`
tgross35 Jun 18, 2025
cd5de49
mbe: Use `TokenTree` as the fallback for invalid fragment specifiers
tgross35 Jun 24, 2025
77232fb
Fix normalization in linker-warning
bjorn3 Jun 24, 2025
fcb718b
Fix function signature for rust_eh_personality
bjorn3 Jun 24, 2025
659da58
Fix a bunch of missing unwinder related definitions
bjorn3 Jun 24, 2025
8c848e0
Rustup to rustc 1.90.0-nightly (706f244db 2025-06-23)
bjorn3 Jun 24, 2025
16c041d
Merge commit '8c848e0604b5d26fad120914f822f564fe05c52a' into sync_cg_…
bjorn3 Jun 24, 2025
dbe8682
Update tidy exceptions
bjorn3 Jun 24, 2025
0be37ca
rustc_session: Add a structure for keeping both explicit and default …
petrochenkov Jun 20, 2025
2973939
Add impl_trait_in_bindings tests
mominul Jun 24, 2025
d939582
Ignore c-link-to-rust-va-list-fn test on SGX platform
raoulstrackx Jun 24, 2025
d82fb1e
Emit a single error when importing a path with `_`
estebank Jun 20, 2025
6fdfd88
Rollup merge of #138780 - trifectatechfoundation:loop_match_attr, r=o…
workingjubilee Jun 24, 2025
77b0042
Rollup merge of #142453 - ChrisDenton:fused, r=Amanieu
workingjubilee Jun 24, 2025
f91746d
Rollup merge of #142568 - bjorn3:windows_symbols_o_export, r=wesleywiser
workingjubilee Jun 24, 2025
d964120
Rollup merge of #142641 - bjorn3:proc_macro_symbols_o, r=jieyouxu
workingjubilee Jun 24, 2025
fa5534f
Rollup merge of #142645 - Urgau:usage-non_upper_case_globals, r=fmease
workingjubilee Jun 24, 2025
97eb514
Rollup merge of #142657 - tgross35:nonoptional-fragment-specifiers-cl…
workingjubilee Jun 24, 2025
3cccca3
Rollup merge of #142799 - petrochenkov:expnop, r=bjorn3
workingjubilee Jun 24, 2025
e752d09
Rollup merge of #142805 - estebank:underscore-import, r=compiler-errors
workingjubilee Jun 24, 2025
cce6177
Rollup merge of #142843 - dpaoliello:reproducible-build-2, r=jieyouxu
workingjubilee Jun 24, 2025
d472c96
Rollup merge of #142882 - kornelski:var-debug-info-lazy, r=petrochenkov
workingjubilee Jun 24, 2025
edee525
Rollup merge of #142883 - mominul:impl_in_bindings, r=lcnr
workingjubilee Jun 24, 2025
d91e580
Rollup merge of #142934 - nnethercote:tweak-macro-stats, r=petrochenkov
workingjubilee Jun 24, 2025
df1b85f
Rollup merge of #142955 - bjorn3:cg_clif_test_fixes, r=jieyouxu
workingjubilee Jun 24, 2025
638ebf7
Rollup merge of #142959 - bjorn3:sync_cg_clif-2025-06-24, r=bjorn3
workingjubilee Jun 24, 2025
2c86c70
Rollup merge of #142965 - raoulstrackx:raoul/rte-497-fix_c-link-to-ru…
workingjubilee Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3655,7 +3655,6 @@ dependencies = [
"rustc_macros",
"rustc_serialize",
"rustc_span",
"smallvec",
"tracing",
"unic-langid",
]
Expand Down Expand Up @@ -4117,6 +4116,7 @@ dependencies = [
"rustc_apfloat",
"rustc_arena",
"rustc_ast",
"rustc_attr_data_structures",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
Expand Down Expand Up @@ -4446,7 +4446,6 @@ dependencies = [
"rustc_serialize",
"rustc_span",
"rustc_target",
"smallvec",
"termize",
"tracing",
"windows",
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ pub enum NtExprKind {
Expr2021 { inferred: bool },
}

/// A macro nonterminal, known in documentation as a fragment specifier.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
pub enum NonterminalKind {
Item,
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_attr_data_structures/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ pub enum AttributeKind {
first_span: Span,
},

/// Represents `#[const_continue]`.
ConstContinue(Span),

/// Represents `#[rustc_const_stable]` and `#[rustc_const_unstable]`.
ConstStability {
stability: PartialConstStability,
Expand All @@ -231,6 +234,9 @@ pub enum AttributeKind {
/// Represents `#[inline]` and `#[rustc_force_inline]`.
Inline(InlineAttr, Span),

/// Represents `#[loop_match]`.
LoopMatch(Span),

/// Represents `#[rustc_macro_transparency]`.
MacroTransparency(Transparency),

Expand Down
31 changes: 31 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/loop_match.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use rustc_attr_data_structures::AttributeKind;
use rustc_feature::{AttributeTemplate, template};
use rustc_span::{Symbol, sym};

use crate::attributes::{AttributeOrder, OnDuplicate, SingleAttributeParser};
use crate::context::{AcceptContext, Stage};
use crate::parser::ArgParser;

pub(crate) struct LoopMatchParser;
impl<S: Stage> SingleAttributeParser<S> for LoopMatchParser {
const PATH: &[Symbol] = &[sym::loop_match];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const TEMPLATE: AttributeTemplate = template!(Word);

fn convert(cx: &mut AcceptContext<'_, '_, S>, _args: &ArgParser<'_>) -> Option<AttributeKind> {
Some(AttributeKind::LoopMatch(cx.attr_span))
}
}

pub(crate) struct ConstContinueParser;
impl<S: Stage> SingleAttributeParser<S> for ConstContinueParser {
const PATH: &[Symbol] = &[sym::const_continue];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn;
const TEMPLATE: AttributeTemplate = template!(Word);

fn convert(cx: &mut AcceptContext<'_, '_, S>, _args: &ArgParser<'_>) -> Option<AttributeKind> {
Some(AttributeKind::ConstContinue(cx.attr_span))
}
}
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub(crate) mod confusables;
pub(crate) mod deprecation;
pub(crate) mod inline;
pub(crate) mod lint_helpers;
pub(crate) mod loop_match;
pub(crate) mod must_use;
pub(crate) mod repr;
pub(crate) mod semantics;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::attributes::confusables::ConfusablesParser;
use crate::attributes::deprecation::DeprecationParser;
use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
use crate::attributes::lint_helpers::{AsPtrParser, PubTransparentParser};
use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
use crate::attributes::must_use::MustUseParser;
use crate::attributes::repr::{AlignParser, ReprParser};
use crate::attributes::semantics::MayDangleParser;
Expand Down Expand Up @@ -111,9 +112,11 @@ attribute_parsers!(
// tidy-alphabetical-start
Single<AsPtrParser>,
Single<ColdParser>,
Single<ConstContinueParser>,
Single<ConstStabilityIndirectParser>,
Single<DeprecationParser>,
Single<InlineParser>,
Single<LoopMatchParser>,
Single<MayDangleParser>,
Single<MustUseParser>,
Single<NoMangleParser>,
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ impl<'tcx> BorrowExplanation<'tcx> {
) {
let tcx = cx.infcx.tcx;
let body = cx.body;
let local_names = &cx.local_names;

if let Some(span) = borrow_span {
let def_id = body.source.def_id();
Expand Down Expand Up @@ -220,7 +219,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
_ => ("destructor", format!("type `{}`", local_decl.ty)),
};

match local_names[dropped_local] {
match cx.local_name(dropped_local) {
Some(local_name) if !local_decl.from_compiler_desugaring() => {
let message = format!(
"{borrow_desc}borrow might be used here, when `{local_name}` is dropped \
Expand Down Expand Up @@ -670,10 +669,10 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {

Some(Cause::DropVar(local, location)) => {
let mut should_note_order = false;
if self.local_names[local].is_some()
if self.local_name(local).is_some()
&& let Some((WriteKind::StorageDeadOrDrop, place)) = kind_place
&& let Some(borrowed_local) = place.as_local()
&& self.local_names[borrowed_local].is_some()
&& self.local_name(borrowed_local).is_some()
&& local != borrowed_local
{
should_note_order = true;
Expand Down Expand Up @@ -748,7 +747,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
Operand::Copy(place) | Operand::Move(place) => {
if let Some(l) = place.as_local() {
let local_decl = &self.body.local_decls[l];
if self.local_names[l].is_none() {
if self.local_name(l).is_none() {
local_decl.source_info.span
} else {
span
Expand Down Expand Up @@ -793,7 +792,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
Operand::Copy(place) | Operand::Move(place) => {
if let Some(l) = place.as_local() {
let local_decl = &self.body.local_decls[l];
if self.local_names[l].is_none() {
if self.local_name(l).is_none() {
local_decl.source_info.span
} else {
span
Expand Down
43 changes: 39 additions & 4 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::{Applicability, Diag, EmissionGuarantee, MultiSpan, listify};
use rustc_hir::def::{CtorKind, Namespace};
use rustc_hir::{self as hir, CoroutineKind, LangItem};
use rustc_index::IndexSlice;
use rustc_index::{IndexSlice, IndexVec};
use rustc_infer::infer::{BoundRegionConversionTime, NllRegionVariableOrigin};
use rustc_infer::traits::SelectionError;
use rustc_middle::bug;
use rustc_middle::mir::{
AggregateKind, CallSource, ConstOperand, ConstraintCategory, FakeReadCause, Local, LocalInfo,
LocalKind, Location, Operand, Place, PlaceRef, PlaceTy, ProjectionElem, Rvalue, Statement,
StatementKind, Terminator, TerminatorKind, find_self_call,
StatementKind, Terminator, TerminatorKind, VarDebugInfoContents, find_self_call,
};
use rustc_middle::ty::print::Print;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::{bug, span_bug};
use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult, MoveOutIndex};
use rustc_span::def_id::LocalDefId;
use rustc_span::source_map::Spanned;
Expand Down Expand Up @@ -190,6 +190,36 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
) -> Option<&(PlaceRef<'tcx>, Diag<'infcx>)> {
self.diags_buffer.buffered_move_errors.get(move_out_indices)
}

/// Uses `body.var_debug_info` to find the symbol
fn local_name(&self, index: Local) -> Option<Symbol> {
*self.local_names().get(index)?
}

fn local_names(&self) -> &IndexSlice<Local, Option<Symbol>> {
self.local_names.get_or_init(|| {
let mut local_names = IndexVec::from_elem(None, &self.body.local_decls);
for var_debug_info in &self.body.var_debug_info {
if let VarDebugInfoContents::Place(place) = var_debug_info.value {
if let Some(local) = place.as_local() {
if let Some(prev_name) = local_names[local]
&& var_debug_info.name != prev_name
{
span_bug!(
var_debug_info.source_info.span,
"local {:?} has many names (`{}` vs `{}`)",
local,
prev_name,
var_debug_info.name
);
}
local_names[local] = Some(var_debug_info.name);
}
}
}
local_names
})
}
}

impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
Expand Down Expand Up @@ -430,7 +460,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
/// a name, or its name was generated by the compiler, then `Err` is returned
fn append_local_to_string(&self, local: Local, buf: &mut String) -> Result<(), ()> {
let decl = &self.body.local_decls[local];
match self.local_names[local] {
match self.local_name(local) {
Some(name) if !decl.from_compiler_desugaring() => {
buf.push_str(name.as_str());
Ok(())
Expand Down Expand Up @@ -1500,4 +1530,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}
}
}

/// Skip over locals that begin with an underscore or have no name
pub(crate) fn local_excluded_from_unused_mut_lint(&self, index: Local) -> bool {
self.local_name(index).is_none_or(|name| name.as_str().starts_with('_'))
}
}
10 changes: 7 additions & 3 deletions compiler/rustc_borrowck/src/diagnostics/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {

if let PlaceRef { local, projection: [] } = deref_base {
let decl = &self.body.local_decls[local];
let local_name = self.local_name(local).map(|sym| format!("`{sym}`"));
if decl.is_ref_for_guard() {
return self
.cannot_move_out_of(
span,
&format!("`{}` in pattern guard", self.local_names[local].unwrap()),
&format!(
"{} in pattern guard",
local_name.as_deref().unwrap_or("the place")
),
)
.with_note(
"variables bound in patterns cannot be moved from \
Expand Down Expand Up @@ -825,7 +829,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
}

if binds_to.len() == 1 {
let place_desc = &format!("`{}`", self.local_names[*local].unwrap());
let place_desc = self.local_name(*local).map(|sym| format!("`{sym}`"));

if let Some(expr) = self.find_expr(binding_span) {
self.suggest_cloning(err, bind_to.ty, expr, None);
Expand All @@ -834,7 +838,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label {
is_partial_move: false,
ty: bind_to.ty,
place: place_desc,
place: place_desc.as_deref().unwrap_or("the place"),
span: binding_span,
});
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
if access_place.as_local().is_some() {
reason = ", as it is not declared as mutable".to_string();
} else {
let name = self.local_names[local].expect("immutable unnamed local");
let name = self.local_name(local).expect("immutable unnamed local");
reason = format!(", as `{name}` is not declared as mutable");
}
}
Expand Down Expand Up @@ -285,7 +285,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
.body
.local_decls
.get(local)
.is_some_and(|l| mut_borrow_of_mutable_ref(l, self.local_names[local])) =>
.is_some_and(|l| mut_borrow_of_mutable_ref(l, self.local_name(local))) =>
{
let decl = &self.body.local_decls[local];
err.span_label(span, format!("cannot {act}"));
Expand Down Expand Up @@ -481,7 +481,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let (pointer_sigil, pointer_desc) =
if local_decl.ty.is_ref() { ("&", "reference") } else { ("*const", "pointer") };

match self.local_names[local] {
match self.local_name(local) {
Some(name) if !local_decl.from_compiler_desugaring() => {
err.span_label(
span,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,14 +664,14 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let fr_name_and_span = self.regioncx.get_var_name_and_span_for_region(
self.infcx.tcx,
self.body,
&self.local_names,
&self.local_names(),
&self.upvars,
errci.fr,
);
let outlived_fr_name_and_span = self.regioncx.get_var_name_and_span_for_region(
self.infcx.tcx,
self.body,
&self.local_names,
&self.local_names(),
&self.upvars,
errci.outlived_fr,
);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/region_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
[implicit_inputs + argument_index];
let (_, span) = self.regioncx.get_argument_name_and_span_for_region(
self.body,
&self.local_names,
self.local_names(),
argument_index,
);

Expand Down Expand Up @@ -973,7 +973,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
{
let (arg_name, arg_span) = self.regioncx.get_argument_name_and_span_for_region(
self.body,
&self.local_names,
self.local_names(),
arg_index,
);
let region_name = self.synthesize_region_name();
Expand Down
Loading
Loading