-
Notifications
You must be signed in to change notification settings - Fork 13.4k
where bounds not properly inherited? #88048
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Ironically, this works today: pub trait Kind where for<'a> &'a Self::Values: IntoIterator<Item=&'a Self> {
type Values: IntoIterator<Item=Self>;
}
pub trait DataSource<T: Kind> where for<'a> &'a T::Values: IntoIterator<Item=&'a T> {
fn get_values(&self) -> &T::Values;
} In fact, it just works if you copy the where for into every single thing that references T: Kind, which... is a complete pain, honestly. |
Looks like a duplicate of #20671 |
That seems subtly different: this used to work on Rust 1.3.0, whereas that one didn't. This is a regression from stable to stable, whereas that one isn't. Note that even something like: pub trait Kind where for<'a> &'a Self::Values: IntoIterator<Item=&'a Self> {
type Values: IntoIterator<Item=Self>;
}
pub trait OverridableKind: Kind {
} fails today: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f168037dddb59d67bfd8bfdd37e4b870 |
Uh oh!
There was an error while loading. Please reload this page.
I tried this code:
I expected to see this happen: We thought it would just... work.
Instead, this happened: It causes this very confusing error:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3ec5006f8378c11861c1c24614814594
This legit feels like something that should be accepted, even if RFC 1214 says it shouldn't. It became a warning on rust 1.4.0 and a hard error on rust 1.7.0.
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: