File tree Expand file tree Collapse file tree 2 files changed +1554
-1511
lines changed
rust/ql/test/library-tests/type-inference Expand file tree Collapse file tree 2 files changed +1554
-1511
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,32 @@ mod method_impl {
90
90
}
91
91
}
92
92
93
+ mod trait_impl {
94
+ #[ derive( Debug ) ]
95
+ struct MyThing {
96
+ field : bool ,
97
+ }
98
+
99
+ trait MyTrait < B > {
100
+ fn trait_method ( self ) -> B ;
101
+ }
102
+
103
+ impl MyTrait < bool > for MyThing {
104
+ // MyThing::trait_method
105
+ fn trait_method ( self ) -> bool {
106
+ self . field // $ fieldof=MyThing
107
+ }
108
+ }
109
+
110
+ pub fn f ( ) {
111
+ let x = MyThing { field : true } ;
112
+ let a = x. trait_method ( ) ; // $ type=a:bool method=MyThing::trait_method
113
+
114
+ let y = MyThing { field : false } ;
115
+ let b = MyTrait :: trait_method ( y) ; // $ type=b:bool MISSING: method=MyThing::trait_method
116
+ }
117
+ }
118
+
93
119
mod method_non_parametric_impl {
94
120
#[ derive( Debug ) ]
95
121
struct MyThing < A > {
You can’t perform that action at this time.
0 commit comments