Skip to content

Commit 031640c

Browse files
authored
Rollup merge of #109414 - spastorino:new-rpitit-16, r=compiler-errors
Do not consider synthesized RPITITs on missing items checks Without this patch for `tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs` we get ... ``` warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes --> tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs:4:12 | 4 | #![feature(return_position_impl_trait_in_trait)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #91611 <#91611> for more information = note: `#[warn(incomplete_features)]` on by default error[E0046]: not all trait items implemented, missing: `foo`, `` --> tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs:12:1 | 8 | fn foo(&self) -> impl Sized; | ---------------------------- | | | | | `` from trait | `foo` from trait ... 12 | impl MyTrait for i32 { | ^^^^^^^^^^^^^^^^^^^^ missing `foo`, `` in implementation error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0046`. ``` instead of ... ``` warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/dont-project-to-rpitit-with-no-value.rs:4:12 | LL | #![feature(return_position_impl_trait_in_trait)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #91611 <#91611> for more information = note: `#[warn(incomplete_features)]` on by default error[E0046]: not all trait items implemented, missing: `foo` --> $DIR/dont-project-to-rpitit-with-no-value.rs:12:1 | LL | fn foo(&self) -> impl Sized; | ---------------------------- `foo` from trait ... LL | impl MyTrait for i32 { | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0046`. ``` r? `@compiler-errors`
2 parents b9151b2 + 364a5d4 commit 031640c

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

compiler/rustc_hir_analysis/src/check/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,11 @@ fn missing_items_err(
202202
missing_items: &[ty::AssocItem],
203203
full_impl_span: Span,
204204
) {
205+
let missing_items =
206+
missing_items.iter().filter(|trait_item| tcx.opt_rpitit_info(trait_item.def_id).is_none());
207+
205208
let missing_items_msg = missing_items
206-
.iter()
209+
.clone()
207210
.map(|trait_item| trait_item.name.to_string())
208211
.collect::<Vec<_>>()
209212
.join("`, `");

tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.stderr tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.current.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/dont-project-to-rpitit-with-no-value.rs:1:12
2+
--> $DIR/dont-project-to-rpitit-with-no-value.rs:4:12
33
|
44
LL | #![feature(return_position_impl_trait_in_trait)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![feature(return_position_impl_trait_in_trait)]
88
= note: `#[warn(incomplete_features)]` on by default
99

1010
error[E0046]: not all trait items implemented, missing: `foo`
11-
--> $DIR/dont-project-to-rpitit-with-no-value.rs:9:1
11+
--> $DIR/dont-project-to-rpitit-with-no-value.rs:12:1
1212
|
1313
LL | fn foo(&self) -> impl Sized;
1414
| ---------------------------- `foo` from trait
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
warning: the feature `return_position_impl_trait_in_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/dont-project-to-rpitit-with-no-value.rs:4:12
3+
|
4+
LL | #![feature(return_position_impl_trait_in_trait)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
error[E0046]: not all trait items implemented, missing: `foo`
11+
--> $DIR/dont-project-to-rpitit-with-no-value.rs:12:1
12+
|
13+
LL | fn foo(&self) -> impl Sized;
14+
| ---------------------------- `foo` from trait
15+
...
16+
LL | impl MyTrait for i32 {
17+
| ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
18+
19+
error: aborting due to previous error; 1 warning emitted
20+
21+
For more information about this error, try `rustc --explain E0046`.

tests/ui/impl-trait/in-trait/dont-project-to-rpitit-with-no-value.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
2+
// revisions: current next
3+
14
#![feature(return_position_impl_trait_in_trait)]
25
//~^ WARN the feature `return_position_impl_trait_in_trait` is incomplete
36

@@ -7,7 +10,7 @@ trait MyTrait {
710
}
811

912
impl MyTrait for i32 {
10-
//~^ ERROR not all trait items implemented, missing: `foo`
13+
//~^ ERROR not all trait items implemented, missing: `foo`
1114
fn bar(&self) -> impl Sized {
1215
self.foo()
1316
}

0 commit comments

Comments
 (0)