Make visiting traits generic over the Interner

This commit is contained in:
Alan Egerton 2023-02-09 19:38:07 +00:00
parent e8e9c32af9
commit 340d9e818a
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@
use rustc_index::bit_set::{BitSet, HybridBitSet}; use rustc_index::bit_set::{BitSet, HybridBitSet};
use rustc_lint::LateContext; use rustc_lint::LateContext;
use rustc_middle::mir::{self, visit::Visitor as _, Mutability}; use rustc_middle::mir::{self, visit::Visitor as _, Mutability};
use rustc_middle::ty::{self, visit::ir::TypeVisitor}; use rustc_middle::ty::{self, visit::ir::TypeVisitor, TyCtxt};
use rustc_mir_dataflow::{impls::MaybeStorageLive, Analysis, ResultsCursor}; use rustc_mir_dataflow::{impls::MaybeStorageLive, Analysis, ResultsCursor};
use std::borrow::Cow; use std::borrow::Cow;
use std::ops::ControlFlow; use std::ops::ControlFlow;
@ -136,7 +136,7 @@ fn visit_terminator(&mut self, terminator: &mir::Terminator<'_>, _loc: mir::Loca
struct ContainsRegion; struct ContainsRegion;
impl TypeVisitor<'_> for ContainsRegion { impl TypeVisitor<TyCtxt<'_>> for ContainsRegion {
type BreakTy = (); type BreakTy = ();
fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<Self::BreakTy> { fn visit_region(&mut self, _: ty::Region<'_>) -> ControlFlow<Self::BreakTy> {

View File

@ -838,7 +838,7 @@ struct V<F> {
index: u32, index: u32,
f: F, f: F,
} }
impl<'tcx, B, F: FnMut(BoundRegion) -> ControlFlow<B>> TypeVisitor<'tcx> for V<F> { impl<'tcx, B, F: FnMut(BoundRegion) -> ControlFlow<B>> TypeVisitor<TyCtxt<'tcx>> for V<F> {
type BreakTy = B; type BreakTy = B;
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> { fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
if let RegionKind::ReLateBound(idx, bound) = r.kind() && idx.as_u32() == self.index { if let RegionKind::ReLateBound(idx, bound) = r.kind() && idx.as_u32() == self.index {