From 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:03:36 +0200 Subject: Adding upstream version 1.65.0+dfsg1. Signed-off-by: Daniel Baumann --- .../generic_const_exprs/issue-86710.rs | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-86710.rs (limited to 'src/test/ui/const-generics/generic_const_exprs/issue-86710.rs') diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs b/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs new file mode 100644 index 000000000..bdd8a21b3 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs @@ -0,0 +1,73 @@ +// build-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +use std::marker::PhantomData; + +fn main() { + let x = FooImpl::> { phantom: PhantomData }; + let _ = x.foo::>(); +} + +trait Foo +where + T: Bar, +{ + fn foo(&self) + where + T: Operation, + >::Output: Bar; +} + +struct FooImpl +where + T: Bar, +{ + phantom: PhantomData, +} + +impl Foo for FooImpl +where + T: Bar, +{ + fn foo(&self) + where + T: Operation, + >::Output: Bar, + { + <>::Output as Bar>::error_occurs_here(); + } +} + +trait Bar { + fn error_occurs_here(); +} + +struct BarImpl; + +impl Bar for BarImpl { + fn error_occurs_here() {} +} + +trait Operation { + type Output; +} + +//// Part-A: This causes error. +impl Operation> for BarImpl +where + BarImpl<{ N + M }>: Sized, +{ + type Output = BarImpl<{ N + M }>; +} + +//// Part-B: This doesn't cause error. +// impl Operation> for BarImpl { +// type Output = BarImpl; +// } + +//// Part-C: This also doesn't cause error. +// impl Operation> for BarImpl { +// type Output = BarImpl<{ M }>; +// } -- cgit v1.2.3