Skip to content

Commit c2f74c3

Browse files
committed
Auto merge of rust-lang#130165 - matthiaskrgr:rollup-fsnmz3t, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#129929 (`rustc_mir_transform` cleanups, round 2) - rust-lang#130022 (Dataflow/borrowck lifetime cleanups) - rust-lang#130064 (fix ICE in CMSE type validation) - rust-lang#130067 (Remove redundant check in `symlink_hard_link` test) - rust-lang#130131 (Print a helpful message if any tests were skipped for being up-to-date) - rust-lang#130137 (Fix ICE caused by missing span in a region error) - rust-lang#130153 (use verbose flag as a default value for `rust.verbose-tests`) - rust-lang#130154 (Stabilize `char::MIN`) - rust-lang#130158 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
2 parents d7522d8 + a0346bb commit c2f74c3

File tree

105 files changed

+667
-603
lines changed

Some content is hidden

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

105 files changed

+667
-603
lines changed

compiler/rustc_borrowck/src/borrowck_errors.rs

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

+19-20
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

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

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

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

compiler/rustc_borrowck/src/diagnostics/mod.rs

+2-2
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
///
@@ -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

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

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(crate) enum AccessKind {
3232
Mutate,
3333
}
3434

35-
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
35+
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
3636
pub(crate) fn report_mutability_error(
3737
&mut self,
3838
access_place: Place<'tcx>,

compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl OutlivesSuggestionBuilder {
7676
/// Returns a name for the region if it is suggestable. See `region_name_is_suggestable`.
7777
fn region_vid_to_name(
7878
&self,
79-
mbcx: &MirBorrowckCtxt<'_, '_, '_, '_>,
79+
mbcx: &MirBorrowckCtxt<'_, '_, '_>,
8080
region: RegionVid,
8181
) -> Option<RegionName> {
8282
mbcx.give_region_a_name(region).filter(Self::region_name_is_suggestable)
@@ -85,7 +85,7 @@ impl OutlivesSuggestionBuilder {
8585
/// Compiles a list of all suggestions to be printed in the final big suggestion.
8686
fn compile_all_suggestions(
8787
&self,
88-
mbcx: &MirBorrowckCtxt<'_, '_, '_, '_>,
88+
mbcx: &MirBorrowckCtxt<'_, '_, '_>,
8989
) -> SmallVec<[SuggestedConstraint; 2]> {
9090
let mut suggested = SmallVec::new();
9191

@@ -161,7 +161,7 @@ impl OutlivesSuggestionBuilder {
161161
/// Emit an intermediate note on the given `Diag` if the involved regions are suggestable.
162162
pub(crate) fn intermediate_suggestion(
163163
&mut self,
164-
mbcx: &MirBorrowckCtxt<'_, '_, '_, '_>,
164+
mbcx: &MirBorrowckCtxt<'_, '_, '_>,
165165
errci: &ErrorConstraintInfo<'_>,
166166
diag: &mut Diag<'_>,
167167
) {
@@ -180,7 +180,7 @@ impl OutlivesSuggestionBuilder {
180180

181181
/// If there is a suggestion to emit, add a diagnostic to the buffer. This is the final
182182
/// suggestion including all collected constraints.
183-
pub(crate) fn add_suggestion(&self, mbcx: &mut MirBorrowckCtxt<'_, '_, '_, '_>) {
183+
pub(crate) fn add_suggestion(&self, mbcx: &mut MirBorrowckCtxt<'_, '_, '_>) {
184184
// No constraints to add? Done.
185185
if self.constraints_to_add.is_empty() {
186186
debug!("No constraints to suggest.");

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub(crate) struct ErrorConstraintInfo<'tcx> {
156156
pub(super) span: Span,
157157
}
158158

159-
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
159+
impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
160160
/// Converts a region inference variable into a `ty::Region` that
161161
/// we can use for error reporting. If `r` is universally bound,
162162
/// then we use the name that we have on record for it. If `r` is

compiler/rustc_borrowck/src/diagnostics/region_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl rustc_errors::IntoDiagArg for RegionName {
200200
}
201201
}
202202

203-
impl<'tcx> MirBorrowckCtxt<'_, '_, '_, 'tcx> {
203+
impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
204204
pub(crate) fn mir_def_id(&self) -> hir::def_id::LocalDefId {
205205
self.body.source.def_id().expect_local()
206206
}

0 commit comments

Comments
 (0)