Update tests
This commit is contained in:
@@ -10,7 +10,7 @@ fn non_const() {}
|
|||||||
|
|
||||||
impl const T for S {
|
impl const T for S {
|
||||||
fn foo() { non_const() }
|
fn foo() { non_const() }
|
||||||
//~^ ERROR
|
//~^ ERROR can only call other `const fn`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ error[E0723]: can only call other `const fn` within a `const fn`, but `const non
|
|||||||
LL | fn foo() { non_const() }
|
LL | fn foo() { non_const() }
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|||||||
@@ -6,6 +6,17 @@
|
|||||||
|
|
||||||
pub struct Int(i32);
|
pub struct Int(i32);
|
||||||
|
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
impl const std::ops::Sub for Int {
|
||||||
|
type Output = Self;
|
||||||
|
|
||||||
|
fn sub(self, rhs: Self) -> Self {
|
||||||
|
//~^ ERROR trait methods cannot be stable const fn
|
||||||
|
Int(self.0 - rhs.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[rustc_const_unstable(feature = "const_add", issue = "none")]
|
#[rustc_const_unstable(feature = "const_add", issue = "none")]
|
||||||
impl const std::ops::Add for Int {
|
impl const std::ops::Add for Int {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
@@ -29,5 +40,4 @@ pub const fn bar() -> Int {
|
|||||||
Int(1i32) + Int(2i32)
|
Int(1i32) + Int(2i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|||||||
@@ -1,12 +1,24 @@
|
|||||||
|
error[E0723]: trait methods cannot be stable const fn
|
||||||
|
--> $DIR/stability.rs:14:5
|
||||||
|
|
|
||||||
|
LL | / fn sub(self, rhs: Self) -> Self {
|
||||||
|
LL | |
|
||||||
|
LL | | Int(self.0 - rhs.0)
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
|
|
||||||
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: can only call other `const fn` within a `const fn`, but `const <Int as std::ops::Add>::add` is not stable as `const fn`
|
error[E0723]: can only call other `const fn` within a `const fn`, but `const <Int as std::ops::Add>::add` is not stable as `const fn`
|
||||||
--> $DIR/stability.rs:21:5
|
--> $DIR/stability.rs:32:5
|
||||||
|
|
|
|
||||||
LL | Int(1i32) + Int(2i32)
|
LL | Int(1i32) + Int(2i32)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0723`.
|
For more information about this error, try `rustc --explain E0723`.
|
||||||
|
|||||||
Reference in New Issue
Block a user