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
This commit is contained in:
Matthias Krüger 2024-03-24 10:35:24 +01:00
parent 6203ebe274
commit 5e0d8c3b62
2 changed files with 35 additions and 0 deletions

View File

@ -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() {}

View File

@ -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