Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c2f74c3

Browse files
committedSep 9, 2024
Auto merge of #130165 - matthiaskrgr:rollup-fsnmz3t, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #129929 (`rustc_mir_transform` cleanups, round 2) - #130022 (Dataflow/borrowck lifetime cleanups) - #130064 (fix ICE in CMSE type validation) - #130067 (Remove redundant check in `symlink_hard_link` test) - #130131 (Print a helpful message if any tests were skipped for being up-to-date) - #130137 (Fix ICE caused by missing span in a region error) - #130153 (use verbose flag as a default value for `rust.verbose-tests`) - #130154 (Stabilize `char::MIN`) - #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

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
}

0 commit comments

Comments
 (0)
Please sign in to comment.