Skip to content
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

rustc suggests invalid syntax for missing method on `impl Trait` parameter #63706

euclio opened this issue Aug 19, 2019 · 0 comments · Fixed by #63811


Copy link

commented Aug 19, 2019


trait Foo {}

trait Bar {
    fn hello(&mut self) {}

fn test(foo: &mut impl Foo) {

rustc outputs:

error[E0599]: no method named `hello` found for type `&mut impl Foo` in the current scope
 --> src/
8 |     foo.hello();
  |         ^^^^^
  = help: items from traits can only be used if the type parameter is bounded by the trait
help: the following trait defines an item `hello`, perhaps you need to restrict type parameter `impl Foo` with it:
7 | fn test(foo: &mut impl Foo: Bar + {
  |                   ^^^^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.