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
I tried this code:
trait Unsigned { const REIFY: usize; } struct A<T: Unsigned> { buf: [u8; <T as Unsigned>::REIFY] }
I expected to see an error about associated constants not being allowed in array lengths or something.
Instead, this is the error given by rustc.
error[E0277]: the trait bound `T: Unsigned` is not satisfied --> src/lib.rs:6:15 | 2 | const REIFY: usize; | ------------------- required by `Unsigned::REIFY` ... 6 | buf: [u8; <T as Unsigned>::REIFY] | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Unsigned` is not implemented for `T` | help: consider further restricting this bound | 5 | struct A<T: Unsigned + Unsigned> {
(There is an additional "T is never used" error, but that one makes sense, since there are no valid uses of T in the struct definition.)
T
rustc --version --verbose:
rustc --version --verbose
rustc 1.48.0 (7eac88abb 2020-11-16) binary: rustc commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4 commit-date: 2020-11-16 host: x86_64-unknown-linux-gnu release: 1.48.0 LLVM version: 11.0
I tested this in Stable, Beta, and Nightly, on the Rust Playground.
The text was updated successfully, but these errors were encountered:
Duplicate of #43408
Sorry, something went wrong.
No branches or pull requests
I tried this code:
I expected to see an error about associated constants not being allowed in array lengths or something.
Instead, this is the error given by rustc.
(There is an additional "
T
is never used" error, but that one makes sense, since there are no valid uses ofT
in the struct definition.)Meta
rustc --version --verbose
:I tested this in Stable, Beta, and Nightly, on the Rust Playground.
The text was updated successfully, but these errors were encountered: