Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

we can test std and core panic macros together #78070

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/test/ui/consts/const-eval/const_panic.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#![feature(const_panic)]
#![crate_type = "lib"]

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

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

pub const X: () = unimplemented!();
const Y: () = std::unreachable!();
//~^ ERROR any use of this value will cause an error

const X: () = std::unimplemented!();
//~^ ERROR any use of this value will cause an error

const Z_CORE: () = core::panic!("cheese");
//~^ ERROR any use of this value will cause an error

const Z2_CORE: () = core::panic!();
//~^ ERROR any use of this value will cause an error

const Y_CORE: () = core::unreachable!();
//~^ ERROR any use of this value will cause an error

const X_CORE: () = core::unimplemented!();
//~^ ERROR any use of this value will cause an error
82 changes: 66 additions & 16 deletions src/test/ui/consts/const-eval/const_panic.stderr
Original file line number Diff line number Diff line change
@@ -1,33 +1,83 @@
error: any use of this value will cause an error
--> $DIR/const_panic.rs:4:19
--> $DIR/const_panic.rs:4:15
|
LL | pub const Z: () = panic!("cheese");
| ------------------^^^^^^^^^^^^^^^^-
| |
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:19
LL | const Z: () = std::panic!("cheese");
| --------------^^^^^^^^^^^^^^^^^^^^^-
| |
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:15
|
= note: `#[deny(const_err)]` on by default
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

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

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

error: aborting due to 3 previous errors
error: any use of this value will cause an error
--> $DIR/const_panic.rs:13:15
|
LL | const X: () = std::unimplemented!();
| --------------^^^^^^^^^^^^^^^^^^^^^-
| |
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:13:15
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: any use of this value will cause an error
--> $DIR/const_panic.rs:16:20
|
LL | const Z_CORE: () = core::panic!("cheese");
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
| |
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:16:20
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: any use of this value will cause an error
--> $DIR/const_panic.rs:19:21
|
LL | const Z2_CORE: () = core::panic!();
| --------------------^^^^^^^^^^^^^^-
| |
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:19:21
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: any use of this value will cause an error
--> $DIR/const_panic.rs:22:20
|
LL | const Y_CORE: () = core::unreachable!();
| -------------------^^^^^^^^^^^^^^^^^^^^-
| |
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:22:20
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: any use of this value will cause an error
--> $DIR/const_panic.rs:25:20
|
LL | const X_CORE: () = core::unimplemented!();
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
| |
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:25:20
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 8 previous errors

12 changes: 0 additions & 12 deletions src/test/ui/consts/const-eval/const_panic_libcore.rs

This file was deleted.

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

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

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

Expand Down
33 changes: 0 additions & 33 deletions src/test/ui/consts/const-eval/const_panic_libcore_main.stderr

This file was deleted.