Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions rust/ql/test/library-tests/type-inference/associated_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ mod default_method_using_associated_type {
println!("{:?}", y);

let x5 = S2;
println!("{:?}", x5.m1()); // $ target=m1 type=x5.m1():A.S2
println!("{:?}", x5.m1()); // $ target=m1 type=x5.m1()@Wrapper<A>:S2
let x6 = S2;
println!("{:?}", x6.m2()); // $ target=m2 type=x6.m2():A.S2
println!("{:?}", x6.m2()); // $ target=m2 type=x6.m2()@Wrapper<A>:S2
}
}

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

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

Expand Down Expand Up @@ -534,12 +534,12 @@ mod generic_associated_type_name_clash {
type Output = Result<Output, Output>;

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

pub fn test() {
let _y = ST(true).get(); // $ type=_y:Result type=_y:T.bool type=_y:E.bool target=get
let _y = ST(true).get(); // $ type=_y@Result<T>:bool type=_y@Result<E>:bool target=get
}
}

Expand Down
12 changes: 6 additions & 6 deletions rust/ql/test/library-tests/type-inference/dereference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<T> S<T> {
fn explicit_monomorphic_dereference() {
// Dereference with method call
let a1 = MyIntPointer { value: 34i64 };
let _b1 = a1.deref(); // $ target=MyIntPointer::deref type=_b1:TRef.i64
let _b1 = a1.deref(); // $ target=MyIntPointer::deref type=_b1@&<TRef>:i64

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

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

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

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

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

let v = Vec::new(); // $ target=new type=v:T.i32
let v = Vec::new(); // $ target=new type=v@Vec<T>:i32
let mut x = MySmartPointer { value: v };
x.push(0); // $ target=push
}
Expand Down
Loading
Loading