rustc: reintroduce lifetime bounds where necessary.
This commit is contained in:
parent
356a37d8d1
commit
4c4fc7512e
15 changed files with 36 additions and 30 deletions
|
@ -41,7 +41,7 @@ pub trait LatticeDir<'f, 'tcx>: TypeRelation<'tcx> {
|
|||
fn relate_bound(&mut self, v: Ty<'tcx>, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, ()>;
|
||||
}
|
||||
|
||||
pub fn super_lattice_tys<'a, 'tcx, L>(
|
||||
pub fn super_lattice_tys<'a, 'tcx: 'a, L>(
|
||||
this: &mut L,
|
||||
a: Ty<'tcx>,
|
||||
b: Ty<'tcx>,
|
||||
|
|
|
@ -3788,9 +3788,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
matcher.relate(previous, current).is_ok()
|
||||
}
|
||||
|
||||
fn push_stack<'o, 's>(
|
||||
fn push_stack<'o>(
|
||||
&mut self,
|
||||
previous_stack: TraitObligationStackList<'s, 'tcx>,
|
||||
previous_stack: TraitObligationStackList<'o, 'tcx>,
|
||||
obligation: &'o TraitObligation<'tcx>,
|
||||
) -> TraitObligationStack<'o, 'tcx> {
|
||||
let fresh_trait_ref = obligation
|
||||
|
|
|
@ -366,7 +366,7 @@ pub fn memcpy_ty<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
|||
bx.memcpy(dst, dst_align, src, src_align, bx.cx().const_usize(size), flags);
|
||||
}
|
||||
|
||||
pub fn codegen_instance<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
cx: &'a Bx::CodegenCx,
|
||||
instance: Instance<'tcx>,
|
||||
) {
|
||||
|
|
|
@ -17,7 +17,7 @@ pub trait MonoItemExt<'a, 'tcx> {
|
|||
fn to_raw_string(&self) -> String;
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
|
||||
impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
|
||||
fn define<Bx: BuilderMethods<'a, 'tcx>>(&self, cx: &'a Bx::CodegenCx) {
|
||||
debug!("BEGIN IMPLEMENTING '{} ({})' in cgu {}",
|
||||
self.to_string(cx.tcx(), true),
|
||||
|
|
|
@ -289,11 +289,14 @@ impl<'a> CrateLoader<'a> {
|
|||
(cnum, cmeta)
|
||||
}
|
||||
|
||||
fn load_proc_macro<'b> (
|
||||
fn load_proc_macro<'b>(
|
||||
&mut self,
|
||||
locate_ctxt: &mut locator::Context<'b>,
|
||||
path_kind: PathKind,
|
||||
) -> Option<(LoadResult, Option<Library>)> {
|
||||
) -> Option<(LoadResult, Option<Library>)>
|
||||
where
|
||||
'a: 'b,
|
||||
{
|
||||
// Use a new locator Context so trying to load a proc macro doesn't affect the error
|
||||
// message we emit
|
||||
let mut proc_macro_locator = locate_ctxt.clone();
|
||||
|
|
|
@ -38,7 +38,7 @@ use log::debug;
|
|||
pub struct DecodeContext<'a, 'tcx> {
|
||||
opaque: opaque::Decoder<'a>,
|
||||
cdata: Option<&'a CrateMetadata>,
|
||||
sess: Option<&'a Session>,
|
||||
sess: Option<&'tcx Session>,
|
||||
tcx: Option<TyCtxt<'tcx>>,
|
||||
|
||||
// Cache the last used source_file for translating spans as an optimization.
|
||||
|
@ -54,10 +54,8 @@ pub struct DecodeContext<'a, 'tcx> {
|
|||
pub trait Metadata<'a, 'tcx>: Copy {
|
||||
fn raw_bytes(self) -> &'a [u8];
|
||||
fn cdata(self) -> Option<&'a CrateMetadata> { None }
|
||||
fn sess(self) -> Option<&'a Session> { None }
|
||||
fn tcx(self) -> Option<TyCtxt<'tcx>> {
|
||||
None
|
||||
}
|
||||
fn sess(self) -> Option<&'tcx Session> { None }
|
||||
fn tcx(self) -> Option<TyCtxt<'tcx>> { None }
|
||||
|
||||
fn decoder(self, pos: usize) -> DecodeContext<'a, 'tcx> {
|
||||
let tcx = self.tcx();
|
||||
|
@ -82,13 +80,13 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a MetadataBlob {
|
|||
}
|
||||
|
||||
|
||||
impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a MetadataBlob, &'a Session) {
|
||||
impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a MetadataBlob, &'tcx Session) {
|
||||
fn raw_bytes(self) -> &'a [u8] {
|
||||
let (blob, _) = self;
|
||||
&blob.0
|
||||
}
|
||||
|
||||
fn sess(self) -> Option<&'a Session> {
|
||||
fn sess(self) -> Option<&'tcx Session> {
|
||||
let (_, sess) = self;
|
||||
Some(sess)
|
||||
}
|
||||
|
@ -104,14 +102,14 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for &'a CrateMetadata {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, &'a Session) {
|
||||
impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, &'tcx Session) {
|
||||
fn raw_bytes(self) -> &'a [u8] {
|
||||
self.0.raw_bytes()
|
||||
}
|
||||
fn cdata(self) -> Option<&'a CrateMetadata> {
|
||||
Some(self.0)
|
||||
}
|
||||
fn sess(self) -> Option<&'a Session> {
|
||||
fn sess(self) -> Option<&'tcx Session> {
|
||||
Some(&self.1)
|
||||
}
|
||||
}
|
||||
|
@ -136,11 +134,11 @@ impl<'a, 'tcx, T: Decodable> Lazy<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, T: Decodable> LazySeq<T> {
|
||||
impl<'a: 'x, 'tcx: 'x, 'x, T: Decodable> LazySeq<T> {
|
||||
pub fn decode<M: Metadata<'a, 'tcx>>(
|
||||
self,
|
||||
meta: M,
|
||||
) -> impl Iterator<Item = T> + Captures<'tcx> + 'a {
|
||||
) -> impl Iterator<Item = T> + Captures<'a> + Captures<'tcx> + 'x {
|
||||
let mut dcx = meta.decoder(self.position);
|
||||
dcx.lazy_state = LazyState::NodeStart(self.position);
|
||||
(0..self.len).map(move |_| T::decode(&mut dcx).unwrap())
|
||||
|
|
|
@ -1693,7 +1693,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
fn move_path_closest_to<'a>(
|
||||
&mut self,
|
||||
place: &'a Place<'tcx>,
|
||||
) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> {
|
||||
) -> Result<(&'a Place<'tcx>, MovePathIndex), NoMovePathFound> where 'cx: 'a {
|
||||
let mut last_prefix = place;
|
||||
for prefix in self.prefixes(place, PrefixSet::All) {
|
||||
if let Some(mpi) = self.move_path_for_place(prefix) {
|
||||
|
|
|
@ -1691,7 +1691,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
&mut self,
|
||||
block: BasicBlock,
|
||||
bindings: impl IntoIterator<Item = &'b Binding<'tcx>>,
|
||||
) {
|
||||
) where 'tcx: 'b {
|
||||
debug!("bind_matched_candidate_for_arm_body(block={:?})", block);
|
||||
|
||||
let re_erased = self.hir.tcx().lifetimes.re_erased;
|
||||
|
|
|
@ -297,7 +297,7 @@ impl<'a, 'tcx, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx>
|
|||
/// underlying flow analysis results, because it needs to handle cases
|
||||
/// where we are combining the results of *multiple* flow analyses
|
||||
/// (e.g., borrows + inits + uninits).
|
||||
pub(crate) trait DataflowResultsConsumer<'a, 'tcx> {
|
||||
pub(crate) trait DataflowResultsConsumer<'a, 'tcx: 'a> {
|
||||
type FlowState: FlowsAtLocation;
|
||||
|
||||
// Observation Hooks: override (at least one of) these to get analysis feedback.
|
||||
|
|
|
@ -709,7 +709,8 @@ fn all_constructors<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
|||
fn max_slice_length<'p, 'a, 'tcx, I>(
|
||||
cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
||||
patterns: I) -> u64
|
||||
where I: Iterator<Item=&'p Pattern<'tcx>>
|
||||
where I: Iterator<Item=&'p Pattern<'tcx>>,
|
||||
'tcx: 'p,
|
||||
{
|
||||
// The exhaustiveness-checking paper does not include any details on
|
||||
// checking variable-length slice patterns. However, they are matched
|
||||
|
@ -1709,7 +1710,7 @@ fn patterns_for_variant<'p, 'tcx>(
|
|||
/// different patterns.
|
||||
/// Structure patterns with a partial wild pattern (Foo { a: 42, .. }) have their missing
|
||||
/// fields filled with wild patterns.
|
||||
fn specialize<'p, 'a, 'tcx>(
|
||||
fn specialize<'p, 'a: 'p, 'tcx>(
|
||||
cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
||||
r: &[&'p Pattern<'tcx>],
|
||||
constructor: &Constructor<'tcx>,
|
||||
|
|
|
@ -122,7 +122,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Value<'mir, 'tcx, M> for MPlaceTy<'tcx,
|
|||
macro_rules! make_value_visitor {
|
||||
($visitor_trait_name:ident, $($mutability:ident)?) => {
|
||||
// How to traverse a value and what to do when we are at the leaves.
|
||||
pub trait $visitor_trait_name<'mir, 'tcx, M: Machine<'mir, 'tcx>>: Sized {
|
||||
pub trait $visitor_trait_name<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized {
|
||||
type V: Value<'mir, 'tcx, M>;
|
||||
|
||||
/// The visitor must have an `InterpretCx` in it.
|
||||
|
|
|
@ -766,9 +766,10 @@ fn numbered_codegen_unit_name(
|
|||
name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index))
|
||||
}
|
||||
|
||||
fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx>, label: &str, cgus: I)
|
||||
fn debug_dump<'a, 'tcx, I>(tcx: TyCtxt<'tcx>, label: &str, cgus: I)
|
||||
where
|
||||
I: Iterator<Item = &'b CodegenUnit<'tcx>>,
|
||||
I: Iterator<Item = &'a CodegenUnit<'tcx>>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
if cfg!(debug_assertions) {
|
||||
debug!("{}", label);
|
||||
|
@ -796,6 +797,7 @@ where
|
|||
fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'tcx>, mono_items: I)
|
||||
where
|
||||
I: Iterator<Item = &'a MonoItem<'tcx>>,
|
||||
'tcx: 'a,
|
||||
{
|
||||
let mut symbols: Vec<_> = mono_items.map(|mono_item| {
|
||||
(mono_item, mono_item.symbol_name(tcx))
|
||||
|
|
|
@ -111,7 +111,8 @@ pub fn elaborate_drop<'b, 'tcx, D>(
|
|||
succ: BasicBlock,
|
||||
unwind: Unwind,
|
||||
bb: BasicBlock)
|
||||
where D: DropElaborator<'b, 'tcx>
|
||||
where D: DropElaborator<'b, 'tcx>,
|
||||
'tcx: 'b,
|
||||
{
|
||||
DropCtxt {
|
||||
elaborator, source_info, place, path, succ, unwind
|
||||
|
@ -121,6 +122,7 @@ pub fn elaborate_drop<'b, 'tcx, D>(
|
|||
impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
|
||||
where
|
||||
D: DropElaborator<'b, 'tcx>,
|
||||
'tcx: 'b,
|
||||
{
|
||||
fn place_ty(&self, place: &Place<'tcx>) -> Ty<'tcx> {
|
||||
place.ty(self.elaborator.body(), self.tcx()).ty
|
||||
|
|
|
@ -960,8 +960,8 @@ impl<'l> PathCollector<'l> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'l, 'a> Visitor<'a> for PathCollector<'l> {
|
||||
fn visit_pat(&mut self, p: &'a ast::Pat) {
|
||||
impl<'l> Visitor<'l> for PathCollector<'l> {
|
||||
fn visit_pat(&mut self, p: &'l ast::Pat) {
|
||||
match p.node {
|
||||
PatKind::Struct(ref path, ..) => {
|
||||
self.collected_paths.push((p.id, path));
|
||||
|
|
|
@ -1786,7 +1786,7 @@ fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> hir::ImplPolarity {
|
|||
/// the lifetimes that are declared. For fns or methods, we have to
|
||||
/// screen out those that do not appear in any where-clauses etc using
|
||||
/// `resolve_lifetime::early_bound_lifetimes`.
|
||||
fn early_bound_lifetimes_from_generics<'a, 'tcx>(
|
||||
fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
generics: &'a hir::Generics,
|
||||
) -> impl Iterator<Item = &'a hir::GenericParam> + Captures<'tcx> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue