Skip to content

Commit

Permalink
Bless tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Sep 25, 2020
1 parent 6a52c09 commit b428f28
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const extern fn unsize(x: &[u8; 3]) -> &[u8] { x }
const unsafe extern "C" fn closure() -> fn() { || {} }
//~^ ERROR function pointers in const fn are unstable
const unsafe extern fn use_float() { 1.0 + 1.0; }
//~^ ERROR only int, `bool` and `char` operations are stable in const fn
//~^ ERROR floating point arithmetic
const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
//~^ ERROR casting pointers to integers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ LL | const unsafe extern "C" fn closure() -> fn() { || {} }
= 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]: only int, `bool` and `char` operations are stable in const fn
error[E0658]: floating point arithmetic is not allowed in constant functions
--> $DIR/const-extern-fn-min-const-fn.rs:6:38
|
LL | const unsafe extern fn use_float() { 1.0 + 1.0; }
| ^^^^^^^^^
|
= 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_floating_point_arithmetic)]` to the crate attributes to enable

error[E0658]: casting pointers to integers in constant functions is unstable
--> $DIR/const-extern-fn-min-const-fn.rs:8:48
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/consts/const_let_eq_float.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// build-pass (FIXME(62277): could be check-pass?)
// run-pass

#![feature(const_fn)]
#![feature(const_fn_floating_point_arithmetic)]

struct Foo<T>(T);
struct Bar<T> { x: T }
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/consts/min_const_fn/min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
const fn foo11_2<T: Send>(t: T) -> T { t }
//~^ ERROR trait bounds other than `Sized` on const fn parameters are unstable
const fn foo19(f: f32) -> f32 { f * 2.0 }
//~^ ERROR int, `bool` and `char` operations
//~^ ERROR floating point arithmetic
const fn foo19_2(f: f32) -> f32 { 2.0 - f }
//~^ ERROR int, `bool` and `char` operations
//~^ ERROR floating point arithmetic
const fn foo19_3(f: f32) -> f32 { -f }
//~^ ERROR int, `bool` and `char` operations
//~^ ERROR floating point arithmetic
const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
//~^ ERROR int, `bool` and `char` operations
//~^ ERROR floating point arithmetic

static BAR: u32 = 42;
const fn foo25() -> u32 { BAR } //~ ERROR cannot refer to statics
Expand Down
16 changes: 8 additions & 8 deletions src/test/ui/consts/min_const_fn/min_const_fn.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -76,41 +76,41 @@ LL | const fn foo11_2<T: Send>(t: T) -> T { t }
= 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]: only int, `bool` and `char` operations are stable in const fn
error[E0658]: floating point arithmetic is not allowed in constant functions
--> $DIR/min_const_fn.rs:80:33
|
LL | const fn foo19(f: f32) -> f32 { f * 2.0 }
| ^^^^^^^
|
= 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_floating_point_arithmetic)]` to the crate attributes to enable

error[E0723]: only int, `bool` and `char` operations are stable in const fn
error[E0658]: floating point arithmetic is not allowed in constant functions
--> $DIR/min_const_fn.rs:82:35
|
LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f }
| ^^^^^^^
|
= 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_floating_point_arithmetic)]` to the crate attributes to enable

error[E0723]: only int, `bool` and `char` operations are stable in const fn
error[E0658]: floating point arithmetic is not allowed in constant functions
--> $DIR/min_const_fn.rs:84:35
|
LL | const fn foo19_3(f: f32) -> f32 { -f }
| ^^
|
= 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_floating_point_arithmetic)]` to the crate attributes to enable

error[E0723]: only int, `bool` and `char` operations are stable in const fn
error[E0658]: floating point arithmetic is not allowed in constant functions
--> $DIR/min_const_fn.rs:86:43
|
LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g }
| ^^^^^
|
= 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_floating_point_arithmetic)]` to the crate attributes to enable

error[E0013]: constant functions cannot refer to statics
--> $DIR/min_const_fn.rs:90:27
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
we're apparently really bad at it",
issue = "none")]

#![feature(const_fn, foo, foo2)]
#![feature(const_fn, const_fn_floating_point_arithmetic, foo, foo2)]
#![feature(staged_api)]

#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -25,9 +25,9 @@ const fn bar2() -> u32 { foo2() } //~ ERROR not yet stable as a const fn

#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// conformity is required, even with `const_fn` feature gate
// Const-stable functions cannot rely on unstable const-eval features.
const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
//~^ ERROR const-stable function cannot use `#[feature(const_fn)]`
//~^ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`

// check whether this function cannot be called even with the feature gate active
#[unstable(feature = "foo2", issue = "none")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LL | const fn bar2() -> u32 { foo2() }
|
= help: Const-stable functions can only call other const-stable functions

error: const-stable function cannot use `#[feature(const_fn)]`
error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
--> $DIR/min_const_fn_libstd_stability.rs:29:26
|
LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
we're apparently really bad at it",
issue = "none")]

#![feature(const_fn, foo, foo2)]
#![feature(const_fn, const_fn_floating_point_arithmetic, foo, foo2)]
#![feature(staged_api)]

#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -27,7 +27,7 @@ const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR not yet stable as
#[rustc_const_stable(feature = "rust1", since = "1.0.0")]
// conformity is required, even with `const_fn` feature gate
const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
//~^ ERROR const-stable function cannot use `#[feature(const_fn)]`
//~^ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`

// check whether this function cannot be called even with the feature gate active
#[unstable(feature = "foo2", issue = "none")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } }
|
= help: Const-stable functions can only call other const-stable functions

error: const-stable function cannot use `#[feature(const_fn)]`
error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
--> $DIR/min_const_unsafe_fn_libstd_stability.rs:29:33
|
LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
Expand Down

0 comments on commit b428f28

Please sign in to comment.