Skip to content

Commit 995ebcc

Browse files
committed
Filter out RPITITs in astconv when checking for missing associated types
1 parent 24c0b81 commit 995ebcc

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
14401440
tcx.associated_items(pred.def_id())
14411441
.in_definition_order()
14421442
.filter(|item| item.kind == ty::AssocKind::Type)
1443+
.filter(|item| tcx.opt_rpitit_info(item.def_id).is_none())
14431444
.map(|item| item.def_id),
14441445
);
14451446
}

tests/ui/impl-trait/in-trait/issue-102140.stderr renamed to tests/ui/impl-trait/in-trait/issue-102140.current.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
2-
--> $DIR/issue-102140.rs:23:22
2+
--> $DIR/issue-102140.rs:26:22
33
|
44
LL | MyTrait::foo(&self)
55
| ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
@@ -13,15 +13,15 @@ LL + MyTrait::foo(self)
1313
|
1414

1515
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
16-
--> $DIR/issue-102140.rs:23:9
16+
--> $DIR/issue-102140.rs:26:9
1717
|
1818
LL | MyTrait::foo(&self)
1919
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
2020
|
2121
= help: the trait `MyTrait` is implemented for `Outer`
2222

2323
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
24-
--> $DIR/issue-102140.rs:23:9
24+
--> $DIR/issue-102140.rs:26:9
2525
|
2626
LL | MyTrait::foo(&self)
2727
| ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
2+
--> $DIR/issue-102140.rs:26:22
3+
|
4+
LL | MyTrait::foo(&self)
5+
| ------------ ^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
6+
| |
7+
| required by a bound introduced by this call
8+
|
9+
help: consider removing the leading `&`-reference
10+
|
11+
LL - MyTrait::foo(&self)
12+
LL + MyTrait::foo(self)
13+
|
14+
15+
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
16+
--> $DIR/issue-102140.rs:26:9
17+
|
18+
LL | MyTrait::foo(&self)
19+
| ^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
20+
|
21+
= help: the trait `MyTrait` is implemented for `Outer`
22+
23+
error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied
24+
--> $DIR/issue-102140.rs:26:9
25+
|
26+
LL | MyTrait::foo(&self)
27+
| ^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `&dyn MyTrait`
28+
|
29+
= help: the trait `MyTrait` is implemented for `Outer`
30+
31+
error: aborting due to 3 previous errors
32+
33+
For more information about this error, try `rustc --explain E0277`.

tests/ui/impl-trait/in-trait/issue-102140.rs

+3
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
#![allow(incomplete_features)]
36

0 commit comments

Comments
 (0)