Closed
Description
I tried this code:
use std::marker::PhantomData;
use std::rc::Rc;
trait Machine<'a> {
type Datum;
}
#[derive(Default)]
struct LuaMachine<'a> {
_phantom: PhantomData<fn(&'a ()) -> &'a ()>,
}
struct LuaDatum<'a> {
_machine: Rc<LuaMachine<'a>>,
}
impl<'a> Machine<'a> for LuaMachine<'a> {
type Datum = LuaDatum<'a>;
}
type M<'a> = LuaMachine<'a>;
type D<'a> = <M<'a> as Machine>::Datum;
fn main() {}
I expected to see this happen (which works correctly with rustc 1.57.0 stable):
help: consider using the `'a` lifetime
|
22 | type D<'a> = <M<'a> as Machine<'a>>::Datum;
| ~~~~~~~~~~~
But with rustc 1.59.0-nightly (f8abed9ed 2021-12-26)
, I get:
help: consider using the `'a` lifetime
|
22 | type D<'a> = <M<'a> as Machine>::Datum<'a>;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Meta
rustc --version --verbose
:
rustc 1.59.0-nightly (f8abed9ed 2021-12-26)
binary: rustc
commit-hash: f8abed9ed48bace6be0087bcd44ed534e239b8d8
commit-date: 2021-12-26
host: x86_64-unknown-freebsd
release: 1.59.0-nightly
LLVM version: 13.0.0