Skip to content

Commit de564a5

Browse files
committed
Rust: Use verbose type paths in inline expectation comments
1 parent 68be006 commit de564a5

8 files changed

Lines changed: 153 additions & 129 deletions

File tree

rust/ql/test/library-tests/type-inference/associated_types.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ mod default_method_using_associated_type {
131131
println!("{:?}", y);
132132

133133
let x5 = S2;
134-
println!("{:?}", x5.m1()); // $ target=m1 type=x5.m1():A.S2
134+
println!("{:?}", x5.m1()); // $ target=m1 type=x5.m1()@Wrapper<A>:S2
135135
let x6 = S2;
136-
println!("{:?}", x6.m2()); // $ target=m2 type=x6.m2():A.S2
136+
println!("{:?}", x6.m2()); // $ target=m2 type=x6.m2()@Wrapper<A>:S2
137137
}
138138
}
139139

@@ -400,10 +400,10 @@ mod generic_associated_type {
400400
pub fn test() {
401401
let s = S;
402402
// Call to the method in `impl` block
403-
let _g1 = s.put(1i32); // $ target=S::put type=_g1:A.i32
403+
let _g1 = s.put(1i32); // $ target=S::put type=_g1@Wrapper<A>:i32
404404

405405
// Call to default implementation in `trait` block
406-
let _g2 = s.put_two(true, false); // $ target=MyTraitAssoc2::put_two MISSING: type=_g2:A.bool
406+
let _g2 = s.put_two(true, false); // $ target=MyTraitAssoc2::put_two MISSING: type=_g2@Wrapper<A>:bool
407407
}
408408
}
409409

@@ -534,12 +534,12 @@ mod generic_associated_type_name_clash {
534534
type Output = Result<Output, Output>;
535535

536536
fn get(&self) -> Self::Output {
537-
Ok(self.0) // $ fieldof=ST type=Ok(...):Result type=Ok(...):T.Output type=Ok(...):E.Output
537+
Ok(self.0) // $ fieldof=ST type=Ok(...):Result type=Ok(...)@Result<T>:Output type=Ok(...)@Result<E>:Output
538538
}
539539
}
540540

541541
pub fn test() {
542-
let _y = ST(true).get(); // $ type=_y:Result type=_y:T.bool type=_y:E.bool target=get
542+
let _y = ST(true).get(); // $ type=_y:Result type=_y@Result<T>:bool type=_y@Result<E>:bool target=get
543543
}
544544
}
545545

rust/ql/test/library-tests/type-inference/dereference.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<T> S<T> {
4646
fn explicit_monomorphic_dereference() {
4747
// Dereference with method call
4848
let a1 = MyIntPointer { value: 34i64 };
49-
let _b1 = a1.deref(); // $ target=MyIntPointer::deref type=_b1:TRef.i64
49+
let _b1 = a1.deref(); // $ target=MyIntPointer::deref type=_b1@&<TRef>:i64
5050

5151
// Dereference with overloaded dereference operator
5252
let a2 = MyIntPointer { value: 34i64 };
@@ -60,7 +60,7 @@ fn explicit_monomorphic_dereference() {
6060
fn explicit_polymorphic_dereference() {
6161
// Explicit dereference with type parameter
6262
let c1 = MySmartPointer { value: 'a' };
63-
let _d1 = c1.deref(); // $ target=MySmartPointer::deref type=_d1:TRef.char
63+
let _d1 = c1.deref(); // $ target=MySmartPointer::deref type=_d1@&<TRef>:char
6464

6565
// Explicit dereference with type parameter
6666
let c2 = MySmartPointer { value: 'a' };
@@ -74,7 +74,7 @@ fn explicit_polymorphic_dereference() {
7474
fn explicit_ref_dereference() {
7575
// Explicit dereference with type parameter
7676
let e1 = &'a';
77-
let _f1 = e1.deref(); // $ target=deref type=_f1:TRef.char
77+
let _f1 = e1.deref(); // $ target=deref type=_f1@&<TRef>:char
7878

7979
// Explicit dereference with type parameter
8080
let e2 = &'a';
@@ -88,7 +88,7 @@ fn explicit_ref_dereference() {
8888
fn explicit_box_dereference() {
8989
// Explicit dereference with type parameter
9090
let g1: Box<char> = Box::new('a'); // $ target=new
91-
let _h1 = g1.deref(); // $ target=deref type=_h1:TRef.char
91+
let _h1 = g1.deref(); // $ target=deref type=_h1@&<TRef>:char
9292

9393
// Explicit dereference with type parameter
9494
let g2: Box<char> = Box::new('a'); // $ target=new
@@ -109,9 +109,9 @@ fn implicit_dereference() {
109109
let _y = x.is_positive(); // $ target=is_positive type=_y:bool
110110

111111
let z = MySmartPointer { value: S(0i64) };
112-
let z_ = z.foo(); // $ target=foo type=z_:TRef.i64
112+
let z_ = z.foo(); // $ target=foo type=z_@&<TRef>:i64
113113

114-
let v = Vec::new(); // $ target=new type=v:T.i32
114+
let v = Vec::new(); // $ target=new type=v@Vec<T>:i32
115115
let mut x = MySmartPointer { value: v };
116116
x.push(0); // $ target=push
117117
}

0 commit comments

Comments
 (0)