Skip to content

Commit

Permalink
Stable const things need a stability attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed May 19, 2022
1 parent cf5a803 commit aa9eae5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/test/ui/rfc-2632-const-trait-impl/staged-api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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();
| ^^^^^^^^^^^
|
= 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();
| ^^^^^^^^^^^
Expand Down

0 comments on commit aa9eae5

Please sign in to comment.