-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix handling of panic calls #6310
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9d84687
Fix handling of panic calls
camelid 26a4d12
Make PANIC path consts private to prevent misuse
camelid e5b0c14
Fix mistake in `panic_any` path
camelid 11280fe
Add test for `core` versions of the panic macros
camelid 0cbe925
Sidestep bug with qualified macros in test
camelid b9f1290
Fix pre-existing bug
camelid 761cdf2
Remove unnecessary `if_chain`
camelid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,88 +1,112 @@ | ||
error: `panic` should not be present in production code | ||
--> $DIR/panicking_macros.rs:6:5 | ||
--> $DIR/panicking_macros.rs:8:5 | ||
| | ||
LL | panic!(); | ||
| ^^^^^^^^^ | ||
| | ||
= note: `-D clippy::panic` implied by `-D warnings` | ||
|
||
error: `panic` should not be present in production code | ||
--> $DIR/panicking_macros.rs:7:5 | ||
--> $DIR/panicking_macros.rs:9:5 | ||
| | ||
LL | panic!("message"); | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: `panic` should not be present in production code | ||
--> $DIR/panicking_macros.rs:8:5 | ||
--> $DIR/panicking_macros.rs:10:5 | ||
| | ||
LL | panic!("{} {}", "panic with", "multiple arguments"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: `todo` should not be present in production code | ||
--> $DIR/panicking_macros.rs:14:5 | ||
--> $DIR/panicking_macros.rs:16:5 | ||
| | ||
LL | todo!(); | ||
| ^^^^^^^^ | ||
| | ||
= note: `-D clippy::todo` implied by `-D warnings` | ||
|
||
error: `todo` should not be present in production code | ||
--> $DIR/panicking_macros.rs:15:5 | ||
--> $DIR/panicking_macros.rs:17:5 | ||
| | ||
LL | todo!("message"); | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: `todo` should not be present in production code | ||
--> $DIR/panicking_macros.rs:16:5 | ||
--> $DIR/panicking_macros.rs:18:5 | ||
| | ||
LL | todo!("{} {}", "panic with", "multiple arguments"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: `unimplemented` should not be present in production code | ||
--> $DIR/panicking_macros.rs:22:5 | ||
--> $DIR/panicking_macros.rs:24:5 | ||
| | ||
LL | unimplemented!(); | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::unimplemented` implied by `-D warnings` | ||
|
||
error: `unimplemented` should not be present in production code | ||
--> $DIR/panicking_macros.rs:23:5 | ||
--> $DIR/panicking_macros.rs:25:5 | ||
| | ||
LL | unimplemented!("message"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: `unimplemented` should not be present in production code | ||
--> $DIR/panicking_macros.rs:24:5 | ||
--> $DIR/panicking_macros.rs:26:5 | ||
| | ||
LL | unimplemented!("{} {}", "panic with", "multiple arguments"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: `unreachable` should not be present in production code | ||
--> $DIR/panicking_macros.rs:30:5 | ||
--> $DIR/panicking_macros.rs:32:5 | ||
| | ||
LL | unreachable!(); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::unreachable` implied by `-D warnings` | ||
|
||
error: `unreachable` should not be present in production code | ||
--> $DIR/panicking_macros.rs:31:5 | ||
--> $DIR/panicking_macros.rs:33:5 | ||
| | ||
LL | unreachable!("message"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: `unreachable` should not be present in production code | ||
--> $DIR/panicking_macros.rs:32:5 | ||
--> $DIR/panicking_macros.rs:34:5 | ||
| | ||
LL | unreachable!("{} {}", "panic with", "multiple arguments"); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 12 previous errors | ||
error: `panic` should not be present in production code | ||
--> $DIR/panicking_macros.rs:40:5 | ||
| | ||
LL | panic!(); | ||
| ^^^^^^^^^ | ||
|
||
error: `todo` should not be present in production code | ||
--> $DIR/panicking_macros.rs:41:5 | ||
| | ||
LL | todo!(); | ||
| ^^^^^^^^ | ||
|
||
error: `unimplemented` should not be present in production code | ||
--> $DIR/panicking_macros.rs:42:5 | ||
| | ||
LL | unimplemented!(); | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
||
error: `unreachable` should not be present in production code | ||
--> $DIR/panicking_macros.rs:43:5 | ||
| | ||
LL | unreachable!(); | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 16 previous errors | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.