Rust: Add type inference test with consistency issue

This commit is contained in:
Simon Friis Vindum
2025-07-24 11:55:23 +02:00
parent 9a0c5877ea
commit bb56b0d45b
4 changed files with 1157 additions and 1109 deletions

View File

@@ -1,8 +1,8 @@
multipleCallTargets
| dereference.rs:61:15:61:24 | e1.deref() |
| main.rs:2213:13:2213:31 | ...::from(...) |
| main.rs:2214:13:2214:31 | ...::from(...) |
| main.rs:2215:13:2215:31 | ...::from(...) |
| main.rs:2221:13:2221:31 | ...::from(...) |
| main.rs:2222:13:2222:31 | ...::from(...) |
| main.rs:2223:13:2223:31 | ...::from(...) |
| main.rs:2238:13:2238:31 | ...::from(...) |
| main.rs:2239:13:2239:31 | ...::from(...) |
| main.rs:2240:13:2240:31 | ...::from(...) |
| main.rs:2246:13:2246:31 | ...::from(...) |
| main.rs:2247:13:2247:31 | ...::from(...) |
| main.rs:2248:13:2248:31 | ...::from(...) |

View File

@@ -0,0 +1,3 @@
nonInjectiveTypeParameterId
| main.rs:1934:24:1934:31 | impl(T) | main.rs:1934:24:1934:31 | impl(T) |
| main.rs:1934:24:1934:31 | impl(T) | main.rs:1934:24:1934:31 | impl(T) |

View File

@@ -1931,6 +1931,10 @@ mod impl_trait {
Some(S3(x))
}
fn get_a_my_trait4<T: Clone>(x: T) -> (impl MyTrait<T>, impl MyTrait<T>) {
(S3(x.clone()), S3(x)) // $ target=clone
}
fn uses_my_trait2<A>(t: impl MyTrait<A>) -> A {
t.get_a() // $ target=MyTrait::get_a
}
@@ -1947,6 +1951,7 @@ mod impl_trait {
let e = get_a_my_trait2(S1).get_a(); // $ target=get_a_my_trait2 target=MyTrait::get_a type=e:S1
// For this function the `impl` type does not appear in the root of the return type
let f = get_a_my_trait3(S1).unwrap().get_a(); // $ target=get_a_my_trait3 target=unwrap target=MyTrait::get_a type=f:S1
let g = get_a_my_trait4(S1).0.get_a(); // $ target=get_a_my_trait4 target=MyTrait::get_a type=g:S1
}
}