Skip to content

Commit ef6d427

Browse files
Bless tests
1 parent 3569bb6 commit ef6d427

35 files changed

+200
-159
lines changed

src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extern "C" {
77
const extern fn bar() {
88
unsafe {
99
regular_in_block();
10-
//~^ ERROR: can only call other `const fn` within a `const fn`
10+
//~^ ERROR: calls in constant functions
1111
}
1212
}
1313

@@ -16,7 +16,7 @@ extern fn regular() {}
1616
const extern fn foo() {
1717
unsafe {
1818
regular();
19-
//~^ ERROR: can only call other `const fn` within a `const fn`
19+
//~^ ERROR: calls in constant functions
2020
}
2121
}
2222

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
error[E0723]: can only call other `const fn` within a `const fn`, but `regular_in_block` is not stable as `const fn`
1+
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
22
--> $DIR/const-extern-fn-call-extern-fn.rs:9:9
33
|
44
LL | regular_in_block();
55
| ^^^^^^^^^^^^^^^^^^
6-
|
7-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8-
= help: add `#![feature(const_fn)]` to the crate attributes to enable
96

10-
error[E0723]: can only call other `const fn` within a `const fn`, but `regular` is not stable as `const fn`
7+
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
118
--> $DIR/const-extern-fn-call-extern-fn.rs:18:9
129
|
1310
LL | regular();
1411
| ^^^^^^^^^
15-
|
16-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
17-
= help: add `#![feature(const_fn)]` to the crate attributes to enable
1812

1913
error: aborting due to 2 previous errors
2014

21-
For more information about this error, try `rustc --explain E0723`.
15+
For more information about this error, try `rustc --explain E0015`.

src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const unsafe extern "C" fn closure() -> fn() { || {} }
66
const unsafe extern fn use_float() { 1.0 + 1.0; }
77
//~^ ERROR only int, `bool` and `char` operations are stable in const fn
88
const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
9-
//~^ ERROR casting pointers to ints is unstable in const fn
9+
//~^ ERROR casting pointers to integers
1010

1111

1212
fn main() {}

src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ LL | const unsafe extern fn use_float() { 1.0 + 1.0; }
1616
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
1717
= help: add `#![feature(const_fn)]` to the crate attributes to enable
1818

19-
error[E0723]: casting pointers to ints is unstable in const fn
19+
error[E0658]: casting pointers to integers in constant functions is unstable
2020
--> $DIR/const-extern-fn-min-const-fn.rs:8:48
2121
|
2222
LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
2323
| ^^^^^^^^^^^^
2424
|
25-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
26-
= help: add `#![feature(const_fn)]` to the crate attributes to enable
25+
= note: see issue #51910 <https://github.com/rust-lang/rust/issues/51910> for more information
26+
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
2727

2828
error: aborting due to 3 previous errors
2929

30-
For more information about this error, try `rustc --explain E0723`.
30+
Some errors have detailed explanations: E0658, E0723.
31+
For more information about an error, try `rustc --explain E0658`.

src/test/ui/consts/const-fn-not-safe-for-const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test that we can't call random fns in a const fn or do other bad things.
22

3-
#![feature(const_fn, const_transmute)]
3+
#![feature(const_fn, const_fn_transmute)]
44

55
use std::mem::transmute;
66

src/test/ui/consts/const-mut-refs/feature-gate-const_mut_refs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ fn main() {
22
foo(&mut 5);
33
}
44

5-
const fn foo(x: &mut i32) -> i32 { //~ ERROR mutable references in const fn are unstable
5+
const fn foo(x: &mut i32) -> i32 { //~ ERROR mutable references in const fn
66
*x + 1
7+
78
}

src/test/ui/consts/const_let_assign3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ struct S {
66

77
impl S {
88
const fn foo(&mut self, x: u32) {
9+
//~^ ERROR mutable references
910
self.state = x;
10-
//~^ contains unimplemented expression
1111
}
1212
}
1313

src/test/ui/consts/const_let_assign3.stderr

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
error[E0019]: constant function contains unimplemented expression type
2-
--> $DIR/const_let_assign3.rs:9:9
1+
error[E0723]: mutable references in const fn are unstable
2+
--> $DIR/const_let_assign3.rs:8:18
33
|
4-
LL | self.state = x;
5-
| ^^^^^^^^^^^^^^
4+
LL | const fn foo(&mut self, x: u32) {
5+
| ^^^^^^^^^
66
|
7-
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
7+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8+
= help: add `#![feature(const_fn)]` to the crate attributes to enable
89

910
error[E0764]: mutable references are not allowed in constants
1011
--> $DIR/const_let_assign3.rs:16:5
@@ -28,5 +29,5 @@ LL | *y = 42;
2829

2930
error: aborting due to 4 previous errors
3031

31-
Some errors have detailed explanations: E0019, E0764.
32+
Some errors have detailed explanations: E0019, E0723, E0764.
3233
For more information about an error, try `rustc --explain E0019`.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const fn foo(a: i32) -> Vec<i32> {
2-
vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn
2+
vec![1, 2, 3]
3+
//~^ ERROR allocations are not allowed
4+
//~| ERROR unimplemented expression type
5+
//~| ERROR calls in constant functions
36
}
47

58
fn main() {}
Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1-
error[E0723]: heap allocations are not allowed in const fn
1+
error[E0010]: allocations are not allowed in constant functions
2+
--> $DIR/bad_const_fn_body_ice.rs:2:5
3+
|
4+
LL | vec![1, 2, 3]
5+
| ^^^^^^^^^^^^^ allocation not allowed in constant functions
6+
|
7+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
8+
9+
error[E0019]: constant function contains unimplemented expression type
10+
--> $DIR/bad_const_fn_body_ice.rs:2:5
11+
|
12+
LL | vec![1, 2, 3]
13+
| ^^^^^^^^^^^^^
14+
|
15+
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
16+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
17+
18+
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
219
--> $DIR/bad_const_fn_body_ice.rs:2:5
320
|
421
LL | vec![1, 2, 3]
522
| ^^^^^^^^^^^^^
623
|
7-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8-
= help: add `#![feature(const_fn)]` to the crate attributes to enable
924
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1025

11-
error: aborting due to previous error
26+
error: aborting due to 3 previous errors
1227

13-
For more information about this error, try `rustc --explain E0723`.
28+
Some errors have detailed explanations: E0010, E0015, E0019.
29+
For more information about an error, try `rustc --explain E0010`.

0 commit comments

Comments
 (0)