rust/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr
Esteban Küber 4007fc9a0f Tweak wording of non-const traits used as const bounds
Use verbose suggestions and add additional labels/notes.

Add more test cases for stable/nightly and feature enabled/disabled.
2024-12-10 00:38:05 +00:00

37 lines
1.2 KiB
Plaintext

error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:21
|
LL | const fn perform<T: ~const NonConst>() {}
| ^^^^^^ can't be applied to `NonConst`
|
help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait NonConst {}
| ++++++++++++++
error: `~const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:6:21
|
LL | const fn perform<T: ~const NonConst>() {}
| ^^^^^^ can't be applied to `NonConst`
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait NonConst {}
| ++++++++++++++
error: `const` can only be applied to `#[const_trait]` traits
--> $DIR/const-bounds-non-const-trait.rs:10:15
|
LL | fn operate<T: const NonConst>() {}
| ^^^^^ can't be applied to `NonConst`
|
help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
|
LL | #[const_trait] trait NonConst {}
| ++++++++++++++
error: aborting due to 3 previous errors