Change:
[ ] Previous Stable [ ] Current Stable [ ] Current Beta [X] Current Nightly No response <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim
This is another case for And except for the missing argument issue, there is an copy-paste bug in :

Discussion:
[true] `{$param_name}` *[false] `fn` parameter } has {$lifetime_kind -> <del> [named] lifetime `{$lifetime}` *[anon] an anonymous lifetime `'_` } but calling `{assoc_item}` introduces an implicit `'static` lifetime requirement </del> <ins> [true] lifetime `{$lifetime}` *[false] an anonymous lifetime `'_` } but calling `{$assoc_item}` introduces an implicit `'static` lifetime requirement </ins> .label1 = {$has_lifetime -> <del> [named] lifetime `{$lifetime}` *[anon] an anonymous lifetime `'_` </del> <ins> [true] lifetime `{$lifetime}` *[false] an anonymous lifetime `'_` </ins> } .label2 = ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the {$has_impl_path -> <del> [named] `impl` of `{$impl_path}` *[anon] inherent `impl` </del> <ins> [true] `impl` of `{$impl_path}` *[false] inherent `impl` </ins> } infer_but_needs_to_satisfy = {$has_param_name -> [true] `{$param_name}` *[false] `fn` parameter } has {$has_lifetime -> <del> [named] lifetime `{$lifetime}` *[anon] an anonymous lifetime `'_` </del> <ins> [true] lifetime `{$lifetime}` *[false] an anonymous lifetime `'_` </ins> } but it needs to satisfy a `'static` lifetime requirement .influencer = this data with {$has_lifetime -> <del> [named] lifetime `{$lifetime}` *[anon] an anonymous lifetime `'_` </del> <ins> [true] lifetime `{$lifetime}` *[false] an anonymous lifetime `'_` </ins> }... .require = {$spans_empty -> *[true] ...is used and required to live as long as `'static` here

[true] `{$param_name}` *[false] `fn` parameter } has {$has_lifetime -> <del> [named] lifetime `{$lifetime}` *[anon] an anonymous lifetime `'_` </del> <ins> [true] lifetime `{$lifetime}` *[false] an anonymous lifetime `'_` </ins> } but calling `{$ident}` introduces an implicit `'static` lifetime requirement infer_ril_introduced_here = `'static` requirement introduced here

#[subdiagnostic] pub req_introduces_loc: Option<ReqIntroducedLocations>, <ins> pub has_param_name: bool, pub param_name: String, </ins> pub spans_empty: bool, pub has_lifetime: bool, pub lifetime: String,

let sp = var_origin.span(); let return_sp = sub_origin.span(); let param = self.find_param_with_region(*sup_r, *sub_r)?; <ins> let simple_ident = param.param.pat.simple_ident(); </ins> let lifetime_name = if sup_r.has_name() { sup_r.to_string() } else { "'_".to_owned() }; let (mention_influencer, influencer_point) =

req_introduces_loc: subdiag, has_lifetime: sup_r.has_name(), <del> lifetime: sup_r.to_string(), </del> <ins> lifetime: lifetime_name.clone(), has_param_name: simple_ident.is_some(), param_name: simple_ident.map(|x| x.to_string()).unwrap_or_default(), </ins> spans_empty, bound, };

<ins> use std::marker::PhantomData; struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) where Foo<'short, 'out, T>: Convert<'a, 'b>; //~^ ERROR mismatched types //~^^ ERROR mismatched types //~^^^ ERROR use of undeclared lifetime name //~| ERROR use of undeclared lifetime name `'out` trait Convert<'a, 'b>: Sized { fn cast(&'a self) -> &'b Self; } impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { //~^ ERROR use of undeclared lifetime name //~^^ ERROR use of undeclared lifetime name `'out` //~| ERROR cannot infer an appropriate lifetime for lifetime parameter fn cast(&'long self) -> &'short Foo<'short, 'out, T> { //~^ ERROR use of undeclared lifetime name //~| ERROR cannot infer an appropriate lifetime for lifetime parameter self } } fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { //~^ ERROR use of undeclared lifetime name //~^^ ERROR incompatible lifetime on type //~| ERROR `x` has lifetime `'in_` but it needs to satisfy a `'static` lifetime requirement sadness.cast() } fn main() {} </ins>

<ins> error[E0261]: use of undeclared lifetime name `'short` --> $DIR/issue-107090.rs:4:9 | LL |     Foo<'short, 'out, T>: Convert<'a, 'b>; |         ^^^^^^ undeclared lifetime | = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html help: consider making the bound lifetime-generic with a new `'short` lifetime | LL |     for<'short> Foo<'short, 'out, T>: Convert<'a, 'b>; |     +++++++++++ help: consider introducing lifetime `'short` here | LL | struct Foo<'short, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) |            +++++++ error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:4:17 | LL |     Foo<'short, 'out, T>: Convert<'a, 'b>; |                 ^^^^ undeclared lifetime | help: consider making the bound lifetime-generic with a new `'out` lifetime | LL |     for<'out> Foo<'short, 'out, T>: Convert<'a, 'b>; |     +++++++++ help: consider introducing lifetime `'out` here | LL | struct Foo<'out, 'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) |            +++++ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/issue-107090.rs:13:47 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { |      -                                        ^^ undeclared lifetime |      | |      help: consider introducing lifetime `'b` here: `'b,` error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:13:67 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { |      - help: consider introducing lifetime `'out` here: `'out,`   ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'out` --> $DIR/issue-107090.rs:17:49 | LL |     fn cast(&'long self) -> &'short Foo<'short, 'out, T> { |                                                 ^^^^ undeclared lifetime | help: consider introducing lifetime `'out` here | LL |     fn cast<'out>(&'long self) -> &'short Foo<'short, 'out, T> { |            ++++++ help: consider introducing lifetime `'out` here | LL | impl<'out, 'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { |      +++++ error[E0261]: use of undeclared lifetime name `'short` --> $DIR/issue-107090.rs:24:68 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { |           -                                                        ^^^^^^ undeclared lifetime |           | |           help: consider introducing lifetime `'short` here: `'short,` error[E0308]: mismatched types --> $DIR/issue-107090.rs:4:27 | LL |     Foo<'short, 'out, T>: Convert<'a, 'b>; |                           ^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected trait `Convert<'static, 'static>` found trait `Convert<'a, 'b>` note: the lifetime `'a` as defined here... --> $DIR/issue-107090.rs:2:12 | LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) |            ^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types --> $DIR/issue-107090.rs:4:27 | LL |     Foo<'short, 'out, T>: Convert<'a, 'b>; |                           ^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected trait `Convert<'static, 'static>` found trait `Convert<'a, 'b>` note: the lifetime `'b` as defined here... --> $DIR/issue-107090.rs:2:16 | LL | struct Foo<'a, 'b, T>(PhantomData<(&'a (), &'b (), T)>) |                ^^ = note: ...does not necessarily outlive the static lifetime error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements --> $DIR/issue-107090.rs:13:55 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { |                                                       ^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'short` as defined here... --> $DIR/issue-107090.rs:13:21 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { |                     ^^^^^^ = note: ...but the lifetime must also be valid for the static lifetime... note: ...so that the types are compatible --> $DIR/issue-107090.rs:13:55 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { |                                                       ^^^^^^^^^^^^^^^^^^^^ = note: expected `Convert<'short, 'static>` found `Convert<'_, 'static>` error: incompatible lifetime on type --> $DIR/issue-107090.rs:24:29 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { |                             ^^^^^^^^^^^^^^^^^^ | note: because this has an unmet lifetime requirement --> $DIR/issue-107090.rs:4:27 | LL |     Foo<'short, 'out, T>: Convert<'a, 'b>; |                           ^^^^^^^^^^^^^^^ introduces a `'static` lifetime requirement note: the lifetime `'out` as defined here... --> $DIR/issue-107090.rs:24:17 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { |                 ^^^^ note: ...does not necessarily outlive the static lifetime introduced by the compatible `impl` --> $DIR/issue-107090.rs:13:1 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0759]: `x` has lifetime `'in_` but it needs to satisfy a `'static` lifetime requirement --> $DIR/issue-107090.rs:24:29 | LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { |                             ^^^^^^^^^^^^^^^^^^ |                             | |                             this data with lifetime `'in_`... |                             ...is used and required to live as long as `'static` here error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'long` due to conflicting requirements --> $DIR/issue-107090.rs:17:13 | LL |     fn cast(&'long self) -> &'short Foo<'short, 'out, T> { |             ^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'short` as defined here... --> $DIR/issue-107090.rs:13:21 | LL | impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { |                     ^^^^^^ = note: ...but the lifetime must also be valid for the static lifetime... note: ...so that the types are compatible --> $DIR/issue-107090.rs:17:13 | LL |     fn cast(&'long self) -> &'short Foo<'short, 'out, T> { |             ^^^^^^^^^^^ = note: expected `Convert<'short, 'static>` found `Convert<'_, 'static>` error: aborting due to 12 previous errors Some errors have detailed explanations: E0261, E0308, E0495, E0759. For more information about an error, try `rustc --explain E0261`. </ins>