@@ -26,31 +26,29 @@ macro_rules! panic {
26
26
/// For details, see `std::macros`.
27
27
#[ cfg( not( bootstrap) ) ]
28
28
#[ macro_export]
29
- #[ allow_internal_unstable( core_panic, panic_internals) ]
29
+ #[ allow_internal_unstable( core_panic,
30
+ // FIXME(anp, eddyb) `core_intrinsics` is used here to allow calling
31
+ // the `caller_location` intrinsic, but once `#[track_caller]` is implemented,
32
+ // `panicking::{panic, panic_fmt}` can use that instead of a `Location` argument.
33
+ core_intrinsics,
34
+ ) ]
30
35
#[ stable( feature = "core" , since = "1.6.0" ) ]
31
36
macro_rules! panic {
32
37
( ) => (
33
38
$crate:: panic!( "explicit panic" )
34
39
) ;
35
- ( $msg: expr) => ( {
36
- const LOC : & $crate:: panic:: Location <' _> = & $crate:: panic:: Location :: internal_constructor(
37
- $crate:: file!( ) ,
38
- $crate:: line!( ) ,
39
- $crate:: column!( ) ,
40
- ) ;
41
- $crate:: panicking:: panic( $msg, LOC )
42
- } ) ;
40
+ ( $msg: expr) => (
41
+ $crate:: panicking:: panic( $msg, $crate:: intrinsics:: caller_location( ) )
42
+ ) ;
43
43
( $msg: expr, ) => (
44
44
$crate:: panic!( $msg)
45
45
) ;
46
- ( $fmt: expr, $( $arg: tt) +) => ( {
47
- const LOC : & $crate:: panic:: Location <' _> = & $crate:: panic:: Location :: internal_constructor(
48
- $crate:: file!( ) ,
49
- $crate:: line!( ) ,
50
- $crate:: column!( ) ,
51
- ) ;
52
- $crate:: panicking:: panic_fmt( $crate:: format_args!( $fmt, $( $arg) +) , LOC )
53
- } ) ;
46
+ ( $fmt: expr, $( $arg: tt) +) => (
47
+ $crate:: panicking:: panic_fmt(
48
+ $crate:: format_args!( $fmt, $( $arg) +) ,
49
+ $crate:: intrinsics:: caller_location( ) ,
50
+ )
51
+ ) ;
54
52
}
55
53
56
54
/// Asserts that two expressions are equal to each other (using [`PartialEq`]).
0 commit comments