Open
Description
This was encountered from a derive plugin that created where bounds for all member types. Occurs on stable, beta, and nightly.
struct S<'a>(&'a ());
trait Tr { }
impl<T> Tr for Option<T> { }
impl<'a> Tr for S<'a> where Option<&'a str>: Tr, Option<&'static str>: Tr { }
error: mismatched types [--explain E0308]
--> <anon>:5:1
|>
5 |> impl<'a> Tr for S<'a> where Option<&'a str>: Tr, Option<&'static str>: Tr { }
|> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
note: expected type `Tr`
note: found type `Tr`
note: the lifetime 'a as defined on the impl at 5:0...
--> <anon>:5:1
|>
5 |> impl<'a> Tr for S<'a> where Option<&'a str>: Tr, Option<&'static str>: Tr { }
|> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...does not necessarily outlive the static lifetime
error: aborting due to previous error
Activity
estebank commentedon Mar 19, 2018
Doesn't repro anymore with the linked code.
jackh726 commentedon Aug 8, 2019
Error on latest stable:
lcnr commentedon Apr 26, 2020
Minimal repro:
While this is a quite rare edge case, the error is very unhelpful rn 😅
Rollup merge of rust-lang#71952 - JohnTitor:add-tests, r=Dylan-DPC
Rollup merge of rust-lang#71952 - JohnTitor:add-tests, r=Dylan-DPC
Rollup merge of rust-lang#71952 - JohnTitor:add-tests, r=Dylan-DPC
21 remaining items