From d10f6b44e1243bf4d68ed4f0f5038049330a047e Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 5 Dec 2022 04:38:58 +0000 Subject: [PATCH] Add test --- src/test/ui/lifetimes/conflicting-bounds.rs | 11 +++++++++++ src/test/ui/lifetimes/conflicting-bounds.stderr | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/test/ui/lifetimes/conflicting-bounds.rs create mode 100644 src/test/ui/lifetimes/conflicting-bounds.stderr diff --git a/src/test/ui/lifetimes/conflicting-bounds.rs b/src/test/ui/lifetimes/conflicting-bounds.rs new file mode 100644 index 00000000000..f37f163dbb6 --- /dev/null +++ b/src/test/ui/lifetimes/conflicting-bounds.rs @@ -0,0 +1,11 @@ +//~ type annotations needed: cannot satisfy `Self: Gen<'source>` + +pub trait Gen<'source> { + type Output; + + fn gen(&self) -> T + where + Self: for<'s> Gen<'s, Output = T>; +} + +fn main() {} diff --git a/src/test/ui/lifetimes/conflicting-bounds.stderr b/src/test/ui/lifetimes/conflicting-bounds.stderr new file mode 100644 index 00000000000..42aa393667d --- /dev/null +++ b/src/test/ui/lifetimes/conflicting-bounds.stderr @@ -0,0 +1,14 @@ +error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>` + | +note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found + --> $DIR/conflicting-bounds.rs:3:1 + | +LL | pub trait Gen<'source> { + | ^^^^^^^^^^^^^^^^^^^^^^ +... +LL | Self: for<'s> Gen<'s, Output = T>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`.