We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16690cc commit e4d1b01Copy full SHA for e4d1b01
rust/ql/test/library-tests/type-inference/main.rs
@@ -90,6 +90,32 @@ mod method_impl {
90
}
91
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
119
mod method_non_parametric_impl {
120
#[derive(Debug)]
121
struct MyThing<A> {
0 commit comments