]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2091-track-caller/diverging-caller-location.rs
Rollup merge of #94577 - RalfJung:simd-miri, r=scottmcm
[rust.git] / src / test / ui / rfc-2091-track-caller / diverging-caller-location.rs
1 // run-fail
2
3 //! This test ensures that `#[track_caller]` can be applied directly to diverging functions, as
4 //! the tracking issue says: https://github.com/rust-lang/rust/issues/47809#issue-292138490.
5 //! Because the annotated function must diverge and a panic keeps that faster than an infinite loop,
6 //! we don't inspect the location returned -- it would be difficult to distinguish between the
7 //! explicit panic and a failed assertion. That it compiles and runs is enough for this one.
8
9 #[track_caller]
10 fn doesnt_return() -> ! {
11     let _location = core::panic::Location::caller();
12     panic!("huzzah");
13 }
14
15 fn main() {
16     doesnt_return();
17 }