mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rename and reorder lots of lifetimes.
- Replace non-standard names like 's, 'p, 'rg, 'ck, 'parent, 'this, and 'me with vanilla 'a. These are cases where the original name isn't really any more informative than 'a. - Replace names like 'cx, 'mir, and 'body with vanilla 'a when the lifetime applies to multiple fields and so the original lifetime name isn't really accurate. - Put 'tcx last in lifetime lists, and 'a before 'b.
This commit is contained in:
parent
606b9cb406
commit
8d32578fe1
@ -97,11 +97,11 @@ impl<D: ConstraintGraphDirection> ConstraintGraph<D> {
|
|||||||
/// Given the constraint set from which this graph was built
|
/// Given the constraint set from which this graph was built
|
||||||
/// creates a region graph so that you can iterate over *regions*
|
/// creates a region graph so that you can iterate over *regions*
|
||||||
/// and not constraints.
|
/// and not constraints.
|
||||||
pub(crate) fn region_graph<'rg, 'tcx>(
|
pub(crate) fn region_graph<'a, 'tcx>(
|
||||||
&'rg self,
|
&'a self,
|
||||||
set: &'rg OutlivesConstraintSet<'tcx>,
|
set: &'a OutlivesConstraintSet<'tcx>,
|
||||||
static_region: RegionVid,
|
static_region: RegionVid,
|
||||||
) -> RegionGraph<'rg, 'tcx, D> {
|
) -> RegionGraph<'a, 'tcx, D> {
|
||||||
RegionGraph::new(set, self, static_region)
|
RegionGraph::new(set, self, static_region)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,15 +130,15 @@ impl<D: ConstraintGraphDirection> ConstraintGraph<D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct Edges<'s, 'tcx, D: ConstraintGraphDirection> {
|
pub(crate) struct Edges<'a, 'tcx, D: ConstraintGraphDirection> {
|
||||||
graph: &'s ConstraintGraph<D>,
|
graph: &'a ConstraintGraph<D>,
|
||||||
constraints: &'s OutlivesConstraintSet<'tcx>,
|
constraints: &'a OutlivesConstraintSet<'tcx>,
|
||||||
pointer: Option<OutlivesConstraintIndex>,
|
pointer: Option<OutlivesConstraintIndex>,
|
||||||
next_static_idx: Option<usize>,
|
next_static_idx: Option<usize>,
|
||||||
static_region: RegionVid,
|
static_region: RegionVid,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Edges<'s, 'tcx, D> {
|
impl<'a, 'tcx, D: ConstraintGraphDirection> Iterator for Edges<'a, 'tcx, D> {
|
||||||
type Item = OutlivesConstraint<'tcx>;
|
type Item = OutlivesConstraint<'tcx>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
@ -171,20 +171,20 @@ impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Edges<'s, 'tcx, D> {
|
|||||||
/// This struct brings together a constraint set and a (normal, not
|
/// This struct brings together a constraint set and a (normal, not
|
||||||
/// reverse) constraint graph. It implements the graph traits and is
|
/// reverse) constraint graph. It implements the graph traits and is
|
||||||
/// usd for doing the SCC computation.
|
/// usd for doing the SCC computation.
|
||||||
pub(crate) struct RegionGraph<'s, 'tcx, D: ConstraintGraphDirection> {
|
pub(crate) struct RegionGraph<'a, 'tcx, D: ConstraintGraphDirection> {
|
||||||
set: &'s OutlivesConstraintSet<'tcx>,
|
set: &'a OutlivesConstraintSet<'tcx>,
|
||||||
constraint_graph: &'s ConstraintGraph<D>,
|
constraint_graph: &'a ConstraintGraph<D>,
|
||||||
static_region: RegionVid,
|
static_region: RegionVid,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, 'tcx, D: ConstraintGraphDirection> RegionGraph<'s, 'tcx, D> {
|
impl<'a, 'tcx, D: ConstraintGraphDirection> RegionGraph<'a, 'tcx, D> {
|
||||||
/// Creates a "dependency graph" where each region constraint `R1:
|
/// Creates a "dependency graph" where each region constraint `R1:
|
||||||
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
|
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
|
||||||
/// construct SCCs for region inference but also for error
|
/// construct SCCs for region inference but also for error
|
||||||
/// reporting.
|
/// reporting.
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
set: &'s OutlivesConstraintSet<'tcx>,
|
set: &'a OutlivesConstraintSet<'tcx>,
|
||||||
constraint_graph: &'s ConstraintGraph<D>,
|
constraint_graph: &'a ConstraintGraph<D>,
|
||||||
static_region: RegionVid,
|
static_region: RegionVid,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self { set, constraint_graph, static_region }
|
Self { set, constraint_graph, static_region }
|
||||||
@ -192,18 +192,18 @@ impl<'s, 'tcx, D: ConstraintGraphDirection> RegionGraph<'s, 'tcx, D> {
|
|||||||
|
|
||||||
/// Given a region `R`, iterate over all regions `R1` such that
|
/// Given a region `R`, iterate over all regions `R1` such that
|
||||||
/// there exists a constraint `R: R1`.
|
/// there exists a constraint `R: R1`.
|
||||||
pub(crate) fn outgoing_regions(&self, region_sup: RegionVid) -> Successors<'s, 'tcx, D> {
|
pub(crate) fn outgoing_regions(&self, region_sup: RegionVid) -> Successors<'a, 'tcx, D> {
|
||||||
Successors {
|
Successors {
|
||||||
edges: self.constraint_graph.outgoing_edges(region_sup, self.set, self.static_region),
|
edges: self.constraint_graph.outgoing_edges(region_sup, self.set, self.static_region),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct Successors<'s, 'tcx, D: ConstraintGraphDirection> {
|
pub(crate) struct Successors<'a, 'tcx, D: ConstraintGraphDirection> {
|
||||||
edges: Edges<'s, 'tcx, D>,
|
edges: Edges<'a, 'tcx, D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Successors<'s, 'tcx, D> {
|
impl<'a, 'tcx, D: ConstraintGraphDirection> Iterator for Successors<'a, 'tcx, D> {
|
||||||
type Item = RegionVid;
|
type Item = RegionVid;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
@ -211,7 +211,7 @@ impl<'s, 'tcx, D: ConstraintGraphDirection> Iterator for Successors<'s, 'tcx, D>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::DirectedGraph for RegionGraph<'s, 'tcx, D> {
|
impl<'a, 'tcx, D: ConstraintGraphDirection> graph::DirectedGraph for RegionGraph<'a, 'tcx, D> {
|
||||||
type Node = RegionVid;
|
type Node = RegionVid;
|
||||||
|
|
||||||
fn num_nodes(&self) -> usize {
|
fn num_nodes(&self) -> usize {
|
||||||
@ -219,7 +219,7 @@ impl<'s, 'tcx, D: ConstraintGraphDirection> graph::DirectedGraph for RegionGraph
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'s, 'tcx, D: ConstraintGraphDirection> graph::Successors for RegionGraph<'s, 'tcx, D> {
|
impl<'a, 'tcx, D: ConstraintGraphDirection> graph::Successors for RegionGraph<'a, 'tcx, D> {
|
||||||
fn successors(&self, node: Self::Node) -> impl Iterator<Item = Self::Node> {
|
fn successors(&self, node: Self::Node) -> impl Iterator<Item = Self::Node> {
|
||||||
self.outgoing_regions(node)
|
self.outgoing_regions(node)
|
||||||
}
|
}
|
||||||
|
@ -113,16 +113,16 @@ pub struct Borrows<'a, 'tcx> {
|
|||||||
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OutOfScopePrecomputer<'mir, 'tcx> {
|
struct OutOfScopePrecomputer<'a, 'tcx> {
|
||||||
visited: BitSet<mir::BasicBlock>,
|
visited: BitSet<mir::BasicBlock>,
|
||||||
visit_stack: Vec<mir::BasicBlock>,
|
visit_stack: Vec<mir::BasicBlock>,
|
||||||
body: &'mir Body<'tcx>,
|
body: &'a Body<'tcx>,
|
||||||
regioncx: &'mir RegionInferenceContext<'tcx>,
|
regioncx: &'a RegionInferenceContext<'tcx>,
|
||||||
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'mir, 'tcx> OutOfScopePrecomputer<'mir, 'tcx> {
|
impl<'a, 'tcx> OutOfScopePrecomputer<'a, 'tcx> {
|
||||||
fn new(body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>) -> Self {
|
fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self {
|
||||||
OutOfScopePrecomputer {
|
OutOfScopePrecomputer {
|
||||||
visited: BitSet::new_empty(body.basic_blocks.len()),
|
visited: BitSet::new_empty(body.basic_blocks.len()),
|
||||||
visit_stack: vec![],
|
visit_stack: vec![],
|
||||||
@ -225,17 +225,17 @@ pub fn calculate_borrows_out_of_scope_at_location<'tcx>(
|
|||||||
prec.borrows_out_of_scope_at_location
|
prec.borrows_out_of_scope_at_location
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PoloniusOutOfScopePrecomputer<'mir, 'tcx> {
|
struct PoloniusOutOfScopePrecomputer<'a, 'tcx> {
|
||||||
visited: BitSet<mir::BasicBlock>,
|
visited: BitSet<mir::BasicBlock>,
|
||||||
visit_stack: Vec<mir::BasicBlock>,
|
visit_stack: Vec<mir::BasicBlock>,
|
||||||
body: &'mir Body<'tcx>,
|
body: &'a Body<'tcx>,
|
||||||
regioncx: &'mir RegionInferenceContext<'tcx>,
|
regioncx: &'a RegionInferenceContext<'tcx>,
|
||||||
|
|
||||||
loans_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
loans_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'mir, 'tcx> PoloniusOutOfScopePrecomputer<'mir, 'tcx> {
|
impl<'a, 'tcx> PoloniusOutOfScopePrecomputer<'a, 'tcx> {
|
||||||
fn new(body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>) -> Self {
|
fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
visited: BitSet::new_empty(body.basic_blocks.len()),
|
visited: BitSet::new_empty(body.basic_blocks.len()),
|
||||||
visit_stack: vec![],
|
visit_stack: vec![],
|
||||||
|
@ -3540,7 +3540,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||||||
location: Location,
|
location: Location,
|
||||||
mpi: MovePathIndex,
|
mpi: MovePathIndex,
|
||||||
) -> (Vec<MoveSite>, Vec<Location>) {
|
) -> (Vec<MoveSite>, Vec<Location>) {
|
||||||
fn predecessor_locations<'tcx, 'a>(
|
fn predecessor_locations<'a, 'tcx>(
|
||||||
body: &'a mir::Body<'tcx>,
|
body: &'a mir::Body<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) -> impl Iterator<Item = Location> + Captures<'tcx> + 'a {
|
) -> impl Iterator<Item = Location> + Captures<'tcx> + 'a {
|
||||||
|
@ -21,15 +21,15 @@ pub(crate) fn find<'tcx>(
|
|||||||
uf.find()
|
uf.find()
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UseFinder<'cx, 'tcx> {
|
struct UseFinder<'a, 'tcx> {
|
||||||
body: &'cx Body<'tcx>,
|
body: &'a Body<'tcx>,
|
||||||
regioncx: &'cx Rc<RegionInferenceContext<'tcx>>,
|
regioncx: &'a Rc<RegionInferenceContext<'tcx>>,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
region_vid: RegionVid,
|
region_vid: RegionVid,
|
||||||
start_point: Location,
|
start_point: Location,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cx, 'tcx> UseFinder<'cx, 'tcx> {
|
impl<'a, 'tcx> UseFinder<'a, 'tcx> {
|
||||||
fn find(&mut self) -> Option<Cause> {
|
fn find(&mut self) -> Option<Cause> {
|
||||||
let mut queue = VecDeque::new();
|
let mut queue = VecDeque::new();
|
||||||
let mut visited = FxIndexSet::default();
|
let mut visited = FxIndexSet::default();
|
||||||
@ -93,8 +93,8 @@ impl<'cx, 'tcx> UseFinder<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DefUseVisitor<'cx, 'tcx> {
|
struct DefUseVisitor<'a, 'tcx> {
|
||||||
body: &'cx Body<'tcx>,
|
body: &'a Body<'tcx>,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
region_vid: RegionVid,
|
region_vid: RegionVid,
|
||||||
def_use_result: Option<DefUseResult>,
|
def_use_result: Option<DefUseResult>,
|
||||||
@ -106,7 +106,7 @@ enum DefUseResult {
|
|||||||
UseDrop { local: Local },
|
UseDrop { local: Local },
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cx, 'tcx> Visitor<'tcx> for DefUseVisitor<'cx, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for DefUseVisitor<'a, 'tcx> {
|
||||||
fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
|
fn visit_local(&mut self, local: Local, context: PlaceContext, _: Location) {
|
||||||
let local_ty = self.body.local_decls[local].ty;
|
let local_ty = self.body.local_decls[local].ty;
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
suggested: bool,
|
suggested: bool,
|
||||||
}
|
}
|
||||||
impl<'a, 'cx, 'tcx> Visitor<'tcx> for SuggestIndexOperatorAlternativeVisitor<'a, 'cx, 'tcx> {
|
impl<'a, 'infcx, 'tcx> Visitor<'tcx> for SuggestIndexOperatorAlternativeVisitor<'a, 'infcx, 'tcx> {
|
||||||
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
|
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
|
||||||
hir::intravisit::walk_stmt(self, stmt);
|
hir::intravisit::walk_stmt(self, stmt);
|
||||||
let expr = match stmt.kind {
|
let expr = match stmt.kind {
|
||||||
|
@ -32,18 +32,18 @@ pub(super) fn emit_loan_invalidations<'tcx>(
|
|||||||
visitor.visit_body(body);
|
visitor.visit_body(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LoanInvalidationsGenerator<'cx, 'tcx> {
|
struct LoanInvalidationsGenerator<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
all_facts: &'cx mut AllFacts,
|
all_facts: &'a mut AllFacts,
|
||||||
location_table: &'cx LocationTable,
|
location_table: &'a LocationTable,
|
||||||
body: &'cx Body<'tcx>,
|
body: &'a Body<'tcx>,
|
||||||
dominators: &'cx Dominators<BasicBlock>,
|
dominators: &'a Dominators<BasicBlock>,
|
||||||
borrow_set: &'cx BorrowSet<'tcx>,
|
borrow_set: &'a BorrowSet<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Visits the whole MIR and generates `invalidates()` facts.
|
/// Visits the whole MIR and generates `invalidates()` facts.
|
||||||
/// Most of the code implementing this was stolen from `borrow_check/mod.rs`.
|
/// Most of the code implementing this was stolen from `borrow_check/mod.rs`.
|
||||||
impl<'cx, 'tcx> Visitor<'tcx> for LoanInvalidationsGenerator<'cx, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for LoanInvalidationsGenerator<'a, 'tcx> {
|
||||||
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
|
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
|
||||||
self.check_activations(location);
|
self.check_activations(location);
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for LoanInvalidationsGenerator<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cx, 'tcx> LoanInvalidationsGenerator<'cx, 'tcx> {
|
impl<'a, 'tcx> LoanInvalidationsGenerator<'a, 'tcx> {
|
||||||
/// Simulates mutation of a place.
|
/// Simulates mutation of a place.
|
||||||
fn mutate_place(&mut self, location: Location, place: Place<'tcx>, kind: AccessDepth) {
|
fn mutate_place(&mut self, location: Location, place: Place<'tcx>, kind: AccessDepth) {
|
||||||
self.access_place(
|
self.access_place(
|
||||||
|
@ -25,15 +25,15 @@ pub(super) fn emit_loan_kills<'tcx>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LoanKillsGenerator<'cx, 'tcx> {
|
struct LoanKillsGenerator<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
all_facts: &'cx mut AllFacts,
|
all_facts: &'a mut AllFacts,
|
||||||
location_table: &'cx LocationTable,
|
location_table: &'a LocationTable,
|
||||||
borrow_set: &'cx BorrowSet<'tcx>,
|
borrow_set: &'a BorrowSet<'tcx>,
|
||||||
body: &'cx Body<'tcx>,
|
body: &'a Body<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cx, 'tcx> Visitor<'tcx> for LoanKillsGenerator<'cx, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for LoanKillsGenerator<'a, 'tcx> {
|
||||||
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
|
fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
|
||||||
// Also record CFG facts here.
|
// Also record CFG facts here.
|
||||||
self.all_facts.cfg_edge.push((
|
self.all_facts.cfg_edge.push((
|
||||||
|
@ -181,12 +181,12 @@ impl UniversalRegionRelations<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UniversalRegionRelationsBuilder<'this, 'tcx> {
|
struct UniversalRegionRelationsBuilder<'a, 'tcx> {
|
||||||
infcx: &'this InferCtxt<'tcx>,
|
infcx: &'a InferCtxt<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
universal_regions: Rc<UniversalRegions<'tcx>>,
|
universal_regions: Rc<UniversalRegions<'tcx>>,
|
||||||
implicit_region_bound: ty::Region<'tcx>,
|
implicit_region_bound: ty::Region<'tcx>,
|
||||||
constraints: &'this mut MirTypeckRegionConstraints<'tcx>,
|
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
|
||||||
|
|
||||||
// outputs:
|
// outputs:
|
||||||
outlives: TransitiveRelationBuilder<RegionVid>,
|
outlives: TransitiveRelationBuilder<RegionVid>,
|
||||||
|
@ -148,12 +148,12 @@ fn record_regular_live_regions<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Visitor looking for regions that should be live within rvalues or calls.
|
/// Visitor looking for regions that should be live within rvalues or calls.
|
||||||
struct LiveVariablesVisitor<'cx, 'tcx> {
|
struct LiveVariablesVisitor<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
liveness_constraints: &'cx mut LivenessValues,
|
liveness_constraints: &'a mut LivenessValues,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cx, 'tcx> Visitor<'tcx> for LiveVariablesVisitor<'cx, 'tcx> {
|
impl<'a, 'tcx> Visitor<'tcx> for LiveVariablesVisitor<'a, 'tcx> {
|
||||||
/// We sometimes have `args` within an rvalue, or within a
|
/// We sometimes have `args` within an rvalue, or within a
|
||||||
/// call. Make them live at the location where they appear.
|
/// call. Make them live at the location where they appear.
|
||||||
fn visit_args(&mut self, args: &GenericArgsRef<'tcx>, location: Location) {
|
fn visit_args(&mut self, args: &GenericArgsRef<'tcx>, location: Location) {
|
||||||
@ -188,7 +188,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for LiveVariablesVisitor<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cx, 'tcx> LiveVariablesVisitor<'cx, 'tcx> {
|
impl<'a, 'tcx> LiveVariablesVisitor<'a, 'tcx> {
|
||||||
/// Some variable is "regular live" at `location` -- i.e., it may be used later. This means that
|
/// Some variable is "regular live" at `location` -- i.e., it may be used later. This means that
|
||||||
/// all regions appearing in the type of `value` must be live at `location`.
|
/// all regions appearing in the type of `value` must be live at `location`.
|
||||||
fn record_regions_live_at<T>(&mut self, value: T, location: Location)
|
fn record_regions_live_at<T>(&mut self, value: T, location: Location)
|
||||||
|
@ -11,13 +11,13 @@ use crate::location::{LocationIndex, LocationTable};
|
|||||||
type VarPointRelation = Vec<(Local, LocationIndex)>;
|
type VarPointRelation = Vec<(Local, LocationIndex)>;
|
||||||
type PathPointRelation = Vec<(MovePathIndex, LocationIndex)>;
|
type PathPointRelation = Vec<(MovePathIndex, LocationIndex)>;
|
||||||
|
|
||||||
struct UseFactsExtractor<'me, 'tcx> {
|
struct UseFactsExtractor<'a, 'tcx> {
|
||||||
var_defined_at: &'me mut VarPointRelation,
|
var_defined_at: &'a mut VarPointRelation,
|
||||||
var_used_at: &'me mut VarPointRelation,
|
var_used_at: &'a mut VarPointRelation,
|
||||||
location_table: &'me LocationTable,
|
location_table: &'a LocationTable,
|
||||||
var_dropped_at: &'me mut VarPointRelation,
|
var_dropped_at: &'a mut VarPointRelation,
|
||||||
move_data: &'me MoveData<'tcx>,
|
move_data: &'a MoveData<'tcx>,
|
||||||
path_accessed_at_base: &'me mut PathPointRelation,
|
path_accessed_at_base: &'a mut PathPointRelation,
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Visitor to walk through the MIR and extract point-wise facts
|
// A Visitor to walk through the MIR and extract point-wise facts
|
||||||
|
@ -65,7 +65,7 @@ struct AllocFnFactory<'a, 'b> {
|
|||||||
span: Span,
|
span: Span,
|
||||||
ty_span: Span,
|
ty_span: Span,
|
||||||
global: Ident,
|
global: Ident,
|
||||||
cx: &'b ExtCtxt<'a>,
|
cx: &'a ExtCtxt<'b>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AllocFnFactory<'_, '_> {
|
impl AllocFnFactory<'_, '_> {
|
||||||
|
@ -166,12 +166,12 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LocalReturnTyVisitor<'ck, 'mir, 'tcx> {
|
struct LocalReturnTyVisitor<'a, 'mir, 'tcx> {
|
||||||
kind: LocalKind,
|
kind: LocalKind,
|
||||||
checker: &'ck mut Checker<'mir, 'tcx>,
|
checker: &'a mut Checker<'mir, 'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ck, 'mir, 'tcx> TypeVisitor<TyCtxt<'tcx>> for LocalReturnTyVisitor<'ck, 'mir, 'tcx> {
|
impl<'a, 'mir, 'tcx> TypeVisitor<TyCtxt<'tcx>> for LocalReturnTyVisitor<'a, 'mir, 'tcx> {
|
||||||
fn visit_ty(&mut self, t: Ty<'tcx>) {
|
fn visit_ty(&mut self, t: Ty<'tcx>) {
|
||||||
match t.kind() {
|
match t.kind() {
|
||||||
ty::FnPtr(..) => {}
|
ty::FnPtr(..) => {}
|
||||||
|
@ -1114,7 +1114,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> std::fmt::Debug for DumpAllocs<'a, 'tcx, M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reading and writing.
|
/// Reading and writing.
|
||||||
impl<'tcx, 'a, Prov: Provenance, Extra, Bytes: AllocBytes>
|
impl<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes>
|
||||||
AllocRefMut<'a, 'tcx, Prov, Extra, Bytes>
|
AllocRefMut<'a, 'tcx, Prov, Extra, Bytes>
|
||||||
{
|
{
|
||||||
pub fn as_ref<'b>(&'b self) -> AllocRef<'b, 'tcx, Prov, Extra, Bytes> {
|
pub fn as_ref<'b>(&'b self) -> AllocRef<'b, 'tcx, Prov, Extra, Bytes> {
|
||||||
@ -1162,7 +1162,7 @@ impl<'tcx, 'a, Prov: Provenance, Extra, Bytes: AllocBytes>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a, Prov: Provenance, Extra, Bytes: AllocBytes> AllocRef<'a, 'tcx, Prov, Extra, Bytes> {
|
impl<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes> AllocRef<'a, 'tcx, Prov, Extra, Bytes> {
|
||||||
/// `range` is relative to this allocation reference, not the base of the allocation.
|
/// `range` is relative to this allocation reference, not the base of the allocation.
|
||||||
pub fn read_scalar(
|
pub fn read_scalar(
|
||||||
&self,
|
&self,
|
||||||
|
@ -101,7 +101,7 @@ pub trait Projectable<'tcx, Prov: Provenance>: Sized + std::fmt::Debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A type representing iteration over the elements of an array.
|
/// A type representing iteration over the elements of an array.
|
||||||
pub struct ArrayIterator<'tcx, 'a, Prov: Provenance, P: Projectable<'tcx, Prov>> {
|
pub struct ArrayIterator<'a, 'tcx, Prov: Provenance, P: Projectable<'tcx, Prov>> {
|
||||||
base: &'a P,
|
base: &'a P,
|
||||||
range: Range<u64>,
|
range: Range<u64>,
|
||||||
stride: Size,
|
stride: Size,
|
||||||
@ -109,7 +109,7 @@ pub struct ArrayIterator<'tcx, 'a, Prov: Provenance, P: Projectable<'tcx, Prov>>
|
|||||||
_phantom: PhantomData<Prov>, // otherwise it says `Prov` is never used...
|
_phantom: PhantomData<Prov>, // otherwise it says `Prov` is never used...
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a, Prov: Provenance, P: Projectable<'tcx, Prov>> ArrayIterator<'tcx, 'a, Prov, P> {
|
impl<'a, 'tcx, Prov: Provenance, P: Projectable<'tcx, Prov>> ArrayIterator<'a, 'tcx, Prov, P> {
|
||||||
/// Should be the same `ecx` on each call, and match the one used to create the iterator.
|
/// Should be the same `ecx` on each call, and match the one used to create the iterator.
|
||||||
pub fn next<M: Machine<'tcx, Provenance = Prov>>(
|
pub fn next<M: Machine<'tcx, Provenance = Prov>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -273,7 +273,7 @@ where
|
|||||||
pub fn project_array_fields<'a, P: Projectable<'tcx, M::Provenance>>(
|
pub fn project_array_fields<'a, P: Projectable<'tcx, M::Provenance>>(
|
||||||
&self,
|
&self,
|
||||||
base: &'a P,
|
base: &'a P,
|
||||||
) -> InterpResult<'tcx, ArrayIterator<'tcx, 'a, M::Provenance, P>> {
|
) -> InterpResult<'tcx, ArrayIterator<'a, 'tcx, M::Provenance, P>> {
|
||||||
let abi::FieldsShape::Array { stride, .. } = base.layout().fields else {
|
let abi::FieldsShape::Array { stride, .. } = base.layout().fields else {
|
||||||
span_bug!(self.cur_span(), "project_array_fields: expected an array layout");
|
span_bug!(self.cur_span(), "project_array_fields: expected an array layout");
|
||||||
};
|
};
|
||||||
|
@ -711,7 +711,7 @@ pub(crate) struct CastThinPointerToFatPointer<'tcx> {
|
|||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(hir_typeck_pass_to_variadic_function, code = E0617)]
|
#[diag(hir_typeck_pass_to_variadic_function, code = E0617)]
|
||||||
pub(crate) struct PassToVariadicFunction<'tcx, 'a> {
|
pub(crate) struct PassToVariadicFunction<'a, 'tcx> {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub ty: Ty<'tcx>,
|
pub ty: Ty<'tcx>,
|
||||||
|
@ -1234,7 +1234,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
infer_args_for_err: &'a FxHashSet<usize>,
|
infer_args_for_err: &'a FxHashSet<usize>,
|
||||||
segments: &'tcx [hir::PathSegment<'tcx>],
|
segments: &'tcx [hir::PathSegment<'tcx>],
|
||||||
}
|
}
|
||||||
impl<'tcx, 'a> GenericArgsLowerer<'a, 'tcx> for CtorGenericArgsCtxt<'a, 'tcx> {
|
impl<'a, 'tcx> GenericArgsLowerer<'a, 'tcx> for CtorGenericArgsCtxt<'a, 'tcx> {
|
||||||
fn args_for_def_id(
|
fn args_for_def_id(
|
||||||
&mut self,
|
&mut self,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
|
@ -83,7 +83,7 @@ struct TopInfo<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
struct PatInfo<'tcx, 'a> {
|
struct PatInfo<'a, 'tcx> {
|
||||||
binding_mode: ByRef,
|
binding_mode: ByRef,
|
||||||
max_ref_mutbl: MutblCap,
|
max_ref_mutbl: MutblCap,
|
||||||
top_info: &'a TopInfo<'tcx>,
|
top_info: &'a TopInfo<'tcx>,
|
||||||
@ -222,7 +222,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// Outside of this module, `check_pat_top` should always be used.
|
/// Outside of this module, `check_pat_top` should always be used.
|
||||||
/// Conversely, inside this module, `check_pat_top` should never be used.
|
/// Conversely, inside this module, `check_pat_top` should never be used.
|
||||||
#[instrument(level = "debug", skip(self, pat_info))]
|
#[instrument(level = "debug", skip(self, pat_info))]
|
||||||
fn check_pat(&self, pat: &'tcx Pat<'tcx>, expected: Ty<'tcx>, pat_info: PatInfo<'tcx, '_>) {
|
fn check_pat(&self, pat: &'tcx Pat<'tcx>, expected: Ty<'tcx>, pat_info: PatInfo<'_, 'tcx>) {
|
||||||
let PatInfo { binding_mode, max_ref_mutbl, top_info: ti, current_depth, .. } = pat_info;
|
let PatInfo { binding_mode, max_ref_mutbl, top_info: ti, current_depth, .. } = pat_info;
|
||||||
|
|
||||||
let path_res = match &pat.kind {
|
let path_res = match &pat.kind {
|
||||||
@ -668,7 +668,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
ident: Ident,
|
ident: Ident,
|
||||||
sub: Option<&'tcx Pat<'tcx>>,
|
sub: Option<&'tcx Pat<'tcx>>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let PatInfo { binding_mode: def_br, top_info: ti, .. } = pat_info;
|
let PatInfo { binding_mode: def_br, top_info: ti, .. } = pat_info;
|
||||||
|
|
||||||
@ -981,7 +981,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
fields: &'tcx [hir::PatField<'tcx>],
|
fields: &'tcx [hir::PatField<'tcx>],
|
||||||
has_rest_pat: bool,
|
has_rest_pat: bool,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
// Resolve the path and check the definition for errors.
|
// Resolve the path and check the definition for errors.
|
||||||
let (variant, pat_ty) = match self.check_struct_path(qpath, pat.hir_id) {
|
let (variant, pat_ty) = match self.check_struct_path(qpath, pat.hir_id) {
|
||||||
@ -1184,7 +1184,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
subpats: &'tcx [Pat<'tcx>],
|
subpats: &'tcx [Pat<'tcx>],
|
||||||
ddpos: hir::DotDotPos,
|
ddpos: hir::DotDotPos,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let on_error = |e| {
|
let on_error = |e| {
|
||||||
@ -1441,7 +1441,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
elements: &'tcx [Pat<'tcx>],
|
elements: &'tcx [Pat<'tcx>],
|
||||||
ddpos: hir::DotDotPos,
|
ddpos: hir::DotDotPos,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let mut expected_len = elements.len();
|
let mut expected_len = elements.len();
|
||||||
@ -1479,7 +1479,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
variant: &'tcx ty::VariantDef,
|
variant: &'tcx ty::VariantDef,
|
||||||
fields: &'tcx [hir::PatField<'tcx>],
|
fields: &'tcx [hir::PatField<'tcx>],
|
||||||
has_rest_pat: bool,
|
has_rest_pat: bool,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Result<(), ErrorGuaranteed> {
|
) -> Result<(), ErrorGuaranteed> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
|
|
||||||
@ -2070,7 +2070,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
span: Span,
|
span: Span,
|
||||||
inner: &'tcx Pat<'tcx>,
|
inner: &'tcx Pat<'tcx>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let (box_ty, inner_ty) = self
|
let (box_ty, inner_ty) = self
|
||||||
@ -2096,7 +2096,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
span: Span,
|
span: Span,
|
||||||
inner: &'tcx Pat<'tcx>,
|
inner: &'tcx Pat<'tcx>,
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
// Register a `DerefPure` bound, which is required by all `deref!()` pats.
|
// Register a `DerefPure` bound, which is required by all `deref!()` pats.
|
||||||
@ -2137,7 +2137,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
inner: &'tcx Pat<'tcx>,
|
inner: &'tcx Pat<'tcx>,
|
||||||
pat_mutbl: Mutability,
|
pat_mutbl: Mutability,
|
||||||
mut expected: Ty<'tcx>,
|
mut expected: Ty<'tcx>,
|
||||||
mut pat_info: PatInfo<'tcx, '_>,
|
mut pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let features = tcx.features();
|
let features = tcx.features();
|
||||||
@ -2345,7 +2345,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
slice: Option<&'tcx Pat<'tcx>>,
|
slice: Option<&'tcx Pat<'tcx>>,
|
||||||
after: &'tcx [Pat<'tcx>],
|
after: &'tcx [Pat<'tcx>],
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> Ty<'tcx> {
|
) -> Ty<'tcx> {
|
||||||
let expected = self.try_structurally_resolve_type(span, expected);
|
let expected = self.try_structurally_resolve_type(span, expected);
|
||||||
|
|
||||||
@ -2517,7 +2517,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
expected_ty: Ty<'tcx>,
|
expected_ty: Ty<'tcx>,
|
||||||
pat_info: PatInfo<'tcx, '_>,
|
pat_info: PatInfo<'_, 'tcx>,
|
||||||
) -> ErrorGuaranteed {
|
) -> ErrorGuaranteed {
|
||||||
let PatInfo { top_info: ti, current_depth, .. } = pat_info;
|
let PatInfo { top_info: ti, current_depth, .. } = pat_info;
|
||||||
|
|
||||||
|
@ -143,18 +143,18 @@ impl<'tcx> LateLintPass<'tcx> for TailExprDropOrder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LintVisitor<'tcx, 'a> {
|
struct LintVisitor<'a, 'tcx> {
|
||||||
cx: &'a LateContext<'tcx>,
|
cx: &'a LateContext<'tcx>,
|
||||||
// We only record locals that have significant drops
|
// We only record locals that have significant drops
|
||||||
locals: Vec<Span>,
|
locals: Vec<Span>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LocalCollector<'tcx, 'a> {
|
struct LocalCollector<'a, 'tcx> {
|
||||||
cx: &'a LateContext<'tcx>,
|
cx: &'a LateContext<'tcx>,
|
||||||
locals: &'a mut Vec<Span>,
|
locals: &'a mut Vec<Span>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> Visitor<'tcx> for LocalCollector<'tcx, 'a> {
|
impl<'a, 'tcx> Visitor<'tcx> for LocalCollector<'a, 'tcx> {
|
||||||
type Result = ();
|
type Result = ();
|
||||||
fn visit_pat(&mut self, pat: &'tcx Pat<'tcx>) {
|
fn visit_pat(&mut self, pat: &'tcx Pat<'tcx>) {
|
||||||
if let PatKind::Binding(_binding_mode, id, ident, pat) = pat.kind {
|
if let PatKind::Binding(_binding_mode, id, ident, pat) = pat.kind {
|
||||||
@ -171,7 +171,7 @@ impl<'tcx, 'a> Visitor<'tcx> for LocalCollector<'tcx, 'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> Visitor<'tcx> for LintVisitor<'tcx, 'a> {
|
impl<'a, 'tcx> Visitor<'tcx> for LintVisitor<'a, 'tcx> {
|
||||||
fn visit_block(&mut self, block: &'tcx Block<'tcx>) {
|
fn visit_block(&mut self, block: &'tcx Block<'tcx>) {
|
||||||
let mut locals = <_>::default();
|
let mut locals = <_>::default();
|
||||||
swap(&mut locals, &mut self.locals);
|
swap(&mut locals, &mut self.locals);
|
||||||
@ -183,7 +183,7 @@ impl<'tcx, 'a> Visitor<'tcx> for LintVisitor<'tcx, 'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> LintVisitor<'tcx, 'a> {
|
impl<'a, 'tcx> LintVisitor<'a, 'tcx> {
|
||||||
fn check_block_inner(&mut self, block: &Block<'tcx>) {
|
fn check_block_inner(&mut self, block: &Block<'tcx>) {
|
||||||
if !block.span.at_least_rust_2024() {
|
if !block.span.at_least_rust_2024() {
|
||||||
// We only lint for Edition 2024 onwards
|
// We only lint for Edition 2024 onwards
|
||||||
@ -205,13 +205,13 @@ impl<'tcx, 'a> LintVisitor<'tcx, 'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LintTailExpr<'tcx, 'a> {
|
struct LintTailExpr<'a, 'tcx> {
|
||||||
cx: &'a LateContext<'tcx>,
|
cx: &'a LateContext<'tcx>,
|
||||||
is_root_tail_expr: bool,
|
is_root_tail_expr: bool,
|
||||||
locals: &'a [Span],
|
locals: &'a [Span],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> LintTailExpr<'tcx, 'a> {
|
impl<'a, 'tcx> LintTailExpr<'a, 'tcx> {
|
||||||
fn expr_eventually_point_into_local(mut expr: &Expr<'tcx>) -> bool {
|
fn expr_eventually_point_into_local(mut expr: &Expr<'tcx>) -> bool {
|
||||||
loop {
|
loop {
|
||||||
match expr.kind {
|
match expr.kind {
|
||||||
@ -239,7 +239,7 @@ impl<'tcx, 'a> LintTailExpr<'tcx, 'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> Visitor<'tcx> for LintTailExpr<'tcx, 'a> {
|
impl<'a, 'tcx> Visitor<'tcx> for LintTailExpr<'a, 'tcx> {
|
||||||
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
|
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
|
||||||
if self.is_root_tail_expr {
|
if self.is_root_tail_expr {
|
||||||
self.is_root_tail_expr = false;
|
self.is_root_tail_expr = false;
|
||||||
|
@ -1713,13 +1713,13 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||||||
hir_ty: &hir::Ty<'tcx>,
|
hir_ty: &hir::Ty<'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
) -> Vec<(Ty<'tcx>, Span)> {
|
) -> Vec<(Ty<'tcx>, Span)> {
|
||||||
struct FnPtrFinder<'parent, 'a, 'tcx> {
|
struct FnPtrFinder<'a, 'b, 'tcx> {
|
||||||
visitor: &'parent ImproperCTypesVisitor<'a, 'tcx>,
|
visitor: &'a ImproperCTypesVisitor<'b, 'tcx>,
|
||||||
spans: Vec<Span>,
|
spans: Vec<Span>,
|
||||||
tys: Vec<Ty<'tcx>>,
|
tys: Vec<Ty<'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'parent, 'a, 'tcx> hir::intravisit::Visitor<'_> for FnPtrFinder<'parent, 'a, 'tcx> {
|
impl<'a, 'b, 'tcx> hir::intravisit::Visitor<'_> for FnPtrFinder<'a, 'b, 'tcx> {
|
||||||
fn visit_ty(&mut self, ty: &'_ hir::Ty<'_>) {
|
fn visit_ty(&mut self, ty: &'_ hir::Ty<'_>) {
|
||||||
debug!(?ty);
|
debug!(?ty);
|
||||||
if let hir::TyKind::BareFn(hir::BareFnTy { abi, .. }) = ty.kind
|
if let hir::TyKind::BareFn(hir::BareFnTy { abi, .. }) = ty.kind
|
||||||
@ -1732,7 +1732,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'vis, 'a, 'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for FnPtrFinder<'vis, 'a, 'tcx> {
|
impl<'a, 'b, 'tcx> ty::visit::TypeVisitor<TyCtxt<'tcx>> for FnPtrFinder<'a, 'b, 'tcx> {
|
||||||
type Result = ControlFlow<Ty<'tcx>>;
|
type Result = ControlFlow<Ty<'tcx>>;
|
||||||
|
|
||||||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result {
|
fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result {
|
||||||
@ -1746,7 +1746,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut visitor = FnPtrFinder { visitor: &*self, spans: Vec::new(), tys: Vec::new() };
|
let mut visitor = FnPtrFinder { visitor: self, spans: Vec::new(), tys: Vec::new() };
|
||||||
ty.visit_with(&mut visitor);
|
ty.visit_with(&mut visitor);
|
||||||
hir::intravisit::Visitor::visit_ty(&mut visitor, hir_ty);
|
hir::intravisit::Visitor::visit_ty(&mut visitor, hir_ty);
|
||||||
|
|
||||||
|
@ -134,13 +134,12 @@ fn parse_attribute(attr: &Attribute) -> MirPhase {
|
|||||||
MirPhase::parse(dialect, phase)
|
MirPhase::parse(dialect, phase)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ParseCtxt<'tcx, 'body> {
|
struct ParseCtxt<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ParamEnv<'tcx>,
|
param_env: ParamEnv<'tcx>,
|
||||||
thir: &'body Thir<'tcx>,
|
thir: &'a Thir<'tcx>,
|
||||||
source_scope: SourceScope,
|
source_scope: SourceScope,
|
||||||
|
body: &'a mut Body<'tcx>,
|
||||||
body: &'body mut Body<'tcx>,
|
|
||||||
local_map: FxHashMap<LocalVarId, Local>,
|
local_map: FxHashMap<LocalVarId, Local>,
|
||||||
block_map: FxHashMap<LocalVarId, BasicBlock>,
|
block_map: FxHashMap<LocalVarId, BasicBlock>,
|
||||||
}
|
}
|
||||||
@ -151,7 +150,7 @@ struct ParseError {
|
|||||||
expected: String,
|
expected: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
|
||||||
fn expr_error(&self, expr: ExprId, expected: &'static str) -> ParseError {
|
fn expr_error(&self, expr: ExprId, expected: &'static str) -> ParseError {
|
||||||
let expr = &self.thir[expr];
|
let expr = &self.thir[expr];
|
||||||
ParseError {
|
ParseError {
|
||||||
|
@ -68,7 +68,7 @@ macro_rules! parse_by_kind {
|
|||||||
}
|
}
|
||||||
pub(crate) use parse_by_kind;
|
pub(crate) use parse_by_kind;
|
||||||
|
|
||||||
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
|
||||||
/// Expressions should only ever be matched on after preparsing them. This removes extra scopes
|
/// Expressions should only ever be matched on after preparsing them. This removes extra scopes
|
||||||
/// we don't care about.
|
/// we don't care about.
|
||||||
fn preparse(&self, expr_id: ExprId) -> ExprId {
|
fn preparse(&self, expr_id: ExprId) -> ExprId {
|
||||||
|
@ -12,7 +12,7 @@ use super::{parse_by_kind, PResult, ParseCtxt};
|
|||||||
use crate::build::custom::ParseError;
|
use crate::build::custom::ParseError;
|
||||||
use crate::build::expr::as_constant::as_constant_inner;
|
use crate::build::expr::as_constant::as_constant_inner;
|
||||||
|
|
||||||
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
|
||||||
pub(crate) fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
|
pub(crate) fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
|
||||||
parse_by_kind!(self, expr_id, _, "statement",
|
parse_by_kind!(self, expr_id, _, "statement",
|
||||||
@call(mir_storage_live, args) => {
|
@call(mir_storage_live, args) => {
|
||||||
|
@ -18,7 +18,7 @@ impl<'a> MaybeStorageLive<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> crate::AnalysisDomain<'tcx> for MaybeStorageLive<'a> {
|
impl<'a, 'tcx> crate::AnalysisDomain<'tcx> for MaybeStorageLive<'a> {
|
||||||
type Domain = BitSet<Local>;
|
type Domain = BitSet<Local>;
|
||||||
|
|
||||||
const NAME: &'static str = "maybe_storage_live";
|
const NAME: &'static str = "maybe_storage_live";
|
||||||
@ -40,7 +40,7 @@ impl<'tcx, 'a> crate::AnalysisDomain<'tcx> for MaybeStorageLive<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> crate::GenKillAnalysis<'tcx> for MaybeStorageLive<'a> {
|
impl<'a, 'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageLive<'a> {
|
||||||
type Idx = Local;
|
type Idx = Local;
|
||||||
|
|
||||||
fn domain_size(&self, body: &Body<'tcx>) -> usize {
|
fn domain_size(&self, body: &Body<'tcx>) -> usize {
|
||||||
@ -91,7 +91,7 @@ impl<'a> MaybeStorageDead<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> crate::AnalysisDomain<'tcx> for MaybeStorageDead<'a> {
|
impl<'a, 'tcx> crate::AnalysisDomain<'tcx> for MaybeStorageDead<'a> {
|
||||||
type Domain = BitSet<Local>;
|
type Domain = BitSet<Local>;
|
||||||
|
|
||||||
const NAME: &'static str = "maybe_storage_dead";
|
const NAME: &'static str = "maybe_storage_dead";
|
||||||
@ -112,7 +112,7 @@ impl<'tcx, 'a> crate::AnalysisDomain<'tcx> for MaybeStorageDead<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> crate::GenKillAnalysis<'tcx> for MaybeStorageDead<'a> {
|
impl<'a, 'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageDead<'a> {
|
||||||
type Idx = Local;
|
type Idx = Local;
|
||||||
|
|
||||||
fn domain_size(&self, body: &Body<'tcx>) -> usize {
|
fn domain_size(&self, body: &Body<'tcx>) -> usize {
|
||||||
|
@ -62,14 +62,14 @@ impl<'tcx> crate::MirPass<'tcx> for CheckAlignment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PointerFinder<'tcx, 'a> {
|
struct PointerFinder<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
local_decls: &'a mut LocalDecls<'tcx>,
|
local_decls: &'a mut LocalDecls<'tcx>,
|
||||||
param_env: ParamEnv<'tcx>,
|
param_env: ParamEnv<'tcx>,
|
||||||
pointers: Vec<(Place<'tcx>, Ty<'tcx>)>,
|
pointers: Vec<(Place<'tcx>, Ty<'tcx>)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> Visitor<'tcx> for PointerFinder<'tcx, 'a> {
|
impl<'a, 'tcx> Visitor<'tcx> for PointerFinder<'a, 'tcx> {
|
||||||
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
|
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
|
||||||
// We want to only check reads and writes to Places, so we specifically exclude
|
// We want to only check reads and writes to Places, so we specifically exclude
|
||||||
// Borrow and RawBorrow.
|
// Borrow and RawBorrow.
|
||||||
|
@ -554,13 +554,13 @@ impl<'tcx> Patch<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Collector<'tcx, 'locals> {
|
struct Collector<'a, 'tcx> {
|
||||||
patch: Patch<'tcx>,
|
patch: Patch<'tcx>,
|
||||||
local_decls: &'locals LocalDecls<'tcx>,
|
local_decls: &'a LocalDecls<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'locals> Collector<'tcx, 'locals> {
|
impl<'a, 'tcx> Collector<'a, 'tcx> {
|
||||||
pub(crate) fn new(tcx: TyCtxt<'tcx>, local_decls: &'locals LocalDecls<'tcx>) -> Self {
|
pub(crate) fn new(tcx: TyCtxt<'tcx>, local_decls: &'a LocalDecls<'tcx>) -> Self {
|
||||||
Self { patch: Patch::new(tcx), local_decls }
|
Self { patch: Patch::new(tcx), local_decls }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,7 +722,7 @@ fn try_write_constant<'tcx>(
|
|||||||
|
|
||||||
impl<'mir, 'tcx>
|
impl<'mir, 'tcx>
|
||||||
ResultsVisitor<'mir, 'tcx, Results<'tcx, ValueAnalysisWrapper<ConstAnalysis<'_, 'tcx>>>>
|
ResultsVisitor<'mir, 'tcx, Results<'tcx, ValueAnalysisWrapper<ConstAnalysis<'_, 'tcx>>>>
|
||||||
for Collector<'tcx, '_>
|
for Collector<'_, 'tcx>
|
||||||
{
|
{
|
||||||
type FlowState = State<FlatSet<Scalar>>;
|
type FlowState = State<FlatSet<Scalar>>;
|
||||||
|
|
||||||
@ -839,9 +839,9 @@ impl<'tcx> MutVisitor<'tcx> for Patch<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OperandCollector<'a, 'locals, 'tcx> {
|
struct OperandCollector<'a, 'b, 'tcx> {
|
||||||
state: &'a State<FlatSet<Scalar>>,
|
state: &'a State<FlatSet<Scalar>>,
|
||||||
visitor: &'a mut Collector<'tcx, 'locals>,
|
visitor: &'a mut Collector<'b, 'tcx>,
|
||||||
ecx: &'a mut InterpCx<'tcx, DummyMachine>,
|
ecx: &'a mut InterpCx<'tcx, DummyMachine>,
|
||||||
map: &'a Map<'tcx>,
|
map: &'a Map<'tcx>,
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ fn find_duplicates(body: &Body<'_>) -> FxHashMap<BasicBlock, BasicBlock> {
|
|||||||
duplicates
|
duplicates
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BasicBlockHashable<'tcx, 'a> {
|
struct BasicBlockHashable<'a, 'tcx> {
|
||||||
basic_block_data: &'a BasicBlockData<'tcx>,
|
basic_block_data: &'a BasicBlockData<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ pub(super) fn build_projection<'tcx>(
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ElaborateBoxDerefVisitor<'tcx, 'a> {
|
struct ElaborateBoxDerefVisitor<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
unique_did: DefId,
|
unique_did: DefId,
|
||||||
nonnull_did: DefId,
|
nonnull_did: DefId,
|
||||||
@ -46,7 +46,7 @@ struct ElaborateBoxDerefVisitor<'tcx, 'a> {
|
|||||||
patch: MirPatch<'tcx>,
|
patch: MirPatch<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'tcx, 'a> {
|
impl<'a, 'tcx> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'a, 'tcx> {
|
||||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||||
self.tcx
|
self.tcx
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ pub(crate) struct FnItemRef {
|
|||||||
pub ident: String,
|
pub ident: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct MustNotSupend<'tcx, 'a> {
|
pub(crate) struct MustNotSupend<'a, 'tcx> {
|
||||||
pub tcx: TyCtxt<'tcx>,
|
pub tcx: TyCtxt<'tcx>,
|
||||||
pub yield_sp: Span,
|
pub yield_sp: Span,
|
||||||
pub reason: Option<MustNotSuspendReason>,
|
pub reason: Option<MustNotSuspendReason>,
|
||||||
|
@ -63,13 +63,13 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InstSimplifyContext<'tcx, 'a> {
|
struct InstSimplifyContext<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
local_decls: &'a LocalDecls<'tcx>,
|
local_decls: &'a LocalDecls<'tcx>,
|
||||||
param_env: ParamEnv<'tcx>,
|
param_env: ParamEnv<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
impl<'tcx> InstSimplifyContext<'_, 'tcx> {
|
||||||
fn should_simplify(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool {
|
fn should_simplify(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool {
|
||||||
self.should_simplify_custom(source_info, "Rvalue", rvalue)
|
self.should_simplify_custom(source_info, "Rvalue", rvalue)
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ struct ThreadingOpportunity {
|
|||||||
target: BasicBlock,
|
target: BasicBlock,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TOFinder<'tcx, 'a> {
|
struct TOFinder<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
ecx: InterpCx<'tcx, DummyMachine>,
|
ecx: InterpCx<'tcx, DummyMachine>,
|
||||||
@ -183,7 +183,7 @@ impl<'a> ConditionSet<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> TOFinder<'tcx, 'a> {
|
impl<'a, 'tcx> TOFinder<'a, 'tcx> {
|
||||||
fn is_empty(&self, state: &State<ConditionSet<'a>>) -> bool {
|
fn is_empty(&self, state: &State<ConditionSet<'a>>) -> bool {
|
||||||
state.all_bottom()
|
state.all_bottom()
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ struct SimplifyToExp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
enum ExpectedTransformKind<'tcx, 'a> {
|
enum ExpectedTransformKind<'a, 'tcx> {
|
||||||
/// Identical statements.
|
/// Identical statements.
|
||||||
Same(&'a StatementKind<'tcx>),
|
Same(&'a StatementKind<'tcx>),
|
||||||
/// Assignment statements have the same value.
|
/// Assignment statements have the same value.
|
||||||
|
@ -235,7 +235,7 @@ impl SsaLocals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SsaVisitor<'tcx, 'a> {
|
struct SsaVisitor<'a, 'tcx> {
|
||||||
body: &'a Body<'tcx>,
|
body: &'a Body<'tcx>,
|
||||||
dominators: &'a Dominators<BasicBlock>,
|
dominators: &'a Dominators<BasicBlock>,
|
||||||
assignments: IndexVec<Local, Set1<DefLocation>>,
|
assignments: IndexVec<Local, Set1<DefLocation>>,
|
||||||
@ -261,7 +261,7 @@ impl SsaVisitor<'_, '_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Visitor<'tcx> for SsaVisitor<'tcx, '_> {
|
impl<'tcx> Visitor<'tcx> for SsaVisitor<'_, 'tcx> {
|
||||||
fn visit_local(&mut self, local: Local, ctxt: PlaceContext, loc: Location) {
|
fn visit_local(&mut self, local: Local, ctxt: PlaceContext, loc: Location) {
|
||||||
match ctxt {
|
match ctxt {
|
||||||
PlaceContext::MutatingUse(MutatingUseContext::Projection)
|
PlaceContext::MutatingUse(MutatingUseContext::Projection)
|
||||||
|
@ -852,12 +852,12 @@ impl<'tcx> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx>
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Visitor, used for EffectiveVisibilities table checking
|
/// Visitor, used for EffectiveVisibilities table checking
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
pub struct TestReachabilityVisitor<'tcx, 'a> {
|
pub struct TestReachabilityVisitor<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
effective_visibilities: &'a EffectiveVisibilities,
|
effective_visibilities: &'a EffectiveVisibilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> TestReachabilityVisitor<'tcx, 'a> {
|
impl<'a, 'tcx> TestReachabilityVisitor<'a, 'tcx> {
|
||||||
fn effective_visibility_diagnostic(&mut self, def_id: LocalDefId) {
|
fn effective_visibility_diagnostic(&mut self, def_id: LocalDefId) {
|
||||||
if self.tcx.has_attr(def_id, sym::rustc_effective_visibility) {
|
if self.tcx.has_attr(def_id, sym::rustc_effective_visibility) {
|
||||||
let mut error_msg = String::new();
|
let mut error_msg = String::new();
|
||||||
@ -878,7 +878,7 @@ impl<'tcx, 'a> TestReachabilityVisitor<'tcx, 'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx, 'a> Visitor<'tcx> for TestReachabilityVisitor<'tcx, 'a> {
|
impl<'a, 'tcx> Visitor<'tcx> for TestReachabilityVisitor<'a, 'tcx> {
|
||||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||||
self.effective_visibility_diagnostic(item.owner_id.def_id);
|
self.effective_visibility_diagnostic(item.owner_id.def_id);
|
||||||
|
|
||||||
@ -1425,12 +1425,12 @@ impl<'tcx> DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PrivateItemsInPublicInterfacesChecker<'tcx, 'a> {
|
struct PrivateItemsInPublicInterfacesChecker<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
effective_visibilities: &'a EffectiveVisibilities,
|
effective_visibilities: &'a EffectiveVisibilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> PrivateItemsInPublicInterfacesChecker<'tcx, '_> {
|
impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> {
|
||||||
fn check(
|
fn check(
|
||||||
&self,
|
&self,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
|
@ -19,18 +19,18 @@ impl QueryKeyStringCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QueryKeyStringBuilder<'p, 'tcx> {
|
struct QueryKeyStringBuilder<'a, 'tcx> {
|
||||||
profiler: &'p SelfProfiler,
|
profiler: &'a SelfProfiler,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
string_cache: &'p mut QueryKeyStringCache,
|
string_cache: &'a mut QueryKeyStringCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'p, 'tcx> QueryKeyStringBuilder<'p, 'tcx> {
|
impl<'a, 'tcx> QueryKeyStringBuilder<'a, 'tcx> {
|
||||||
fn new(
|
fn new(
|
||||||
profiler: &'p SelfProfiler,
|
profiler: &'a SelfProfiler,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
string_cache: &'p mut QueryKeyStringCache,
|
string_cache: &'a mut QueryKeyStringCache,
|
||||||
) -> QueryKeyStringBuilder<'p, 'tcx> {
|
) -> QueryKeyStringBuilder<'a, 'tcx> {
|
||||||
QueryKeyStringBuilder { profiler, tcx, string_cache }
|
QueryKeyStringBuilder { profiler, tcx, string_cache }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,14 +842,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||||||
lifetime: Region<'tcx>,
|
lifetime: Region<'tcx>,
|
||||||
add_lt_suggs: &mut Vec<(Span, String)>,
|
add_lt_suggs: &mut Vec<(Span, String)>,
|
||||||
) -> String {
|
) -> String {
|
||||||
struct LifetimeReplaceVisitor<'tcx, 'a> {
|
struct LifetimeReplaceVisitor<'a, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
needle: hir::LifetimeName,
|
needle: hir::LifetimeName,
|
||||||
new_lt: &'a str,
|
new_lt: &'a str,
|
||||||
add_lt_suggs: &'a mut Vec<(Span, String)>,
|
add_lt_suggs: &'a mut Vec<(Span, String)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'hir, 'tcx> hir::intravisit::Visitor<'hir> for LifetimeReplaceVisitor<'tcx, '_> {
|
impl<'hir, 'tcx> hir::intravisit::Visitor<'hir> for LifetimeReplaceVisitor<'_, 'tcx> {
|
||||||
fn visit_lifetime(&mut self, lt: &'hir hir::Lifetime) {
|
fn visit_lifetime(&mut self, lt: &'hir hir::Lifetime) {
|
||||||
if lt.res == self.needle {
|
if lt.res == self.needle {
|
||||||
self.add_lt_suggs.push(lt.suggestion(self.new_lt));
|
self.add_lt_suggs.push(lt.suggestion(self.new_lt));
|
||||||
|
@ -61,9 +61,9 @@ pub enum CoroutineInteriorOrUpvar {
|
|||||||
// This type provides a uniform interface to retrieve data on coroutines, whether it originated from
|
// This type provides a uniform interface to retrieve data on coroutines, whether it originated from
|
||||||
// the local crate being compiled or from a foreign crate.
|
// the local crate being compiled or from a foreign crate.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct CoroutineData<'tcx, 'a>(&'a TypeckResults<'tcx>);
|
struct CoroutineData<'a, 'tcx>(&'a TypeckResults<'tcx>);
|
||||||
|
|
||||||
impl<'tcx, 'a> CoroutineData<'tcx, 'a> {
|
impl<'a, 'tcx> CoroutineData<'a, 'tcx> {
|
||||||
/// Try to get information about variables captured by the coroutine that matches a type we are
|
/// Try to get information about variables captured by the coroutine that matches a type we are
|
||||||
/// looking for with `ty_matches` function. We uses it to find upvar which causes a failure to
|
/// looking for with `ty_matches` function. We uses it to find upvar which causes a failure to
|
||||||
/// meet an obligation
|
/// meet an obligation
|
||||||
|
@ -25,7 +25,7 @@ use crate::traits::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[extension(pub trait QueryNormalizeExt<'tcx>)]
|
#[extension(pub trait QueryNormalizeExt<'tcx>)]
|
||||||
impl<'cx, 'tcx> At<'cx, 'tcx> {
|
impl<'a, 'tcx> At<'a, 'tcx> {
|
||||||
/// Normalize `value` in the context of the inference context,
|
/// Normalize `value` in the context of the inference context,
|
||||||
/// yielding a resulting type, or an error if `value` cannot be
|
/// yielding a resulting type, or an error if `value` cannot be
|
||||||
/// normalized. If you don't care about regions, you should prefer
|
/// normalized. If you don't care about regions, you should prefer
|
||||||
@ -160,9 +160,9 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for MaxEscapingBoundVarVisitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QueryNormalizer<'cx, 'tcx> {
|
struct QueryNormalizer<'a, 'tcx> {
|
||||||
infcx: &'cx InferCtxt<'tcx>,
|
infcx: &'a InferCtxt<'tcx>,
|
||||||
cause: &'cx ObligationCause<'tcx>,
|
cause: &'a ObligationCause<'tcx>,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
obligations: Vec<PredicateObligation<'tcx>>,
|
obligations: Vec<PredicateObligation<'tcx>>,
|
||||||
cache: SsoHashMap<Ty<'tcx>, Ty<'tcx>>,
|
cache: SsoHashMap<Ty<'tcx>, Ty<'tcx>>,
|
||||||
@ -170,7 +170,7 @@ struct QueryNormalizer<'cx, 'tcx> {
|
|||||||
universes: Vec<Option<ty::UniverseIndex>>,
|
universes: Vec<Option<ty::UniverseIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx> {
|
impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'a, 'tcx> {
|
||||||
type Error = NoSolution;
|
type Error = NoSolution;
|
||||||
|
|
||||||
fn cx(&self) -> TyCtxt<'tcx> {
|
fn cx(&self) -> TyCtxt<'tcx> {
|
||||||
|
@ -332,8 +332,8 @@ pub fn with_replaced_escaping_bound_vars<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BoundVarReplacer<'me, 'tcx> {
|
pub struct BoundVarReplacer<'a, 'tcx> {
|
||||||
infcx: &'me InferCtxt<'tcx>,
|
infcx: &'a InferCtxt<'tcx>,
|
||||||
// These three maps track the bound variable that were replaced by placeholders. It might be
|
// These three maps track the bound variable that were replaced by placeholders. It might be
|
||||||
// nice to remove these since we already have the `kind` in the placeholder; we really just need
|
// nice to remove these since we already have the `kind` in the placeholder; we really just need
|
||||||
// the `var` (but we *could* bring that into scope if we were to track them as we pass them).
|
// the `var` (but we *could* bring that into scope if we were to track them as we pass them).
|
||||||
@ -345,15 +345,15 @@ pub struct BoundVarReplacer<'me, 'tcx> {
|
|||||||
current_index: ty::DebruijnIndex,
|
current_index: ty::DebruijnIndex,
|
||||||
// The `UniverseIndex` of the binding levels above us. These are optional, since we are lazy:
|
// The `UniverseIndex` of the binding levels above us. These are optional, since we are lazy:
|
||||||
// we don't actually create a universe until we see a bound var we have to replace.
|
// we don't actually create a universe until we see a bound var we have to replace.
|
||||||
universe_indices: &'me mut Vec<Option<ty::UniverseIndex>>,
|
universe_indices: &'a mut Vec<Option<ty::UniverseIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
|
impl<'a, 'tcx> BoundVarReplacer<'a, 'tcx> {
|
||||||
/// Returns `Some` if we *were* able to replace bound vars. If there are any bound vars that
|
/// Returns `Some` if we *were* able to replace bound vars. If there are any bound vars that
|
||||||
/// use a binding level above `universe_indices.len()`, we fail.
|
/// use a binding level above `universe_indices.len()`, we fail.
|
||||||
pub fn replace_bound_vars<T: TypeFoldable<TyCtxt<'tcx>>>(
|
pub fn replace_bound_vars<T: TypeFoldable<TyCtxt<'tcx>>>(
|
||||||
infcx: &'me InferCtxt<'tcx>,
|
infcx: &'a InferCtxt<'tcx>,
|
||||||
universe_indices: &'me mut Vec<Option<ty::UniverseIndex>>,
|
universe_indices: &'a mut Vec<Option<ty::UniverseIndex>>,
|
||||||
value: T,
|
value: T,
|
||||||
) -> (
|
) -> (
|
||||||
T,
|
T,
|
||||||
@ -479,22 +479,22 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The inverse of [`BoundVarReplacer`]: replaces placeholders with the bound vars from which they came.
|
/// The inverse of [`BoundVarReplacer`]: replaces placeholders with the bound vars from which they came.
|
||||||
pub struct PlaceholderReplacer<'me, 'tcx> {
|
pub struct PlaceholderReplacer<'a, 'tcx> {
|
||||||
infcx: &'me InferCtxt<'tcx>,
|
infcx: &'a InferCtxt<'tcx>,
|
||||||
mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
|
mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
|
||||||
mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
|
mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
|
||||||
mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
|
mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
|
||||||
universe_indices: &'me [Option<ty::UniverseIndex>],
|
universe_indices: &'a [Option<ty::UniverseIndex>],
|
||||||
current_index: ty::DebruijnIndex,
|
current_index: ty::DebruijnIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
|
impl<'a, 'tcx> PlaceholderReplacer<'a, 'tcx> {
|
||||||
pub fn replace_placeholders<T: TypeFoldable<TyCtxt<'tcx>>>(
|
pub fn replace_placeholders<T: TypeFoldable<TyCtxt<'tcx>>>(
|
||||||
infcx: &'me InferCtxt<'tcx>,
|
infcx: &'a InferCtxt<'tcx>,
|
||||||
mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
|
mapped_regions: FxIndexMap<ty::PlaceholderRegion, ty::BoundRegion>,
|
||||||
mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
|
mapped_types: FxIndexMap<ty::PlaceholderType, ty::BoundTy>,
|
||||||
mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
|
mapped_consts: BTreeMap<ty::PlaceholderConst, ty::BoundVar>,
|
||||||
universe_indices: &'me [Option<ty::UniverseIndex>],
|
universe_indices: &'a [Option<ty::UniverseIndex>],
|
||||||
value: T,
|
value: T,
|
||||||
) -> T {
|
) -> T {
|
||||||
let mut replacer = PlaceholderReplacer {
|
let mut replacer = PlaceholderReplacer {
|
||||||
|
@ -28,7 +28,7 @@ pub(super) fn sanity_check_layout<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Yields non-ZST fields of the type
|
/// Yields non-ZST fields of the type
|
||||||
fn non_zst_fields<'tcx, 'a>(
|
fn non_zst_fields<'a, 'tcx>(
|
||||||
cx: &'a LayoutCx<'tcx, TyCtxt<'tcx>>,
|
cx: &'a LayoutCx<'tcx, TyCtxt<'tcx>>,
|
||||||
layout: &'a TyAndLayout<'tcx>,
|
layout: &'a TyAndLayout<'tcx>,
|
||||||
) -> impl Iterator<Item = (Size, TyAndLayout<'tcx>)> + 'a {
|
) -> impl Iterator<Item = (Size, TyAndLayout<'tcx>)> + 'a {
|
||||||
|
@ -847,7 +847,7 @@ enum SimplifiedParam {
|
|||||||
///
|
///
|
||||||
/// This function also works recursively.
|
/// This function also works recursively.
|
||||||
#[instrument(level = "trace", skip(tcx, res, rgen, cache))]
|
#[instrument(level = "trace", skip(tcx, res, rgen, cache))]
|
||||||
fn simplify_fn_type<'tcx, 'a>(
|
fn simplify_fn_type<'a, 'tcx>(
|
||||||
self_: Option<&'a Type>,
|
self_: Option<&'a Type>,
|
||||||
generics: &Generics,
|
generics: &Generics,
|
||||||
arg: &'a Type,
|
arg: &'a Type,
|
||||||
@ -1192,7 +1192,7 @@ fn simplify_fn_type<'tcx, 'a>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn simplify_fn_constraint<'tcx, 'a>(
|
fn simplify_fn_constraint<'a, 'tcx>(
|
||||||
self_: Option<&'a Type>,
|
self_: Option<&'a Type>,
|
||||||
generics: &Generics,
|
generics: &Generics,
|
||||||
constraint: &'a clean::AssocItemConstraint,
|
constraint: &'a clean::AssocItemConstraint,
|
||||||
|
Loading…
Reference in New Issue
Block a user