-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Trait-objects need associated-types of subtraits to be specified even when that's already done by the boxed trait #29328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would like to claim that this is a part of "non-supertrait predicates are not elaborated", but this quite ugly. However, with the current acyclicity requirements, this would break stuff like trait Foo : Iterator where Self::Item: Copy {} Maybe just give them the |
I just hit this issue and discovered this bug by searching. I don't understand most of the words in the comment explaining why this behavior is this way. :-) But it's definitely a weird UX issue, in that it's not at all obvious to a user why it would do this. |
This also makes it hard to parameterize associated types. trait Foo { type Bar; }
trait Foobar<T> : Foo<Bar=T> {}
struct Quux<'a> {
foobar: &'a Foobar<String>,
} That doesn't compile. I'll need to write |
In combination with Fn traits, this seems like a hole in stability! Check out this code: trait FnAlias: Fn() {}
fn main() {
let _: FnAlias; // error
let _: FnAlias<Output=()>; // no error, but I shouldn't be able to do this!
} Normally I can't write an Fn trait while specifying the return type as an associated type, at least without |
Tagging with A-stability based on durka's comment. |
So while it's true that this bug allows you to name the |
In particular, we are more concerned about the input argument types, which may want to become variadic or otherwise change. |
triage: P-medium |
Closing as dup of #24010 |
If someone has a shorter/more conclusive title in mind, shoot.
code
Playpen: http://is.gd/6QKndB
output
rustc version
The text was updated successfully, but these errors were encountered: