about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-24 10:35:24 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2024-03-24 10:35:24 +0100
commit5e0d8c3b6261db13d64d5f6aa43c7088876fbb20 (patch)
tree6846d15abf58182d7e652131b0209fdbd9125d1d /tests
parent6203ebe2747acb76a0bcf36b6e2429009a381cb0 (diff)
downloadrust-5e0d8c3b6261db13d64d5f6aa43c7088876fbb20.tar.gz
rust-5e0d8c3b6261db13d64d5f6aa43c7088876fbb20.zip
add test for ICE: no errors encountered even though delay_span_bug issued, expected ReFree to map to ReEarlyBound #108580
Fixes https://github.com/rust-lang/rust/issues/108580
Diffstat (limited to 'tests')
-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
+