Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/ui/consts/const-eval/const_panic_stability.e2018.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
warning: panic message is not a string literal | ||
--> $DIR/const_panic_stability.rs:14:12 | ||
| | ||
LL | panic!({ "foo" }); | ||
| ^^^^^^^^^ | ||
| | ||
= note: `#[warn(non_fmt_panics)]` on by default | ||
= note: this usage of panic!() is deprecated; it will be a hard error in Rust 2021 | ||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html> | ||
help: add a "{}" format string to Display the message | ||
| | ||
LL | panic!("{}", { "foo" }); | ||
| +++++ | ||
|
||
warning: 1 warning emitted | ||
|
13 changes: 13 additions & 0 deletions
13
src/test/ui/consts/const-eval/const_panic_stability.e2021.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error: format argument must be a string literal | ||
--> $DIR/const_panic_stability.rs:14:12 | ||
| | ||
LL | panic!({ "foo" }); | ||
| ^^^^^^^^^ | ||
| | ||
help: you might be missing a string literal to format with | ||
| | ||
LL | panic!("{}", { "foo" }); | ||
| +++++ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// revisions: e2018 e2021 | ||
//[e2018] edition:2018 | ||
//[e2021] edition:2021 | ||
//[e2018] check-pass | ||
#![crate_type = "lib"] | ||
#![stable(feature = "foo", since = "1.0.0")] | ||
#![feature(staged_api)] | ||
|
||
#[stable(feature = "foo", since = "1.0.0")] | ||
#[rustc_const_stable(feature = "foo", since = "1.0.0")] | ||
const fn foo() { | ||
assert!(false); | ||
assert!(false, "foo"); | ||
panic!({ "foo" }); | ||
//[e2018]~^ WARNING panic message is not a string literal | ||
//[e2021]~^^ ERROR format argument must be a string literal | ||
} |