Skip to content

Commit aa9eae5

Browse files
committed
Stable const things need a stability attribute
1 parent cf5a803 commit aa9eae5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/test/ui/rfc-2632-const-trait-impl/staged-api.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct Foo;
1515

1616
#[stable(feature = "rust1", since = "1.0.0")]
1717
#[cfg_attr(unstable, rustc_const_unstable(feature = "foo", issue = "none"))]
18+
#[cfg_attr(stable, rustc_const_stable(feature = "foo", since = "1.0.0"))]
1819
impl const MyTrait for Foo {
1920
//[stable]~^ ERROR trait implementations cannot be const stable yet
2021
fn func() {}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
error: implementation has missing const stability attribute
2-
--> $DIR/staged-api.rs:18:1
1+
error: trait implementations cannot be const stable yet
2+
--> $DIR/staged-api.rs:19:1
33
|
44
LL | / impl const MyTrait for Foo {
55
LL | |
66
LL | | fn func() {}
77
LL | | }
88
| |_^
9+
|
10+
= note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
911

1012
error: aborting due to previous error
1113

src/test/ui/rfc-2632-const-trait-impl/staged-api.unstable.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error: `<Foo as staged_api::MyTrait>::func` is not yet stable as a const fn
2-
--> $DIR/staged-api.rs:34:5
2+
--> $DIR/staged-api.rs:35:5
33
|
44
LL | Foo::func();
55
| ^^^^^^^^^^^
66
|
77
= help: add `#![feature(foo)]` to the crate attributes to enable
88

99
error: `<Foo as staged_api::MyTrait>::func` is not yet stable as a const fn
10-
--> $DIR/staged-api.rs:42:5
10+
--> $DIR/staged-api.rs:43:5
1111
|
1212
LL | Foo::func();
1313
| ^^^^^^^^^^^

0 commit comments

Comments
 (0)