Rust: Add type inference test for associated type acces on a type parameter of an impl block

This commit is contained in:
Simon Friis Vindum
2026-02-05 13:15:22 +01:00
parent 78c262ca63
commit 0cd5366034
2 changed files with 528 additions and 495 deletions

View File

@@ -260,6 +260,16 @@ mod type_param_access_associated_type {
)
}
// Associated type accessed on a type parameter of an impl block
impl<TI> Wrapper<TI>
where
TI: GetSet,
{
fn extract(&self) -> TI::Output {
self.0.get() // $ fieldof=Wrapper target=GetSet::get
}
}
pub fn test() {
let _o1 = tp_with_as(S); // $ target=tp_with_as MISSING: type=_o1:S3
let _o2 = tp_without_as(S); // $ target=tp_without_as MISSING: type=_o2:S3
@@ -267,6 +277,9 @@ mod type_param_access_associated_type {
_o3, // $ MISSING: type=_o3:S3
_o4, // $ MISSING: type=_o4:bool
) = tp_assoc_from_supertrait(S); // $ target=tp_assoc_from_supertrait
let w = Wrapper(S);
let _extracted = w.extract(); // $ target=extract MISSING: type=_extracted:S3
}
}