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

Invalid bound for for field type like <T>::A #258

Open
gui1117 opened this issue Mar 10, 2021 · 0 comments
Open

Invalid bound for for field type like <T>::A #258

gui1117 opened this issue Mar 10, 2021 · 0 comments

Comments

@gui1117
Copy link
Contributor

gui1117 commented Mar 10, 2021

The following test:

trait Types {
	type A;
}
#[derive(Encode, Decode)]
struct Assoc<T: Types> {
	a: <T>::A,
}

Fails with:

error: generic parameters on `where` clauses are reserved for future use
  --> tests/foo.rs:11:5
   |
11 |     a: <T>::A,
   |        ^^^ currently unsupported

error: proc-macro derive produced unparseable tokens
 --> tests/foo.rs:9:18
  |
9 | #[derive(Encode, Decode)]
  |                  ^^^^^^

error: proc-macro derive produced unparseable tokens
 --> tests/foo.rs:9:10
  |
9 | #[derive(Encode, Decode)]
  |          ^^^^^^

error[E0412]: cannot find type `A` in the crate root
  --> tests/foo.rs:11:10
   |
11 |     a: <T>::A,
   |             ^ not found in the crate root

error[E0282]: type annotations needed
  --> tests/foo.rs:10:14
   |
10 | struct Assoc<T: Types> {
   |              ^ cannot infer type for type parameter `T`

This is probably due to a wrong expansion in some of the code in derive/src/trait_bound.rs

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

1 participant