diff --git a/tests/ui/reborrow/coerce-shared-unnormalizable-target-issue-156699.rs b/tests/ui/reborrow/coerce-shared-unnormalizable-target-issue-156699.rs new file mode 100644 index 0000000000000..2c73ffaf91844 --- /dev/null +++ b/tests/ui/reborrow/coerce-shared-unnormalizable-target-issue-156699.rs @@ -0,0 +1,17 @@ +//! Regression test for . +//! +//! The target type of a `CoerceShared` impl that could not be normalized +//! used to cause an ICE instead of an error. + +#![feature(reborrow)] + +use std::marker::{CoerceShared, Reborrow}; + +struct Wrapper<'a, T>(&'a mut T); + +impl<'a, T> Reborrow for Wrapper<'a, T> {} + +impl<'a, T> CoerceShared<::Item> for Wrapper<'a, T> {} +//~^ ERROR `T` is not an iterator + +fn main() {} diff --git a/tests/ui/reborrow/coerce-shared-unnormalizable-target-issue-156699.stderr b/tests/ui/reborrow/coerce-shared-unnormalizable-target-issue-156699.stderr new file mode 100644 index 0000000000000..6c5e0978c0aa5 --- /dev/null +++ b/tests/ui/reborrow/coerce-shared-unnormalizable-target-issue-156699.stderr @@ -0,0 +1,14 @@ +error[E0277]: `T` is not an iterator + --> $DIR/coerce-shared-unnormalizable-target-issue-156699.rs:14:1 + | +LL | impl<'a, T> CoerceShared<::Item> for Wrapper<'a, T> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` is not an iterator + | +help: consider restricting type parameter `T` with trait `Iterator` + | +LL | impl<'a, T: std::iter::Iterator> CoerceShared<::Item> for Wrapper<'a, T> {} + | +++++++++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`.