1
Fork 0

Stable const things need a stability attribute

This commit is contained in:
Oli Scherer 2022-05-19 12:30:38 +00:00
parent cf5a803600
commit aa9eae50f3
3 changed files with 7 additions and 4 deletions

View file

@ -15,6 +15,7 @@ pub struct Foo;
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(unstable, rustc_const_unstable(feature = "foo", issue = "none"))]
#[cfg_attr(stable, rustc_const_stable(feature = "foo", since = "1.0.0"))]
impl const MyTrait for Foo {
//[stable]~^ ERROR trait implementations cannot be const stable yet
fn func() {}

View file

@ -1,11 +1,13 @@
error: implementation has missing const stability attribute
--> $DIR/staged-api.rs:18:1
error: trait implementations cannot be const stable yet
--> $DIR/staged-api.rs:19:1
|
LL | / impl const MyTrait for Foo {
LL | |
LL | | fn func() {}
LL | | }
| |_^
|
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
error: aborting due to previous error

View file

@ -1,5 +1,5 @@
error: `<Foo as staged_api::MyTrait>::func` is not yet stable as a const fn
--> $DIR/staged-api.rs:34:5
--> $DIR/staged-api.rs:35:5
|
LL | Foo::func();
| ^^^^^^^^^^^
@ -7,7 +7,7 @@ LL | Foo::func();
= help: add `#![feature(foo)]` to the crate attributes to enable
error: `<Foo as staged_api::MyTrait>::func` is not yet stable as a const fn
--> $DIR/staged-api.rs:42:5
--> $DIR/staged-api.rs:43:5
|
LL | Foo::func();
| ^^^^^^^^^^^