From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/associated-types/issue-88856.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/ui/associated-types/issue-88856.rs (limited to 'tests/ui/associated-types/issue-88856.rs') diff --git a/tests/ui/associated-types/issue-88856.rs b/tests/ui/associated-types/issue-88856.rs new file mode 100644 index 000000000..7cae7c71c --- /dev/null +++ b/tests/ui/associated-types/issue-88856.rs @@ -0,0 +1,32 @@ +// check-pass + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub trait Trait{ + type R; + fn func(self)->Self::R; +} + +pub struct TraitImpl(pub i32); + +impl Trait for TraitImpl +where [();N/2]:, +{ + type R = Self; + fn func(self)->Self::R { + self + } +} + +fn sample(p:P,f:Convert) -> i32 +where + P:Trait,Convert:Fn(P::R)->i32 +{ + f(p.func()) +} + +fn main() { + let t = TraitImpl::<10>(4); + sample(t,|x|x.0); +} -- cgit v1.2.3