Skip to content

Commit 879d379

Browse files
Bless output
1 parent 37f37dc commit 879d379

10 files changed

+95
-15
lines changed

src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: mutation through a reference is not allowed in statics
2-
--> $DIR/mod-static-with-const-fn.rs:15:5
2+
--> $DIR/mod-static-with-const-fn.rs:16:5
33
|
44
LL | *FOO.0.get() = 5;
55
| ^^^^^^^^^^^^^^^^

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const extern fn unsize(x: &[u8; 3]) -> &[u8] { x }
44
const unsafe extern "C" fn closure() -> fn() { || {} }
55
//~^ ERROR function pointer
6+
//~| ERROR function pointer cast
67
const unsafe extern fn use_float() { 1.0 + 1.0; }
78
//~^ ERROR floating point arithmetic
89
const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
error[E0658]: function pointers cannot appear in constant functions
2+
--> $DIR/const-extern-fn-min-const-fn.rs:4:41
3+
|
4+
LL | const unsafe extern "C" fn closure() -> fn() { || {} }
5+
| ^^^^
6+
|
7+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8+
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
9+
10+
error[E0658]: function pointer casts are not allowed in constant functions
211
--> $DIR/const-extern-fn-min-const-fn.rs:4:48
312
|
413
LL | const unsafe extern "C" fn closure() -> fn() { || {} }
@@ -8,7 +17,7 @@ LL | const unsafe extern "C" fn closure() -> fn() { || {} }
817
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
918

1019
error[E0658]: floating point arithmetic is not allowed in constant functions
11-
--> $DIR/const-extern-fn-min-const-fn.rs:6:38
20+
--> $DIR/const-extern-fn-min-const-fn.rs:7:38
1221
|
1322
LL | const unsafe extern fn use_float() { 1.0 + 1.0; }
1423
| ^^^^^^^^^
@@ -17,14 +26,14 @@ LL | const unsafe extern fn use_float() { 1.0 + 1.0; }
1726
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable
1827

1928
error[E0658]: casting pointers to integers in constant functions is unstable
20-
--> $DIR/const-extern-fn-min-const-fn.rs:8:48
29+
--> $DIR/const-extern-fn-min-const-fn.rs:9:48
2130
|
2231
LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
2332
| ^^^^^^^^^^^^
2433
|
2534
= note: see issue #51910 <https://github.com/rust-lang/rust/issues/51910> for more information
2635
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
2736

28-
error: aborting due to 3 previous errors
37+
error: aborting due to 4 previous errors
2938

3039
For more information about this error, try `rustc --explain E0658`.

src/test/ui/consts/min_const_fn/cast_errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ fn main() {}
33
const fn unsize(x: &[u8; 3]) -> &[u8] { x }
44
const fn closure() -> fn() { || {} }
55
//~^ ERROR function pointer
6+
//~| ERROR function pointer cast
67
const fn closure2() {
78
(|| {}) as fn();
89
//~^ ERROR function pointer
910
}
1011
const fn reify(f: fn()) -> unsafe fn() { f }
1112
//~^ ERROR function pointer
13+
//~| ERROR function pointer
14+
//~| ERROR function pointer cast
1215
const fn reify2() { main as unsafe fn(); }
1316
//~^ ERROR function pointer
17+
//~| ERROR function pointer cast
Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
error[E0658]: function pointers cannot appear in constant functions
2+
--> $DIR/cast_errors.rs:4:23
3+
|
4+
LL | const fn closure() -> fn() { || {} }
5+
| ^^^^
6+
|
7+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8+
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
9+
10+
error[E0658]: function pointer casts are not allowed in constant functions
211
--> $DIR/cast_errors.rs:4:30
312
|
413
LL | const fn closure() -> fn() { || {} }
@@ -7,17 +16,17 @@ LL | const fn closure() -> fn() { || {} }
716
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
817
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
918

10-
error[E0658]: function pointers cannot appear in constant functions
11-
--> $DIR/cast_errors.rs:7:5
19+
error[E0658]: function pointer casts are not allowed in constant functions
20+
--> $DIR/cast_errors.rs:8:5
1221
|
1322
LL | (|| {}) as fn();
14-
| ^^^^^^^^^^^^^^^
23+
| ^^^^^^^
1524
|
1625
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
1726
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
1827

1928
error[E0658]: function pointers cannot appear in constant functions
20-
--> $DIR/cast_errors.rs:10:16
29+
--> $DIR/cast_errors.rs:11:16
2130
|
2231
LL | const fn reify(f: fn()) -> unsafe fn() { f }
2332
| ^
@@ -26,14 +35,41 @@ LL | const fn reify(f: fn()) -> unsafe fn() { f }
2635
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
2736

2837
error[E0658]: function pointers cannot appear in constant functions
29-
--> $DIR/cast_errors.rs:12:21
38+
--> $DIR/cast_errors.rs:11:28
39+
|
40+
LL | const fn reify(f: fn()) -> unsafe fn() { f }
41+
| ^^^^^^^^^^^
42+
|
43+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
44+
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
45+
46+
error[E0658]: function pointer casts are not allowed in constant functions
47+
--> $DIR/cast_errors.rs:11:42
48+
|
49+
LL | const fn reify(f: fn()) -> unsafe fn() { f }
50+
| ^
51+
|
52+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
53+
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
54+
55+
error[E0658]: function pointer casts are not allowed in constant functions
56+
--> $DIR/cast_errors.rs:15:21
57+
|
58+
LL | const fn reify2() { main as unsafe fn(); }
59+
| ^^^^
60+
|
61+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
62+
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
63+
64+
error[E0658]: function pointer casts are not allowed in constant functions
65+
--> $DIR/cast_errors.rs:15:21
3066
|
3167
LL | const fn reify2() { main as unsafe fn(); }
32-
| ^^^^^^^^^^^^^^^^^^^
68+
| ^^^^
3369
|
3470
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
3571
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
3672

37-
error: aborting due to 4 previous errors
73+
error: aborting due to 8 previous errors
3874

3975
For more information about this error, try `rustc --explain E0658`.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointer
1+
const fn cmp(x: fn(), y: fn()) -> bool {
2+
//~^ ERROR function pointer
3+
//~| ERROR function pointer
24
unsafe { x == y }
5+
//~^ ERROR pointers cannot be reliably compared
36
}
47

58
fn main() {}

src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ LL | const fn cmp(x: fn(), y: fn()) -> bool {
77
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
88
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
99

10-
error: aborting due to previous error
10+
error[E0658]: function pointers cannot appear in constant functions
11+
--> $DIR/cmp_fn_pointers.rs:1:23
12+
|
13+
LL | const fn cmp(x: fn(), y: fn()) -> bool {
14+
| ^
15+
|
16+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
17+
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
18+
19+
error: pointers cannot be reliably compared during const eval.
20+
--> $DIR/cmp_fn_pointers.rs:4:14
21+
|
22+
LL | unsafe { x == y }
23+
| ^^^^^^
24+
|
25+
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
26+
27+
error: aborting due to 3 previous errors
1128

1229
For more information about this error, try `rustc --explain E0658`.

src/test/ui/consts/min_const_fn/min_const_fn.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,4 @@ const fn no_fn_ptrs(_x: fn()) {}
139139
//~^ ERROR function pointer
140140
const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
141141
//~^ ERROR function pointer
142+
//~| ERROR function pointer cast

src/test/ui/consts/min_const_fn/min_const_fn.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,16 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
299299
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
300300
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
301301

302-
error: aborting due to 34 previous errors
302+
error[E0658]: function pointer casts are not allowed in constant functions
303+
--> $DIR/min_const_fn.rs:140:46
304+
|
305+
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
306+
| ^^^
307+
|
308+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
309+
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
310+
311+
error: aborting due to 35 previous errors
303312

304313
Some errors have detailed explanations: E0013, E0493, E0658, E0723.
305314
For more information about an error, try `rustc --explain E0013`.

src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | x.0.field;
77
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
88
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
99

10-
error[E0658]: function pointers cannot appear in constant functions
10+
error[E0658]: function pointer casts are not allowed in constant functions
1111
--> $DIR/min_const_fn_fn_ptr.rs:16:59
1212
|
1313
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) }

0 commit comments

Comments
 (0)