From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/mir/issue-101844.rs | 73 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 tests/ui/mir/issue-101844.rs (limited to 'tests/ui/mir/issue-101844.rs') diff --git a/tests/ui/mir/issue-101844.rs b/tests/ui/mir/issue-101844.rs new file mode 100644 index 000000000..da8a25f5f --- /dev/null +++ b/tests/ui/mir/issue-101844.rs @@ -0,0 +1,73 @@ +// check-pass + +pub trait FirstTrait { + type Item; + type Extra: Extra<(), Error = Self::Item>; +} + +trait SecondTrait { + type Item2; +} + +trait ThirdTrait: SecondTrait { + type Item3; +} + +trait FourthTrait { + type Item4; +} + +impl SecondTrait for First +where + First: FirstTrait, +{ + type Item2 = First::Extra; +} + +impl ThirdTrait for Second +where + Second: SecondTrait, +{ + type Item3 = T; +} + +impl FourthTrait for Third +where + Third: ThirdTrait, +{ + type Item4 = S; +} + +pub trait Extra { + type Error; +} + +struct ImplShoulExist { + _gen: (D, Req), +} + +impl ImplShoulExist +where + D: FourthTrait, + D::Item4: Extra, + >::Error: Into<()>, +{ + fn access_fn(_: D) { + todo!() + } +} + +impl Extra for ImplShoulExist { + type Error = (); +} + +pub fn broken(ms: MS) +where + MS: FirstTrait, + MS::Item: Into<()>, +{ + // Error: Apparently Balance::new doesn't exist during MIR validation + let _ = ImplShoulExist::::access_fn(ms); +} + +fn main() {} -- cgit v1.2.3