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

Associated const requires trait bounds that are already satisfied #43243

Closed
willglynn opened this issue Jul 14, 2017 · 2 comments
Closed

Associated const requires trait bounds that are already satisfied #43243

willglynn opened this issue Jul 14, 2017 · 2 comments

Comments

@willglynn
Copy link

This code (playpen):

trait Foo {
    const SIZE: usize;
}

struct Container<F: Foo> {
    bytes: [u8; <F as Foo>::SIZE],
}

Fails with:

error[E0277]: the trait bound `F: Foo` is not satisfied
 --> src/main.rs:8:17
  |
8 |     bytes: [u8; <F as Foo>::SIZE],
  |                 ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `F`
  |
  = help: consider adding a `where F: Foo` bound
  = note: required by `Foo::SIZE`

Changing to struct Container<F: Foo> where F: Foo, as directed, fails with the same message.

@vitalyd
Copy link

vitalyd commented Jul 15, 2017

Probably a dupe of #42863

@Mark-Simulacrum
Copy link
Member

I think so, or at least another issue mentioned in that one... closing as a duplicate of #42863.

@Mark-Simulacrum Mark-Simulacrum marked this as a duplicate of #42863 Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants