This commit is contained in:
Deadbeef 2022-08-28 04:17:12 +00:00
parent 5a6273e263
commit 03ac7e0d0b
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,9 @@
#![feature(const_trait_impl)]
pub trait A {}
//~^ NOTE: this trait must be annotated with `#[const_trait]`
impl const A for () {}
//~^ ERROR: const `impl`s must be for traits marked with `#[const_trait]`
fn main() {}

View file

@ -0,0 +1,14 @@
error: const `impl`s must be for traits marked with `#[const_trait]`
--> $DIR/const-impl-requires-const-trait.rs:6:1
|
LL | impl const A for () {}
| ^^^^^^^^^^^^^^^^^^^
|
note: this trait must be annotated with `#[const_trait]`
--> $DIR/const-impl-requires-const-trait.rs:3:1
|
LL | pub trait A {}
| ^^^^^^^^^^^
error: aborting due to previous error