Skip to content

Commit 762ded1

Browse files
committed
we can test std and core panic macros together
1 parent 94332bb commit 762ded1

6 files changed

+90
-70
lines changed
+18-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
#![feature(const_panic)]
22
#![crate_type = "lib"]
33

4-
pub const Z: () = panic!("cheese");
4+
const Z: () = std::panic!("cheese");
55
//~^ ERROR any use of this value will cause an error
66

7-
pub const Y: () = unreachable!();
7+
const Z2: () = std::panic!();
88
//~^ ERROR any use of this value will cause an error
99

10-
pub const X: () = unimplemented!();
10+
const Y: () = std::unreachable!();
11+
//~^ ERROR any use of this value will cause an error
12+
13+
const X: () = std::unimplemented!();
14+
//~^ ERROR any use of this value will cause an error
15+
16+
const Z_CORE: () = core::panic!("cheese");
17+
//~^ ERROR any use of this value will cause an error
18+
19+
const Z2_CORE: () = core::panic!();
20+
//~^ ERROR any use of this value will cause an error
21+
22+
const Y_CORE: () = core::unreachable!();
23+
//~^ ERROR any use of this value will cause an error
24+
25+
const X_CORE: () = core::unimplemented!();
1126
//~^ ERROR any use of this value will cause an error
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,83 @@
11
error: any use of this value will cause an error
2-
--> $DIR/const_panic.rs:4:19
2+
--> $DIR/const_panic.rs:4:15
33
|
4-
LL | pub const Z: () = panic!("cheese");
5-
| ------------------^^^^^^^^^^^^^^^^-
6-
| |
7-
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:19
4+
LL | const Z: () = std::panic!("cheese");
5+
| --------------^^^^^^^^^^^^^^^^^^^^^-
6+
| |
7+
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:15
88
|
99
= note: `#[deny(const_err)]` on by default
1010
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1111

1212
error: any use of this value will cause an error
13-
--> $DIR/const_panic.rs:7:19
13+
--> $DIR/const_panic.rs:7:16
1414
|
15-
LL | pub const Y: () = unreachable!();
16-
| ------------------^^^^^^^^^^^^^^-
17-
| |
18-
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:7:19
15+
LL | const Z2: () = std::panic!();
16+
| ---------------^^^^^^^^^^^^^-
17+
| |
18+
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:7:16
1919
|
2020
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2121

2222
error: any use of this value will cause an error
23-
--> $DIR/const_panic.rs:10:19
23+
--> $DIR/const_panic.rs:10:15
2424
|
25-
LL | pub const X: () = unimplemented!();
26-
| ------------------^^^^^^^^^^^^^^^^-
27-
| |
28-
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:10:19
25+
LL | const Y: () = std::unreachable!();
26+
| --------------^^^^^^^^^^^^^^^^^^^-
27+
| |
28+
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:10:15
2929
|
3030
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3131

32-
error: aborting due to 3 previous errors
32+
error: any use of this value will cause an error
33+
--> $DIR/const_panic.rs:13:15
34+
|
35+
LL | const X: () = std::unimplemented!();
36+
| --------------^^^^^^^^^^^^^^^^^^^^^-
37+
| |
38+
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:13:15
39+
|
40+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
41+
42+
error: any use of this value will cause an error
43+
--> $DIR/const_panic.rs:16:20
44+
|
45+
LL | const Z_CORE: () = core::panic!("cheese");
46+
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
47+
| |
48+
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:16:20
49+
|
50+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
51+
52+
error: any use of this value will cause an error
53+
--> $DIR/const_panic.rs:19:21
54+
|
55+
LL | const Z2_CORE: () = core::panic!();
56+
| --------------------^^^^^^^^^^^^^^-
57+
| |
58+
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:19:21
59+
|
60+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
61+
62+
error: any use of this value will cause an error
63+
--> $DIR/const_panic.rs:22:20
64+
|
65+
LL | const Y_CORE: () = core::unreachable!();
66+
| -------------------^^^^^^^^^^^^^^^^^^^^-
67+
| |
68+
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:22:20
69+
|
70+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
71+
72+
error: any use of this value will cause an error
73+
--> $DIR/const_panic.rs:25:20
74+
|
75+
LL | const X_CORE: () = core::unimplemented!();
76+
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
77+
| |
78+
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:25:20
79+
|
80+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
81+
82+
error: aborting due to 8 previous errors
3383

src/test/ui/consts/const-eval/const_panic_libcore.rs

-12
This file was deleted.

src/test/ui/consts/const-eval/const_panic_libcore.stderr renamed to src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: any use of this value will cause an error
2-
--> $DIR/const_panic_libcore.rs:5:15
2+
--> $DIR/const_panic_libcore_bin.rs:9:15
33
|
44
LL | const Z: () = panic!("cheese");
55
| --------------^^^^^^^^^^^^^^^^-
66
| |
7-
| the evaluated program panicked at 'cheese', $DIR/const_panic_libcore.rs:5:15
7+
| the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15
88
|
99
= note: `#[deny(const_err)]` on by default
1010
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1111

1212
error: any use of this value will cause an error
13-
--> $DIR/const_panic_libcore.rs:8:15
13+
--> $DIR/const_panic_libcore_bin.rs:12:15
1414
|
1515
LL | const Y: () = unreachable!();
1616
| --------------^^^^^^^^^^^^^^-
1717
| |
18-
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore.rs:8:15
18+
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15
1919
|
2020
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2121

2222
error: any use of this value will cause an error
23-
--> $DIR/const_panic_libcore.rs:11:15
23+
--> $DIR/const_panic_libcore_bin.rs:15:15
2424
|
2525
LL | const X: () = unimplemented!();
2626
| --------------^^^^^^^^^^^^^^^^-
2727
| |
28-
| the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore.rs:11:15
28+
| the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15
2929
|
3030
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3131

src/test/ui/consts/const-eval/const_panic_libcore_main.stderr

-33
This file was deleted.

0 commit comments

Comments
 (0)