Open SoniEx2 opened 3 years ago
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
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
```
```