File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
tests/ui/explicit-tail-calls Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // A regression test for <https://github.com/rust-lang/rust/issues/144985>.
2
+ // Previously, using `become` in a default trait method would lead to an ICE
3
+ // in a path determining whether the method in question is marked as `#[track_caller]`.
4
+ //
5
+ //@ run-pass
6
+
7
+ #![ feature( explicit_tail_calls) ]
8
+ #![ expect( incomplete_features) ]
9
+
10
+ trait Trait {
11
+ fn bar ( & self ) -> usize {
12
+ 123
13
+ }
14
+
15
+ fn foo ( & self ) -> usize {
16
+ become self. bar ( ) ;
17
+ }
18
+ }
19
+
20
+ struct Struct ;
21
+
22
+ impl Trait for Struct { }
23
+
24
+ struct OtherStruct ;
25
+
26
+ impl Trait for OtherStruct {
27
+ #[ track_caller]
28
+ fn bar ( & self ) -> usize {
29
+ 456
30
+ }
31
+ }
32
+
33
+ fn main ( ) {
34
+ assert_eq ! ( Struct . foo( ) , 123 ) ;
35
+ assert_eq ! ( OtherStruct . foo( ) , 456 ) ;
36
+ }
You can’t perform that action at this time.
0 commit comments