Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/regression.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/regression.rs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/regression.rs b/crates/hir-ty/src/tests/regression.rs index df49d7999f..a04c46f8ea 100644 --- a/crates/hir-ty/src/tests/regression.rs +++ b/crates/hir-ty/src/tests/regression.rs @@ -2598,3 +2598,51 @@ trait ColumnLike { "#, ); } + +#[test] +fn issue_21006_generic_predicates_for_param_supertrait_cycle() { + check_no_mismatches( + r#" +trait VCipherSuite {} + +trait CipherSuite +where + OprfHash<Self>: Hash, +{ +} + +type Bar<CS: CipherSuite> = <CS::Baz as VCipherSuite>::Hash; + +type OprfHash<CS: CipherSuite> = <CS::Baz as VCipherSuite>::Hash; + +impl<CS: CipherSuite> Foo<CS> { + fn seal() {} +} + "#, + ); +} + +#[test] +fn issue_21006_self_assoc_trait() { + check_types( + r#" +trait Baz { + fn baz(&self); +} + +trait Foo { + type Assoc; +} + +trait Bar: Foo +where + Self::Assoc: Baz, +{ + fn bar(v: Self::Assoc) { + let _ = v.baz(); + // ^ () + } +} + "#, + ); +} |