You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust cannot derive traits from associated types #34377
#[derive(Copy,Clone)]pubstructBar(<BarasFoo>::Type);#[derive(Copy,Clone)]pubstructBaz(i8);pubtraitFoo{typeType;}implFooforBar{typeType = i8;}fnmain(){println!("Ha, I don't compile!");}
<anon>:1:10: 1:14 error: the trait `Copy` may not be implemented for this type; field `<unnamed_field>` does not implement `Copy` [E0204]
<anon>:1 #[derive(Copy, Clone)]
It's kinda like #31518, but it's more that rust doesn't substitute the associated type before doing the Copy check. You can trigger it without #[derive]:
pubtraitFoo{typeType;}pubstructBar(<BarasFoo>::Type);implFooforBar{typeType = i8;}implCopyforBar{}//~ERROR the trait `Copy` may not be implemented
It's not probably not normalizing associated types for this check. As far as I know, it's the only trait that has a check like that, so it's not that surprising that it's fallen through the cracks.
Yeah, looking at the code, it doesn't look like it tries to resolve the associated type when checking that the impl of Copy is valid. I don't know the code well enough to know where or how it should be fixed though.
Activity
Boddlnagg commentedon Jun 20, 2016
This is probably the same as #31518
durka commentedon Jun 21, 2016
It's kinda like #31518, but it's more that rust doesn't substitute the associated type before doing the
Copycheck. You can trigger it without#[derive]:Aatch commentedon Jun 21, 2016
It's not probably not normalizing associated types for this check. As far as I know, it's the only trait that has a check like that, so it's not that surprising that it's fallen through the cracks.
Aatch commentedon Jun 21, 2016
Yeah, looking at the code, it doesn't look like it tries to resolve the associated type when checking that the impl of
Copyis valid. I don't know the code well enough to know where or how it should be fixed though.cc @rust-lang/compiler