Suggest copying trait associated type bounds on lifetime error
This commit is contained in:
@@ -438,6 +438,13 @@ pub enum SubregionOrigin<'tcx> {
|
||||
/// Comparing the signature and requirements of an impl associated type
|
||||
/// against the containing trait
|
||||
CompareImplTypeObligation { span: Span, impl_item_def_id: DefId, trait_item_def_id: DefId },
|
||||
|
||||
/// Checking that the bounds of a trait's associated type hold for a given impl
|
||||
CheckAssociatedTypeBounds {
|
||||
parent: Box<SubregionOrigin<'tcx>>,
|
||||
impl_item_def_id: DefId,
|
||||
trait_item_def_id: DefId,
|
||||
},
|
||||
}
|
||||
|
||||
// `SubregionOrigin` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
@@ -1832,6 +1839,7 @@ impl<'tcx> SubregionOrigin<'tcx> {
|
||||
ReferenceOutlivesReferent(_, a) => a,
|
||||
CompareImplMethodObligation { span, .. } => span,
|
||||
CompareImplTypeObligation { span, .. } => span,
|
||||
CheckAssociatedTypeBounds { ref parent, .. } => parent.span(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1862,6 +1870,15 @@ impl<'tcx> SubregionOrigin<'tcx> {
|
||||
trait_item_def_id,
|
||||
},
|
||||
|
||||
traits::ObligationCauseCode::CheckAssociatedTypeBounds {
|
||||
impl_item_def_id,
|
||||
trait_item_def_id,
|
||||
} => SubregionOrigin::CheckAssociatedTypeBounds {
|
||||
impl_item_def_id,
|
||||
trait_item_def_id,
|
||||
parent: Box::new(default()),
|
||||
},
|
||||
|
||||
_ => default(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user