diff --git a/src/test/ui/associated-types/issue-24159.rs b/src/test/ui/associated-types/issue-24159.rs new file mode 100644 index 0000000000000..49753e7bf1660 --- /dev/null +++ b/src/test/ui/associated-types/issue-24159.rs @@ -0,0 +1,37 @@ +// check-pass + +#![allow(unused)] + +trait Bar { + fn dummy(&self); +} + +trait Foo { + type A; + type B: Bar; + + fn get_b(&self) -> &Self::B; +} + +fn test_bar>(_: &B) {} + +fn test>(f: &F) { + test_bar(f.get_b()); +} + +trait Bar1 {} +trait Caz1 { + type A; + type B: Bar1; +} + +fn test1() where T: Caz1, U: Caz1 {} + +trait Bar2 {} +trait Caz2 { + type A; + type B: Bar2; +} +fn test2>() {} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-37808.rs b/src/test/ui/associated-types/issue-37808.rs new file mode 100644 index 0000000000000..3701c37d0c86f --- /dev/null +++ b/src/test/ui/associated-types/issue-37808.rs @@ -0,0 +1,19 @@ +// check-pass + +trait Parent { + type Ty; + type Assoc: Child; +} + +trait Child {} + +struct ChildWrapper(T); +impl Child for ChildWrapper where T: Child {} + +struct ParentWrapper(T); +impl> Parent for ParentWrapper { + type Ty = A; + type Assoc = ChildWrapper; +} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-37883.rs b/src/test/ui/associated-types/issue-37883.rs new file mode 100644 index 0000000000000..d854f6af3ea94 --- /dev/null +++ b/src/test/ui/associated-types/issue-37883.rs @@ -0,0 +1,25 @@ +// check-pass + +use std::ops::Mul; + +fn main() {} + +trait Ring {} +trait Real: Ring {} + +trait Module: Sized + Mul<::Ring, Output = Self> { + type Ring: Ring; +} + +trait EuclideanSpace { + type Coordinates: Module; + type Real: Real; +} + +trait Translation { + fn to_vector(&self) -> E::Coordinates; + + fn powf(&self, n: ::Ring) -> E::Coordinates { + self.to_vector() * n + } +} diff --git a/src/test/ui/associated-types/issue-39532.rs b/src/test/ui/associated-types/issue-39532.rs new file mode 100644 index 0000000000000..52652cedec961 --- /dev/null +++ b/src/test/ui/associated-types/issue-39532.rs @@ -0,0 +1,14 @@ +// check-pass + +#![allow(unused)] + +trait Foo { + type Bar; + type Baz: Bar; +} + +trait Bar {} + +fn x, U>(t: &T) {} + +fn main() {}