Skip to content

Commit 79d4cc9

Browse files
committed
Auto merge of rust-lang#3876 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 0225309 + 6e70bd4 commit 79d4cc9

File tree

778 files changed

+8913
-5609
lines changed

Some content is hidden

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

778 files changed

+8913
-5609
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
path = src/tools/rustc-perf
4848
url = https://github.com/rust-lang/rustc-perf.git
4949
shallow = true
50+
[submodule "src/tools/enzyme"]
51+
path = src/tools/enzyme
52+
url = https://github.com/EnzymeAD/Enzyme.git
53+
shallow = true

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,6 +4167,7 @@ dependencies = [
41674167
"rustc_errors",
41684168
"rustc_feature",
41694169
"rustc_fluent_macro",
4170+
"rustc_index",
41704171
"rustc_lexer",
41714172
"rustc_macros",
41724173
"rustc_session",

RELEASES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ Compiler
3434
- [Add Tier 3 `std` Xtensa targets:](https://github.com/rust-lang/rust/pull/126380/) `xtensa-esp32-espidf`, `xtensa-esp32s2-espidf`, `xtensa-esp32s3-espidf`
3535
- [Add Tier 3 i686 Redox OS target:](https://github.com/rust-lang/rust/pull/126192/) `i686-unknown-redox`
3636
- [Promote `arm64ec-pc-windows-msvc` to Tier 2.](https://github.com/rust-lang/rust/pull/126039/)
37-
- [Promote `wasm32-wasip2` to Tier 2.](https://github.com/rust-lang/rust/pull/126967/)
3837
- [Promote `loongarch64-unknown-linux-musl` to Tier 2 with host tools.](https://github.com/rust-lang/rust/pull/126298/)
3938
- [Enable full tools and profiler for LoongArch Linux targets.](https://github.com/rust-lang/rust/pull/127078/)
4039
- [Unconditionally warn on usage of `wasm32-wasi`.](https://github.com/rust-lang/rust/pull/126662/) (see compatibility note below)
@@ -100,6 +99,9 @@ Compatibility Notes
10099
The reason is that these types have different roles: `std::panic::PanicHookInfo` is the argument to the [panic hook](https://doc.rust-lang.org/stable/std/panic/fn.set_hook.html) in std context (where panics can have an arbitrary payload), while `core::panic::PanicInfo` is the argument to the [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) in no_std context (where panics always carry a formatted *message*). Separating these types allows us to add more useful methods to these types, such as `std::panic::PanicHookInfo::payload_as_str()` and `core::panic::PanicInfo::message()`.
101100

102101
* The new sort implementations may panic if a type's implementation of [`Ord`](https://doc.rust-lang.org/std/cmp/trait.Ord.html) (or the given comparison function) does not implement a [total order](https://en.wikipedia.org/wiki/Total_order) as the trait requires. `Ord`'s supertraits (`PartialOrd`, `Eq`, and `PartialEq`) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.
102+
* [In very rare cases, a change in the internal evaluation order of the trait
103+
solver may result in new fatal overflow errors.](https://github.com/rust-lang/rust/pull/126128)
104+
103105

104106
<a id="1.81.0-Internal-Changes"></a>
105107

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ fn visit_lazy_tts<T: MutVisitor>(vis: &mut T, lazy_tts: &mut Option<LazyAttrToke
752752
pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
753753
let Token { kind, span } = t;
754754
match kind {
755-
token::Ident(name, _ /*raw*/) | token::Lifetime(name) => {
755+
token::Ident(name, _is_raw) | token::Lifetime(name, _is_raw) => {
756756
let mut ident = Ident::new(*name, *span);
757757
vis.visit_ident(&mut ident);
758758
*name = ident.name;
@@ -762,7 +762,7 @@ pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
762762
token::NtIdent(ident, _is_raw) => {
763763
vis.visit_ident(ident);
764764
}
765-
token::NtLifetime(ident) => {
765+
token::NtLifetime(ident, _is_raw) => {
766766
vis.visit_ident(ident);
767767
}
768768
token::Interpolated(nt) => {

compiler/rustc_ast/src/token.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ pub enum TokenKind {
331331
/// Do not forget about `NtLifetime` when you want to match on lifetime identifiers.
332332
/// It's recommended to use `Token::(lifetime,uninterpolate,uninterpolated_span)` to
333333
/// treat regular and interpolated lifetime identifiers in the same way.
334-
Lifetime(Symbol),
334+
Lifetime(Symbol, IdentIsRaw),
335335
/// This identifier (and its span) is the lifetime passed to the
336336
/// declarative macro. The span in the surrounding `Token` is the span of
337337
/// the `lifetime` metavariable in the macro's RHS.
338-
NtLifetime(Ident),
338+
NtLifetime(Ident, IdentIsRaw),
339339

340340
/// An embedded AST node, as produced by a macro. This only exists for
341341
/// historical reasons. We'd like to get rid of it, for multiple reasons.
@@ -458,7 +458,7 @@ impl Token {
458458
/// if they keep spans or perform edition checks.
459459
pub fn uninterpolated_span(&self) -> Span {
460460
match self.kind {
461-
NtIdent(ident, _) | NtLifetime(ident) => ident.span,
461+
NtIdent(ident, _) | NtLifetime(ident, _) => ident.span,
462462
Interpolated(ref nt) => nt.use_span(),
463463
_ => self.span,
464464
}
@@ -661,7 +661,9 @@ impl Token {
661661
pub fn uninterpolate(&self) -> Cow<'_, Token> {
662662
match self.kind {
663663
NtIdent(ident, is_raw) => Cow::Owned(Token::new(Ident(ident.name, is_raw), ident.span)),
664-
NtLifetime(ident) => Cow::Owned(Token::new(Lifetime(ident.name), ident.span)),
664+
NtLifetime(ident, is_raw) => {
665+
Cow::Owned(Token::new(Lifetime(ident.name, is_raw), ident.span))
666+
}
665667
_ => Cow::Borrowed(self),
666668
}
667669
}
@@ -679,11 +681,11 @@ impl Token {
679681

680682
/// Returns a lifetime identifier if this token is a lifetime.
681683
#[inline]
682-
pub fn lifetime(&self) -> Option<Ident> {
684+
pub fn lifetime(&self) -> Option<(Ident, IdentIsRaw)> {
683685
// We avoid using `Token::uninterpolate` here because it's slow.
684686
match self.kind {
685-
Lifetime(name) => Some(Ident::new(name, self.span)),
686-
NtLifetime(ident) => Some(ident),
687+
Lifetime(name, is_raw) => Some((Ident::new(name, self.span), is_raw)),
688+
NtLifetime(ident, is_raw) => Some((ident, is_raw)),
687689
_ => None,
688690
}
689691
}
@@ -865,7 +867,7 @@ impl Token {
865867
_ => return None,
866868
},
867869
SingleQuote => match joint.kind {
868-
Ident(name, IdentIsRaw::No) => Lifetime(Symbol::intern(&format!("'{name}"))),
870+
Ident(name, is_raw) => Lifetime(Symbol::intern(&format!("'{name}")), is_raw),
869871
_ => return None,
870872
},
871873

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ impl TokenStream {
482482
token::NtIdent(ident, is_raw) => {
483483
TokenTree::Token(Token::new(token::Ident(ident.name, is_raw), ident.span), spacing)
484484
}
485-
token::NtLifetime(ident) => TokenTree::Delimited(
485+
token::NtLifetime(ident, is_raw) => TokenTree::Delimited(
486486
DelimSpan::from_single(token.span),
487487
DelimSpacing::new(Spacing::JointHidden, spacing),
488488
Delimiter::Invisible,
489-
TokenStream::token_alone(token::Lifetime(ident.name), ident.span),
489+
TokenStream::token_alone(token::Lifetime(ident.name, is_raw), ident.span),
490490
),
491491
token::Interpolated(ref nt) => TokenTree::Delimited(
492492
DelimSpan::from_single(token.span),

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ use std::borrow::Cow;
1111
use ast::TraitBoundModifiers;
1212
use rustc_ast::attr::AttrIdGenerator;
1313
use rustc_ast::ptr::P;
14-
use rustc_ast::token::{self, BinOpToken, CommentKind, Delimiter, Nonterminal, Token, TokenKind};
14+
use rustc_ast::token::{
15+
self, BinOpToken, CommentKind, Delimiter, IdentIsRaw, Nonterminal, Token, TokenKind,
16+
};
1517
use rustc_ast::tokenstream::{Spacing, TokenStream, TokenTree};
1618
use rustc_ast::util::classify;
1719
use rustc_ast::util::comments::{Comment, CommentStyle};
@@ -947,8 +949,13 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
947949
token::NtIdent(ident, is_raw) => {
948950
IdentPrinter::for_ast_ident(ident, is_raw.into()).to_string().into()
949951
}
950-
token::Lifetime(name) => name.to_string().into(),
951-
token::NtLifetime(ident) => ident.name.to_string().into(),
952+
953+
token::Lifetime(name, IdentIsRaw::No)
954+
| token::NtLifetime(Ident { name, .. }, IdentIsRaw::No) => name.to_string().into(),
955+
token::Lifetime(name, IdentIsRaw::Yes)
956+
| token::NtLifetime(Ident { name, .. }, IdentIsRaw::Yes) => {
957+
format!("'r#{}", &name.as_str()[1..]).into()
958+
}
952959

953960
/* Other */
954961
token::DocComment(comment_kind, attr_style, data) => {

compiler/rustc_borrowck/src/borrowck_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_middle::span_bug;
88
use rustc_middle::ty::{self, Ty, TyCtxt};
99
use rustc_span::Span;
1010

11-
impl<'infcx, 'tcx> crate::MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
11+
impl<'infcx, 'tcx> crate::MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1212
pub(crate) fn dcx(&self) -> DiagCtxtHandle<'infcx> {
1313
self.infcx.dcx()
1414
}

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ use tracing::debug;
1515
use crate::{places_conflict, BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext};
1616

1717
/// The results of the dataflow analyses used by the borrow checker.
18-
pub(crate) struct BorrowckResults<'a, 'mir, 'tcx> {
19-
pub(crate) borrows: Results<'tcx, Borrows<'a, 'mir, 'tcx>>,
20-
pub(crate) uninits: Results<'tcx, MaybeUninitializedPlaces<'a, 'mir, 'tcx>>,
21-
pub(crate) ever_inits: Results<'tcx, EverInitializedPlaces<'a, 'mir, 'tcx>>,
18+
pub(crate) struct BorrowckResults<'a, 'tcx> {
19+
pub(crate) borrows: Results<'tcx, Borrows<'a, 'tcx>>,
20+
pub(crate) uninits: Results<'tcx, MaybeUninitializedPlaces<'a, 'tcx>>,
21+
pub(crate) ever_inits: Results<'tcx, EverInitializedPlaces<'a, 'tcx>>,
2222
}
2323

2424
/// The transient state of the dataflow analyses used by the borrow checker.
2525
#[derive(Debug)]
26-
pub(crate) struct BorrowckFlowState<'a, 'mir, 'tcx> {
27-
pub(crate) borrows: <Borrows<'a, 'mir, 'tcx> as AnalysisDomain<'tcx>>::Domain,
28-
pub(crate) uninits: <MaybeUninitializedPlaces<'a, 'mir, 'tcx> as AnalysisDomain<'tcx>>::Domain,
29-
pub(crate) ever_inits: <EverInitializedPlaces<'a, 'mir, 'tcx> as AnalysisDomain<'tcx>>::Domain,
26+
pub(crate) struct BorrowckFlowState<'a, 'tcx> {
27+
pub(crate) borrows: <Borrows<'a, 'tcx> as AnalysisDomain<'tcx>>::Domain,
28+
pub(crate) uninits: <MaybeUninitializedPlaces<'a, 'tcx> as AnalysisDomain<'tcx>>::Domain,
29+
pub(crate) ever_inits: <EverInitializedPlaces<'a, 'tcx> as AnalysisDomain<'tcx>>::Domain,
3030
}
3131

32-
impl<'a, 'mir, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'mir, 'tcx> {
32+
impl<'a, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'tcx> {
3333
// All three analyses are forward, but we have to use just one here.
34-
type Direction = <Borrows<'a, 'mir, 'tcx> as AnalysisDomain<'tcx>>::Direction;
35-
type FlowState = BorrowckFlowState<'a, 'mir, 'tcx>;
34+
type Direction = <Borrows<'a, 'tcx> as AnalysisDomain<'tcx>>::Direction;
35+
type FlowState = BorrowckFlowState<'a, 'tcx>;
3636

3737
fn new_flow_state(&self, body: &mir::Body<'tcx>) -> Self::FlowState {
3838
BorrowckFlowState {
@@ -106,10 +106,9 @@ rustc_index::newtype_index! {
106106
/// `BorrowIndex`, and maps each such index to a `BorrowData`
107107
/// describing the borrow. These indexes are used for representing the
108108
/// borrows in compact bitvectors.
109-
pub struct Borrows<'a, 'mir, 'tcx> {
109+
pub struct Borrows<'a, 'tcx> {
110110
tcx: TyCtxt<'tcx>,
111-
body: &'mir Body<'tcx>,
112-
111+
body: &'a Body<'tcx>,
113112
borrow_set: &'a BorrowSet<'tcx>,
114113
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
115114
}
@@ -389,10 +388,10 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
389388
}
390389
}
391390

392-
impl<'a, 'mir, 'tcx> Borrows<'a, 'mir, 'tcx> {
391+
impl<'a, 'tcx> Borrows<'a, 'tcx> {
393392
pub fn new(
394393
tcx: TyCtxt<'tcx>,
395-
body: &'mir Body<'tcx>,
394+
body: &'a Body<'tcx>,
396395
regioncx: &RegionInferenceContext<'tcx>,
397396
borrow_set: &'a BorrowSet<'tcx>,
398397
) -> Self {
@@ -494,7 +493,7 @@ impl<'a, 'mir, 'tcx> Borrows<'a, 'mir, 'tcx> {
494493
}
495494
}
496495

497-
impl<'tcx> rustc_mir_dataflow::AnalysisDomain<'tcx> for Borrows<'_, '_, 'tcx> {
496+
impl<'tcx> rustc_mir_dataflow::AnalysisDomain<'tcx> for Borrows<'_, 'tcx> {
498497
type Domain = BitSet<BorrowIndex>;
499498

500499
const NAME: &'static str = "borrows";
@@ -517,7 +516,7 @@ impl<'tcx> rustc_mir_dataflow::AnalysisDomain<'tcx> for Borrows<'_, '_, 'tcx> {
517516
/// region stops containing the CFG points reachable from the issuing location.
518517
/// - we also kill loans of conflicting places when overwriting a shared path: e.g. borrows of
519518
/// `a.b.c` when `a` is overwritten.
520-
impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, '_, 'tcx> {
519+
impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
521520
type Idx = BorrowIndex;
522521

523522
fn domain_size(&self, _: &mir::Body<'tcx>) -> usize {
@@ -617,8 +616,8 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, '_, 'tcx> {
617616
}
618617
}
619618

620-
impl DebugWithContext<Borrows<'_, '_, '_>> for BorrowIndex {
621-
fn fmt_with(&self, ctxt: &Borrows<'_, '_, '_>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
619+
impl DebugWithContext<Borrows<'_, '_>> for BorrowIndex {
620+
fn fmt_with(&self, ctxt: &Borrows<'_, '_>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
622621
write!(f, "{:?}", ctxt.location(*self))
623622
}
624623
}

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'tcx> UniverseInfo<'tcx> {
5252

5353
pub(crate) fn report_error(
5454
&self,
55-
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
55+
mbcx: &mut MirBorrowckCtxt<'_, '_, 'tcx>,
5656
placeholder: ty::PlaceholderRegion,
5757
error_element: RegionElement,
5858
cause: ObligationCause<'tcx>,
@@ -151,7 +151,7 @@ trait TypeOpInfo<'tcx> {
151151

152152
fn nice_error<'infcx>(
153153
&self,
154-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
154+
mbcx: &mut MirBorrowckCtxt<'_, 'infcx, 'tcx>,
155155
cause: ObligationCause<'tcx>,
156156
placeholder_region: ty::Region<'tcx>,
157157
error_region: Option<ty::Region<'tcx>>,
@@ -160,7 +160,7 @@ trait TypeOpInfo<'tcx> {
160160
#[instrument(level = "debug", skip(self, mbcx))]
161161
fn report_error(
162162
&self,
163-
mbcx: &mut MirBorrowckCtxt<'_, '_, '_, 'tcx>,
163+
mbcx: &mut MirBorrowckCtxt<'_, '_, 'tcx>,
164164
placeholder: ty::PlaceholderRegion,
165165
error_element: RegionElement,
166166
cause: ObligationCause<'tcx>,
@@ -233,7 +233,7 @@ impl<'tcx> TypeOpInfo<'tcx> for PredicateQuery<'tcx> {
233233

234234
fn nice_error<'infcx>(
235235
&self,
236-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
236+
mbcx: &mut MirBorrowckCtxt<'_, 'infcx, 'tcx>,
237237
cause: ObligationCause<'tcx>,
238238
placeholder_region: ty::Region<'tcx>,
239239
error_region: Option<ty::Region<'tcx>>,
@@ -277,7 +277,7 @@ where
277277

278278
fn nice_error<'infcx>(
279279
&self,
280-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
280+
mbcx: &mut MirBorrowckCtxt<'_, 'infcx, 'tcx>,
281281
cause: ObligationCause<'tcx>,
282282
placeholder_region: ty::Region<'tcx>,
283283
error_region: Option<ty::Region<'tcx>>,
@@ -324,7 +324,7 @@ impl<'tcx> TypeOpInfo<'tcx> for AscribeUserTypeQuery<'tcx> {
324324

325325
fn nice_error<'infcx>(
326326
&self,
327-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
327+
mbcx: &mut MirBorrowckCtxt<'_, 'infcx, 'tcx>,
328328
cause: ObligationCause<'tcx>,
329329
placeholder_region: ty::Region<'tcx>,
330330
error_region: Option<ty::Region<'tcx>>,
@@ -357,7 +357,7 @@ impl<'tcx> TypeOpInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tcx> {
357357

358358
fn nice_error<'infcx>(
359359
&self,
360-
mbcx: &mut MirBorrowckCtxt<'_, '_, 'infcx, 'tcx>,
360+
mbcx: &mut MirBorrowckCtxt<'_, 'infcx, 'tcx>,
361361
_cause: ObligationCause<'tcx>,
362362
placeholder_region: ty::Region<'tcx>,
363363
error_region: Option<ty::Region<'tcx>>,

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ enum StorageDeadOrDrop<'tcx> {
6969
Destructor(Ty<'tcx>),
7070
}
7171

72-
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
72+
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
7373
pub(crate) fn report_use_of_moved_or_uninitialized(
7474
&mut self,
7575
location: Location,
@@ -4358,11 +4358,7 @@ enum AnnotatedBorrowFnSignature<'tcx> {
43584358
impl<'tcx> AnnotatedBorrowFnSignature<'tcx> {
43594359
/// Annotate the provided diagnostic with information about borrow from the fn signature that
43604360
/// helps explain.
4361-
pub(crate) fn emit(
4362-
&self,
4363-
cx: &MirBorrowckCtxt<'_, '_, '_, 'tcx>,
4364-
diag: &mut Diag<'_>,
4365-
) -> String {
4361+
pub(crate) fn emit(&self, cx: &MirBorrowckCtxt<'_, '_, 'tcx>, diag: &mut Diag<'_>) -> String {
43664362
match self {
43674363
&AnnotatedBorrowFnSignature::Closure { argument_ty, argument_span } => {
43684364
diag.span_label(

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<'tcx> BorrowExplanation<'tcx> {
390390
}
391391
}
392392

393-
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
393+
impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
394394
fn free_region_constraint_info(
395395
&self,
396396
borrow_region: RegionVid,
@@ -662,9 +662,10 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
662662
// `&dyn Trait`
663663
ty::Ref(_, ty, _) if ty.is_trait() => true,
664664
// `Box<dyn Trait>`
665-
_ if ty.is_box() && ty.boxed_ty().is_trait() => {
665+
_ if ty.boxed_ty().is_some_and(Ty::is_trait) => {
666666
true
667667
}
668+
668669
// `dyn Trait`
669670
_ if ty.is_trait() => true,
670671
// Anything else.

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub(super) struct DescribePlaceOpt {
6868

6969
pub(super) struct IncludingTupleField(pub(super) bool);
7070

71-
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
71+
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
7272
/// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure
7373
/// is moved after being invoked.
7474
///
@@ -345,9 +345,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
345345
variant_index: Option<VariantIdx>,
346346
including_tuple_field: IncludingTupleField,
347347
) -> Option<String> {
348-
if ty.is_box() {
348+
if let Some(boxed_ty) = ty.boxed_ty() {
349349
// If the type is a box, the field is described from the boxed type
350-
self.describe_field_from_ty(ty.boxed_ty(), field, variant_index, including_tuple_field)
350+
self.describe_field_from_ty(boxed_ty, field, variant_index, including_tuple_field)
351351
} else {
352352
match *ty.kind() {
353353
ty::Adt(def, _) => {
@@ -772,7 +772,7 @@ struct CapturedMessageOpt {
772772
maybe_reinitialized_locations_is_empty: bool,
773773
}
774774

775-
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
775+
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
776776
/// Finds the spans associated to a move or copy of move_place at location.
777777
pub(super) fn move_spans(
778778
&self,

compiler/rustc_borrowck/src/diagnostics/move_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ enum GroupedMoveError<'tcx> {
9393
},
9494
}
9595

96-
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
96+
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
9797
pub(crate) fn report_move_errors(&mut self) {
9898
let grouped_errors = self.group_move_errors();
9999
for error in grouped_errors {

0 commit comments

Comments
 (0)