File tree 2 files changed +48
-0
lines changed
tests/ui/explicit-tail-calls 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( explicit_tail_calls) ]
2
+ use std:: panic:: Location ;
3
+
4
+ fn get_some_location1 ( ) -> & ' static Location < ' static > {
5
+ #[ track_caller]
6
+ fn inner ( ) -> & ' static Location < ' static > {
7
+ become Location :: caller ( )
8
+ }
9
+
10
+ become inner( )
11
+ //~^ error: a function mot marked with `#[track_caller]` cannot tail-call one that is
12
+ }
13
+
14
+ #[ track_caller]
15
+ fn get_some_location2 ( ) -> & ' static Location < ' static > {
16
+ fn inner ( ) -> & ' static Location < ' static > {
17
+ become Location :: caller ( )
18
+ //~^ error: a function mot marked with `#[track_caller]` cannot tail-call one that is
19
+ }
20
+
21
+ become inner( )
22
+ //~^ error: a function marked with `#[track_caller]` cannot tail-call one that is not
23
+ }
24
+
25
+ fn main ( ) {
26
+ get_some_location1 ( ) ;
27
+ get_some_location2 ( ) ;
28
+ }
Original file line number Diff line number Diff line change
1
+ error: a function mot marked with `#[track_caller]` cannot tail-call one that is
2
+ --> $DIR/caller-location-mismatch.rs:10:5
3
+ |
4
+ LL | become inner()
5
+ | ^^^^^^^^^^^^^^
6
+
7
+ error: a function marked with `#[track_caller]` cannot tail-call one that is not
8
+ --> $DIR/caller-location-mismatch.rs:21:5
9
+ |
10
+ LL | become inner()
11
+ | ^^^^^^^^^^^^^^
12
+
13
+ error: a function mot marked with `#[track_caller]` cannot tail-call one that is
14
+ --> $DIR/caller-location-mismatch.rs:17:9
15
+ |
16
+ LL | become Location::caller()
17
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
18
+
19
+ error: aborting due to 3 previous errors
20
+
You can’t perform that action at this time.
0 commit comments