Skip to content

Commit cbc9929

Browse files
bless tests, fix pesky type error
1 parent b3967c9 commit cbc9929

File tree

6 files changed

+19
-32
lines changed

6 files changed

+19
-32
lines changed

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -831,14 +831,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
831831
// of the `impl Sized`. Insert that here, so we don't ICE later.
832832
for assoc_item in tcx.associated_types_for_impl_traits_in_associated_fn(trait_m.def_id) {
833833
if !remapped_types.contains_key(assoc_item) {
834-
remapped_types.insert(
835-
*assoc_item,
836-
ty::EarlyBinder::bind(Ty::new_error_with_message(
837-
tcx,
838-
return_span,
839-
"missing synthetic item for RPITIT",
840-
)),
841-
);
834+
return Err(tcx.sess.delay_span_bug(return_span, "missing synthetic item for RPITIT"));
842835
}
843836
}
844837

tests/rustdoc/inline_cross/auxiliary/ret-pos-impl-trait-in-trait.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(return_position_impl_trait_in_trait)]
1+
#![feature(return_position_impl_trait_in_trait, refine)]
22

33
pub trait Trait {
44
fn create() -> impl Iterator<Item = u64> {
@@ -15,6 +15,7 @@ impl Trait for Basic {
1515
}
1616

1717
impl Trait for Intermediate {
18+
#[refine]
1819
fn create() -> std::ops::Range<u64> { // concrete return type
1920
0..1
2021
}

tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I {
1717
//~^ ERROR impl has stricter requirements than trait
1818

1919
fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
20+
//~^ ERROR impl method signature does not match trait method signature
2021
(*self).iter()
2122
}
2223
}

tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr

+15-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ help: copy the `where` clause predicates from the trait
1212
LL | where Self: 'b;
1313
| ~~~~~~~~~~~~~~
1414

15-
error: aborting due to previous error
15+
error: impl method signature does not match trait method signature
16+
--> $DIR/bad-item-bound-within-rpitit.rs:19:23
17+
|
18+
LL | fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
19+
| ----------------------------------------- return type from trait method defined here
20+
...
21+
LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
22+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23+
|
24+
help: replace the return type so that it matches the trait
25+
|
26+
LL | fn iter(&self) -> impl Iterator<Item = <&'a I as Iterable>::Item<'_>> + '_ {
27+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28+
29+
error: aborting due to 2 previous errors
1630

1731
For more information about this error, try `rustc --explain E0276`.

tests/ui/impl-trait/in-trait/foreign.current.stderr

-11
This file was deleted.

tests/ui/impl-trait/in-trait/foreign.next.stderr

-11
This file was deleted.

0 commit comments

Comments
 (0)