Skip to content

Commit 5e0d8c3

Browse files
committed
add test for ICE: no errors encountered even though delay_span_bug issued, expected ReFree to map to ReEarlyBound rust-lang#108580
Fixes rust-lang#108580
1 parent 6203ebe commit 5e0d8c3

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// ICE expected ReFree to map to ReEarlyBound
2+
// issue: rust-lang/rust#108580
3+
//@ check-pass
4+
5+
trait Foo {
6+
fn bar(&self) -> impl Iterator<Item = impl Sized> + '_;
7+
}
8+
9+
impl Foo for () {
10+
fn bar(&self) -> impl Iterator + '_ {
11+
//~^ WARN impl trait in impl method signature does not match trait method signature
12+
vec![()].into_iter()
13+
}
14+
}
15+
16+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning: impl trait in impl method signature does not match trait method signature
2+
--> $DIR/expeced-refree-to-map-to-reearlybound-ice-108580.rs:10:22
3+
|
4+
LL | fn bar(&self) -> impl Iterator<Item = impl Sized> + '_;
5+
| ------------------------------------- return type from trait method defined here
6+
...
7+
LL | fn bar(&self) -> impl Iterator + '_ {
8+
| ^^^^^^^^^^^^^^^^^^
9+
|
10+
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
11+
= note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
12+
= note: `#[warn(refining_impl_trait_internal)]` on by default
13+
help: replace the return type so that it matches the trait
14+
|
15+
LL | fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ {
16+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
18+
warning: 1 warning emitted
19+

0 commit comments

Comments
 (0)