Suppress unnecessary outlives
This commit is contained in:
parent
9295817bad
commit
1c35634efe
4 changed files with 11 additions and 22 deletions
|
@ -552,8 +552,8 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
|
||||||
for (region_a, region_a_idx) in ®ions {
|
for (region_a, region_a_idx) in ®ions {
|
||||||
// Ignore `'static` lifetimes for the purpose of this lint: it's
|
// Ignore `'static` lifetimes for the purpose of this lint: it's
|
||||||
// because we know it outlives everything and so doesn't give meaningful
|
// because we know it outlives everything and so doesn't give meaningful
|
||||||
// clues
|
// clues. Also ignore `ReError`, to avoid knock-down errors.
|
||||||
if let ty::ReStatic = **region_a {
|
if let ty::ReStatic | ty::ReError(_) = **region_a {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// For each region argument (e.g., `'a` in our example), check for a
|
// For each region argument (e.g., `'a` in our example), check for a
|
||||||
|
@ -596,8 +596,9 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
|
||||||
// on the GAT itself.
|
// on the GAT itself.
|
||||||
for (region_b, region_b_idx) in ®ions {
|
for (region_b, region_b_idx) in ®ions {
|
||||||
// Again, skip `'static` because it outlives everything. Also, we trivially
|
// Again, skip `'static` because it outlives everything. Also, we trivially
|
||||||
// know that a region outlives itself.
|
// know that a region outlives itself. Also ignore `ReError`, to avoid
|
||||||
if ty::ReStatic == **region_b || region_a == region_b {
|
// knock-down errors.
|
||||||
|
if matches!(**region_b, ty::ReStatic | ty::ReError(_)) || region_a == region_b {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if region_known_to_outlive(
|
if region_known_to_outlive(
|
||||||
|
|
|
@ -942,6 +942,10 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
||||||
generic_ty: Ty<'tcx>,
|
generic_ty: Ty<'tcx>,
|
||||||
min: ty::Region<'tcx>,
|
min: ty::Region<'tcx>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
if let ty::ReError(_) = *min {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
match bound {
|
match bound {
|
||||||
VerifyBound::IfEq(verify_if_eq_b) => {
|
VerifyBound::IfEq(verify_if_eq_b) => {
|
||||||
let verify_if_eq_b = var_values.normalize(self.region_rels.tcx, *verify_if_eq_b);
|
let verify_if_eq_b = var_values.normalize(self.region_rels.tcx, *verify_if_eq_b);
|
||||||
|
|
|
@ -7,7 +7,6 @@ trait Iterable {
|
||||||
|
|
||||||
fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
|
fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
|
||||||
//~^ ERROR use of undeclared lifetime name `'missing`
|
//~^ ERROR use of undeclared lifetime name `'missing`
|
||||||
//~| ERROR the parameter type `Self` may not live long enough
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -18,21 +18,6 @@ help: consider introducing lifetime `'missing` here
|
||||||
LL | trait Iterable<'missing> {
|
LL | trait Iterable<'missing> {
|
||||||
| ++++++++++
|
| ++++++++++
|
||||||
|
|
||||||
error[E0311]: the parameter type `Self` may not live long enough
|
error: aborting due to previous error
|
||||||
--> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:37
|
|
||||||
|
|
|
||||||
LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: consider adding an explicit lifetime bound `Self: 'a`...
|
|
||||||
= note: ...so that the type `Self` will meet its required lifetime bounds...
|
|
||||||
note: ...that is required by this bound
|
|
||||||
--> $DIR/missing-lt-outlives-in-rpitit-114274.rs:6:15
|
|
||||||
|
|
|
||||||
LL | Self: 'a;
|
|
||||||
| ^^
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
For more information about this error, try `rustc --explain E0261`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0261, E0311.
|
|
||||||
For more information about an error, try `rustc --explain E0261`.
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue