@@ -26,31 +26,29 @@ macro_rules! panic {
2626/// For details, see `std::macros`.
2727#[ cfg( not( bootstrap) ) ]
2828#[ 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+ ) ]
3035#[ stable( feature = "core" , since = "1.6.0" ) ]
3136macro_rules! panic {
3237 ( ) => (
3338 $crate:: panic!( "explicit panic" )
3439 ) ;
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+ ) ;
4343 ( $msg: expr, ) => (
4444 $crate:: panic!( $msg)
4545 ) ;
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+ ) ;
5452}
5553
5654/// Asserts that two expressions are equal to each other (using [`PartialEq`]).
0 commit comments