2023-12-18 17:55:55 +01:00
|
|
|
error: const trait bounds are not allowed in trait object types
|
2025-07-13 16:49:19 +08:00
|
|
|
--> $DIR/const-trait-bounds-trait-objects.rs:7:17
|
2023-12-18 17:55:55 +01:00
|
|
|
|
|
|
|
|
|
LL | let _: &dyn const Trait;
|
|
|
|
|
| ^^^^^^^^^^^
|
|
|
|
|
|
2025-03-11 12:08:45 +00:00
|
|
|
error: `[const]` is not allowed here
|
2025-07-13 16:49:19 +08:00
|
|
|
--> $DIR/const-trait-bounds-trait-objects.rs:8:17
|
2024-01-03 09:24:42 +01:00
|
|
|
|
|
2025-03-11 12:08:45 +00:00
|
|
|
LL | let _: &dyn [const] Trait;
|
2025-06-29 01:31:53 +02:00
|
|
|
| ^^^^^^^
|
2024-01-03 09:24:42 +01:00
|
|
|
|
|
2025-03-11 12:08:45 +00:00
|
|
|
= note: trait objects cannot have `[const]` trait bounds
|
2024-01-03 09:24:42 +01:00
|
|
|
|
|
|
|
|
error: const trait bounds are not allowed in trait object types
|
2025-07-13 16:49:19 +08:00
|
|
|
--> $DIR/const-trait-bounds-trait-objects.rs:13:25
|
2024-01-03 09:24:42 +01:00
|
|
|
|
|
|
|
|
|
LL | const fn handle(_: &dyn const NonConst) {}
|
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
2025-03-11 12:08:45 +00:00
|
|
|
error: `[const]` is not allowed here
|
2025-07-13 16:49:19 +08:00
|
|
|
--> $DIR/const-trait-bounds-trait-objects.rs:16:23
|
2024-01-03 09:24:42 +01:00
|
|
|
|
|
2025-03-11 12:08:45 +00:00
|
|
|
LL | const fn take(_: &dyn [const] NonConst) {}
|
2025-06-29 01:31:53 +02:00
|
|
|
| ^^^^^^^
|
2024-01-03 09:24:42 +01:00
|
|
|
|
|
2025-03-11 12:08:45 +00:00
|
|
|
= note: trait objects cannot have `[const]` trait bounds
|
2024-01-03 09:24:42 +01:00
|
|
|
|
2025-07-13 16:49:19 +08:00
|
|
|
error: `const` can only be applied to `const` traits
|
|
|
|
|
--> $DIR/const-trait-bounds-trait-objects.rs:13:25
|
2025-07-09 07:25:12 +00:00
|
|
|
|
|
|
|
|
|
LL | const fn handle(_: &dyn const NonConst) {}
|
|
|
|
|
| ^^^^^ can't be applied to `NonConst`
|
|
|
|
|
|
|
2025-07-13 16:49:19 +08:00
|
|
|
help: mark `NonConst` as `const` to allow it to have `const` implementations
|
2025-07-09 07:25:12 +00:00
|
|
|
|
|
|
|
|
|
LL | #[const_trait] trait NonConst {}
|
|
|
|
|
| ++++++++++++++
|
|
|
|
|
|
2025-07-13 16:49:19 +08:00
|
|
|
error: `[const]` can only be applied to `const` traits
|
|
|
|
|
--> $DIR/const-trait-bounds-trait-objects.rs:16:23
|
2025-07-09 07:25:12 +00:00
|
|
|
|
|
|
|
|
|
LL | const fn take(_: &dyn [const] NonConst) {}
|
|
|
|
|
| ^^^^^^^ can't be applied to `NonConst`
|
|
|
|
|
|
|
2025-07-13 16:49:19 +08:00
|
|
|
help: mark `NonConst` as `const` to allow it to have `const` implementations
|
2025-07-09 07:25:12 +00:00
|
|
|
|
|
|
|
|
|
LL | #[const_trait] trait NonConst {}
|
|
|
|
|
| ++++++++++++++
|
|
|
|
|
|
|
|
|
|
error: aborting due to 6 previous errors
|
2023-12-18 17:55:55 +01:00
|
|
|
|