From 330b7eda952689b03a66c9e22361d6153c321648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 9 Oct 2018 19:00:41 -0700 Subject: [PATCH] Add regression test (#22872) --- src/test/ui/issues/issue-22872.rs | 23 +++++++++++++++++++++++ src/test/ui/issues/issue-22872.stderr | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/test/ui/issues/issue-22872.rs create mode 100644 src/test/ui/issues/issue-22872.stderr diff --git a/src/test/ui/issues/issue-22872.rs b/src/test/ui/issues/issue-22872.rs new file mode 100644 index 00000000000..7a83b098e78 --- /dev/null +++ b/src/test/ui/issues/issue-22872.rs @@ -0,0 +1,23 @@ +trait Wrap<'b> { + fn foo(&'b mut self); +} + +struct Wrapper

(P); + +impl<'b, P> Wrap<'b> for Wrapper

+where P: Process<'b>, +

>::Item: Iterator { + fn foo(&mut self) {} +} + + +pub trait Process<'a> { + type Item; + fn bar(&'a self); +} + +fn push_process

(process: P) where P: Process<'static> { + let _: Box Wrap<'b>> = Box::new(Wrapper(process)); +} + +fn main() {} diff --git a/src/test/ui/issues/issue-22872.stderr b/src/test/ui/issues/issue-22872.stderr new file mode 100644 index 00000000000..231080add9b --- /dev/null +++ b/src/test/ui/issues/issue-22872.stderr @@ -0,0 +1,23 @@ +error[E0277]: the trait bound `for<'b> P: Process<'b>` is not satisfied + --> $DIR/issue-22872.rs:20:36 + | +LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Process<'b>` is not implemented for `P` + | + = help: consider adding a `where for<'b> P: Process<'b>` bound + = note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper

` + = note: required for the cast to the object type `dyn for<'b> Wrap<'b>` + +error[E0277]: `

>::Item` is not an iterator + --> $DIR/issue-22872.rs:20:36 + | +LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator + | + = help: the trait `for<'b> std::iter::Iterator` is not implemented for `

>::Item` + = note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper

` + = note: required for the cast to the object type `dyn for<'b> Wrap<'b>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`.