Skip to content

Commit

Permalink
Auto merge of rust-lang#130312 - matthiaskrgr:rollup-ihwsc91, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

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
  • Loading branch information
bors committed Sep 13, 2024
2 parents 0307e40 + 5343fcd commit 0609062
Show file tree
Hide file tree
Showing 32 changed files with 609 additions and 467 deletions.
23 changes: 11 additions & 12 deletions compiler/rustc_borrowck/src/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_middle::mir::{
use rustc_middle::ty::{RegionVid, TyCtxt};
use rustc_mir_dataflow::fmt::DebugWithContext;
use rustc_mir_dataflow::impls::{EverInitializedPlaces, MaybeUninitializedPlaces};
use rustc_mir_dataflow::{Analysis, AnalysisDomain, GenKill, Results, ResultsVisitable};
use rustc_mir_dataflow::{Analysis, AnalysisDomain, Forward, GenKill, Results, ResultsVisitable};
use tracing::debug;

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

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

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

fn new_flow_state(&self, body: &mir::Body<'tcx>) -> Self::FlowState {
BorrowckFlowState {
fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain {
BorrowckDomain {
borrows: self.borrows.analysis.bottom_value(body),
uninits: self.uninits.analysis.bottom_value(body),
ever_inits: self.ever_inits.analysis.bottom_value(body),
}
}

fn reset_to_block_entry(&self, state: &mut Self::FlowState, block: BasicBlock) {
fn reset_to_block_entry(&self, state: &mut Self::Domain, block: BasicBlock) {
state.borrows.clone_from(self.borrows.entry_set_for_block(block));
state.uninits.clone_from(self.uninits.entry_set_for_block(block));
state.ever_inits.clone_from(self.ever_inits.entry_set_for_block(block));
}

fn reconstruct_before_statement_effect(
&mut self,
state: &mut Self::FlowState,
state: &mut Self::Domain,
stmt: &mir::Statement<'tcx>,
loc: Location,
) {
Expand All @@ -61,7 +60,7 @@ impl<'a, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'tcx> {

fn reconstruct_statement_effect(
&mut self,
state: &mut Self::FlowState,
state: &mut Self::Domain,
stmt: &mir::Statement<'tcx>,
loc: Location,
) {
Expand All @@ -72,7 +71,7 @@ impl<'a, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'tcx> {

fn reconstruct_before_terminator_effect(
&mut self,
state: &mut Self::FlowState,
state: &mut Self::Domain,
term: &mir::Terminator<'tcx>,
loc: Location,
) {
Expand All @@ -83,7 +82,7 @@ impl<'a, 'tcx> ResultsVisitable<'tcx> for BorrowckResults<'a, 'tcx> {

fn reconstruct_terminator_effect(
&mut self,
state: &mut Self::FlowState,
state: &mut Self::Domain,
term: &mir::Terminator<'tcx>,
loc: Location,
) {
Expand Down
Loading

0 comments on commit 0609062

Please sign in to comment.