about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs16
-rw-r--r--tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr19
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs
new file mode 100644
index 00000000000..bb10701cf6f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.rs
@@ -0,0 +1,16 @@
+// ICE expected ReFree to map to ReEarlyBound
+// issue: rust-lang/rust#108580
+//@ check-pass
+
+trait Foo {
+    fn bar(&self) -> impl Iterator<Item = impl Sized> + '_;
+}
+
+impl Foo for () {
+    fn bar(&self) -> impl Iterator + '_ {
+    //~^ WARN impl trait in impl method signature does not match trait method signature
+        vec![()].into_iter()
+    }
+}
+
+pub fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr
new file mode 100644
index 00000000000..94f068cabaa
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr
@@ -0,0 +1,19 @@
+warning: impl trait in impl method signature does not match trait method signature
+  --> $DIR/expeced-refree-to-map-to-reearlybound-ice-108580.rs:10:22
+   |
+LL |     fn bar(&self) -> impl Iterator<Item = impl Sized> + '_;
+   |                      ------------------------------------- return type from trait method defined here
+...
+LL |     fn bar(&self) -> impl Iterator + '_ {
+   |                      ^^^^^^^^^^^^^^^^^^
+   |
+   = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
+   = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
+   = note: `#[warn(refining_impl_trait_internal)]` on by default
+help: replace the return type so that it matches the trait
+   |
+LL |     fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ {
+   |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+warning: 1 warning emitted
+