Skip to content

Commit 0609062

Browse files
committed
Auto merge of rust-lang#130312 - matthiaskrgr:rollup-ihwsc91, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#129320 (Fix crash when labeling arguments for call_once and friends) - rust-lang#130266 (target: default to the medium code model on LoongArch targets) - rust-lang#130297 (Dataflow cleanups) - rust-lang#130299 (Add set_dcx to ParseSess) - rust-lang#130301 (some fixes for clashing_extern_declarations lint) - rust-lang#130305 (Clippy: consider msrv for const context for const_float_bits_conv) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 0307e40 + 5343fcd commit 0609062

32 files changed

+609
-467
lines changed

compiler/rustc_borrowck/src/dataflow.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::mir::{
99
use rustc_middle::ty::{RegionVid, TyCtxt};
1010
use rustc_mir_dataflow::fmt::DebugWithContext;
1111
use rustc_mir_dataflow::impls::{EverInitializedPlaces, MaybeUninitializedPlaces};
12-
use rustc_mir_dataflow::{Analysis, AnalysisDomain, GenKill, Results, ResultsVisitable};
12+
use rustc_mir_dataflow::{Analysis, AnalysisDomain, Forward, GenKill, Results, ResultsVisitable};
1313
use tracing::debug;
1414

1515
use crate::{places_conflict, BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext};
@@ -23,34 +23,33 @@ pub(crate) struct BorrowckResults<'a, 'tcx> {
2323

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

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

37-
fn new_flow_state(&self, body: &mir::Body<'tcx>) -> Self::FlowState {
38-
BorrowckFlowState {
36+
fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain {
37+
BorrowckDomain {
3938
borrows: self.borrows.analysis.bottom_value(body),
4039
uninits: self.uninits.analysis.bottom_value(body),
4140
ever_inits: self.ever_inits.analysis.bottom_value(body),
4241
}
4342
}
4443

45-
fn reset_to_block_entry(&self, state: &mut Self::FlowState, block: BasicBlock) {
44+
fn reset_to_block_entry(&self, state: &mut Self::Domain, block: BasicBlock) {
4645
state.borrows.clone_from(self.borrows.entry_set_for_block(block));
4746
state.uninits.clone_from(self.uninits.entry_set_for_block(block));
4847
state.ever_inits.clone_from(self.ever_inits.entry_set_for_block(block));
4948
}
5049

5150
fn reconstruct_before_statement_effect(
5251
&mut self,
53-
state: &mut Self::FlowState,
52+
state: &mut Self::Domain,
5453
stmt: &mir::Statement<'tcx>,
5554
loc: Location,
5655
) {
@@ -61,7 +60,7 @@ impl<'a, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'tcx> {
6160

6261
fn reconstruct_statement_effect(
6362
&mut self,
64-
state: &mut Self::FlowState,
63+
state: &mut Self::Domain,
6564
stmt: &mir::Statement<'tcx>,
6665
loc: Location,
6766
) {
@@ -72,7 +71,7 @@ impl<'a, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'tcx> {
7271

7372
fn reconstruct_before_terminator_effect(
7473
&mut self,
75-
state: &mut Self::FlowState,
74+
state: &mut Self::Domain,
7675
term: &mir::Terminator<'tcx>,
7776
loc: Location,
7877
) {
@@ -83,7 +82,7 @@ impl<'a, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'tcx> {
8382

8483
fn reconstruct_terminator_effect(
8584
&mut self,
86-
state: &mut Self::FlowState,
85+
state: &mut Self::Domain,
8786
term: &mir::Terminator<'tcx>,
8887
loc: Location,
8988
) {

0 commit comments

Comments
 (0)