We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider this code:
trait Map<K, V> {} trait Machine { type Tag; type MyMap: Map<usize, Self::Tag> + Default; } struct Context<M: Machine>(M::MyMap); impl<M: Machine<Tag = ()>> Context<M> { fn new() -> Self { Context(Default::default()) } }
It fails to compile with
error[E0277]: the trait bound `<M as Machine>::MyMap: Map<usize, ()>` is not satisfied --> src/lib.rs:10:1 | 10 | / impl<M: Machine<Tag = ()>> Context<M> { 11 | | fn new() -> Self { 12 | | Context(Default::default()) 13 | | } 14 | | } | |_^ the trait `Map<usize, ()>` is not implemented for `<M as Machine>::MyMap` | = help: consider adding a `where <M as Machine>::MyMap: Map<usize, ()>` bound note: required by `Machine` --> src/lib.rs:3:1 | 3 | trait Machine { | ^^^^^^^^^^^^^ error[E0277]: the trait bound `<M as Machine>::MyMap: Map<usize, ()>` is not satisfied --> src/lib.rs:11:5 | 11 | / fn new() -> Self { 12 | | Context(Default::default()) 13 | | } | |_____^ the trait `Map<usize, ()>` is not implemented for `<M as Machine>::MyMap` | = help: consider adding a `where <M as Machine>::MyMap: Map<usize, ()>` bound note: required by `Machine` --> src/lib.rs:3:1 | 3 | trait Machine { | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors
But that is strange, because the M: Machine impl must be well-formed, so of course that bound is met.
M: Machine
The text was updated successfully, but these errors were encountered:
This looks like another duplicate of #24159.
Sorry, something went wrong.
It does indeed, thanks! Closing this.
No branches or pull requests
Consider this code:
It fails to compile with
But that is strange, because the
M: Machine
impl must be well-formed, so of course that bound is met.The text was updated successfully, but these errors were encountered: