Skip to content

Commit

Permalink
Auto merge of rust-lang#78343 - camelid:macros-qualify-panic, r=m-ou-se
Browse files Browse the repository at this point in the history
Qualify `panic!` as `core::panic!` in non-built-in `core` macros

Fixes rust-lang#78333.

-----

Otherwise code like this

    #![no_implicit_prelude]

    fn main() {
        ::std::todo!();
        ::std::unimplemented!();
    }

will fail to compile, which is unfortunate and presumably unintended.

This changes many invocations of `panic!` in a `macro_rules!` definition
to invocations of `$crate::panic!`, which makes the invocations hygienic.

Note that this does not make the built-in macro `assert!` hygienic.
  • Loading branch information
bors committed Nov 23, 2020
2 parents e5fddb6 + d708b44 commit d5b40bf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/ui/logic_bug.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused, clippy::many_single_char_names)]
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
#![warn(clippy::logic_bug)]

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/nonminimal_bool.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused, clippy::many_single_char_names)]
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
#![warn(clippy::nonminimal_bool)]

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/nonminimal_bool_methods.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(unused, clippy::many_single_char_names)]
#![allow(unused, clippy::many_single_char_names, clippy::diverging_sub_expression)]
#![warn(clippy::nonminimal_bool)]

fn methods_with_negation() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/wildcard_enum_match_arm.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
dead_code,
clippy::single_match,
clippy::wildcard_in_or_patterns,
clippy::unnested_or_patterns
clippy::unnested_or_patterns, clippy::diverging_sub_expression
)]

use std::io::ErrorKind;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/wildcard_enum_match_arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
dead_code,
clippy::single_match,
clippy::wildcard_in_or_patterns,
clippy::unnested_or_patterns
clippy::unnested_or_patterns, clippy::diverging_sub_expression
)]

use std::io::ErrorKind;
Expand Down

0 comments on commit d5b40bf

Please sign in to comment.