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 --- .../e0119/auxiliary/complex_impl_support.rs | 22 +++++++++++++++++++ .../error-codes/e0119/auxiliary/issue-23563-a.rs | 25 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/ui/error-codes/e0119/auxiliary/complex_impl_support.rs create mode 100644 tests/ui/error-codes/e0119/auxiliary/issue-23563-a.rs (limited to 'tests/ui/error-codes/e0119/auxiliary') diff --git a/tests/ui/error-codes/e0119/auxiliary/complex_impl_support.rs b/tests/ui/error-codes/e0119/auxiliary/complex_impl_support.rs new file mode 100644 index 000000000..ad5bb107f --- /dev/null +++ b/tests/ui/error-codes/e0119/auxiliary/complex_impl_support.rs @@ -0,0 +1,22 @@ +use std::marker::PhantomData; + +pub trait External {} + +pub struct M<'a, 'b, 'c, T, U, V> { + a: PhantomData<&'a ()>, + b: PhantomData<&'b ()>, + c: PhantomData<&'c ()>, + d: PhantomData, + e: PhantomData, + f: PhantomData, +} + +impl<'a, 'b, 'c, T, U, V, W> External for (T, M<'a, 'b, 'c, Box, V, W>) +where + 'b: 'a, + T: 'a, + U: (FnOnce(T) -> V) + 'static, + V: Iterator + Clone, + W: std::ops::Add, + W::Output: Copy, +{} diff --git a/tests/ui/error-codes/e0119/auxiliary/issue-23563-a.rs b/tests/ui/error-codes/e0119/auxiliary/issue-23563-a.rs new file mode 100644 index 000000000..141f36369 --- /dev/null +++ b/tests/ui/error-codes/e0119/auxiliary/issue-23563-a.rs @@ -0,0 +1,25 @@ +// Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 + +pub trait LolTo { + fn convert_to(&self) -> T; +} + +pub trait LolInto: Sized { + fn convert_into(self) -> T; +} + +pub trait LolFrom { + fn from(_: T) -> Self; +} + +impl<'a, T: ?Sized, U> LolInto for &'a T where T: LolTo { + fn convert_into(self) -> U { + self.convert_to() + } +} + +impl LolFrom for U where T: LolInto { + fn from(t: T) -> U { + t.convert_into() + } +} -- cgit v1.2.3