From 782824c48f79d5fbe6732484e4b5cc4ab9892e41 Mon Sep 17 00:00:00 2001 From: Yerkebulan Tulibergenov Date: Tue, 15 Jun 2021 21:32:13 -0700 Subject: [PATCH] add regression test for issue #78632 --- src/test/ui/traits/issue-78632.rs | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/test/ui/traits/issue-78632.rs diff --git a/src/test/ui/traits/issue-78632.rs b/src/test/ui/traits/issue-78632.rs new file mode 100644 index 00000000000..c72a2aef490 --- /dev/null +++ b/src/test/ui/traits/issue-78632.rs @@ -0,0 +1,59 @@ +// check-pass +// +// Regression test for issue #78632 + +#![crate_type = "lib"] + +pub trait Corge { + type Fred; +} + +impl Corge for () { + type Fred = u32; +} + +pub trait Waldo { + type Quax; +} + +impl Waldo for u32 { + type Quax = u8; +} + +pub trait Grault +where + (): Corge, +{ + type Thud; + fn bar(_: <() as Corge>::Fred) {} +} + +impl Grault for T +where + T: Waldo, + (): Corge, + <() as Corge>::Fred: Waldo, +{ + type Thud = u8; +} + +pub trait Plugh { + fn baz(); +} + +#[derive(Copy, Clone, Debug)] +pub struct Qiz { + foo: T, +} + +impl Plugh<<() as Corge>::Fred> for Qiz +where + T: Grault, + (): Corge, +{ + fn baz() {} +} + +pub fn test() { + as Plugh>::baz(); +}