1
Fork 0

Rollup merge of #98933 - oli-obk:opaque_type_late_bound_lifetimes, r=lcnr

Opaque types' generic params do not imply anything about their hidden type's lifetimes

fixes #97104

cc ```@aliemjay```
This commit is contained in:
Dylan DPC 2022-09-08 20:48:34 +05:30 committed by GitHub
commit d392838b69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 127 additions and 9 deletions

View file

@ -666,7 +666,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
// ignore the inputs to a projection, as they may not appear
// in the normalized form
if self.just_constrained {
if let ty::Projection(..) = t.kind() {
if let ty::Projection(..) | ty::Opaque(..) = t.kind() {
return ControlFlow::CONTINUE;
}
}

View file

@ -2940,8 +2940,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
// though we can easily give a hint that ought to be
// relevant.
err.note(
"lifetimes appearing in an associated type are not considered constrained",
"lifetimes appearing in an associated or opaque type are not considered constrained",
);
err.note("consider introducing a named lifetime parameter");
}
err.emit();