Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8ca44ef

Browse files
committedJul 10, 2023
Auto merge of #112988 - spastorino:new-rpitit-24, r=compiler-errors
Replace RPITIT current impl with new strategy that lowers as a GAT This PR replaces the current implementation of RPITITs with the new implementation that we had under -Zlower-impl-trait-in-trait-to-assoc-ty flag that lowers the RPIT as a GAT on the trait and on the impls that implement that trait. Opening this PR as a draft because this goes after #112682, ~#112981~ and ~#112983~. As soon as those are merged, I can rebase and we should run perf, crater and test a lot. r? `@compiler-errors`
2 parents 05b82e5 + 20429af commit 8ca44ef

File tree

146 files changed

+1106
-586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+1106
-586
lines changed
 

‎compiler/rustc_hir/src/def.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ pub enum DefKind {
109109
InlineConst,
110110
/// Opaque type, aka `impl Trait`.
111111
OpaqueTy,
112-
/// A return-position `impl Trait` in a trait definition
113-
ImplTraitPlaceholder,
114112
Field,
115113
/// Lifetime parameter: the `'a` in `struct Foo<'a> { ... }`
116114
LifetimeParam,
@@ -143,7 +141,6 @@ impl DefKind {
143141
DefKind::Ctor(CtorOf::Struct, CtorKind::Fn) => "tuple struct",
144142
DefKind::Ctor(CtorOf::Struct, CtorKind::Const) => "unit struct",
145143
DefKind::OpaqueTy => "opaque type",
146-
DefKind::ImplTraitPlaceholder => "opaque type in trait",
147144
DefKind::TyAlias => "type alias",
148145
DefKind::TraitAlias => "trait alias",
149146
DefKind::AssocTy => "associated type",
@@ -227,8 +224,7 @@ impl DefKind {
227224
| DefKind::Use
228225
| DefKind::ForeignMod
229226
| DefKind::GlobalAsm
230-
| DefKind::Impl { .. }
231-
| DefKind::ImplTraitPlaceholder => None,
227+
| DefKind::Impl { .. } => None,
232228
}
233229
}
234230

@@ -262,7 +258,6 @@ impl DefKind {
262258
| DefKind::Use
263259
| DefKind::ForeignMod
264260
| DefKind::OpaqueTy
265-
| DefKind::ImplTraitPlaceholder
266261
| DefKind::Impl { .. }
267262
| DefKind::Field
268263
| DefKind::TyParam

‎compiler/rustc_hir/src/target.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub enum Target {
3636
GlobalAsm,
3737
TyAlias,
3838
OpaqueTy,
39-
ImplTraitPlaceholder,
4039
Enum,
4140
Variant,
4241
Struct,
@@ -80,13 +79,7 @@ impl Target {
8079
ItemKind::ForeignMod { .. } => Target::ForeignMod,
8180
ItemKind::GlobalAsm(..) => Target::GlobalAsm,
8281
ItemKind::TyAlias(..) => Target::TyAlias,
83-
ItemKind::OpaqueTy(ref opaque) => {
84-
if opaque.in_trait {
85-
Target::ImplTraitPlaceholder
86-
} else {
87-
Target::OpaqueTy
88-
}
89-
}
82+
ItemKind::OpaqueTy(..) => Target::OpaqueTy,
9083
ItemKind::Enum(..) => Target::Enum,
9184
ItemKind::Struct(..) => Target::Struct,
9285
ItemKind::Union(..) => Target::Union,
@@ -110,7 +103,6 @@ impl Target {
110103
DefKind::GlobalAsm => Target::GlobalAsm,
111104
DefKind::TyAlias => Target::TyAlias,
112105
DefKind::OpaqueTy => Target::OpaqueTy,
113-
DefKind::ImplTraitPlaceholder => Target::ImplTraitPlaceholder,
114106
DefKind::Enum => Target::Enum,
115107
DefKind::Struct => Target::Struct,
116108
DefKind::Union => Target::Union,
@@ -165,7 +157,6 @@ impl Target {
165157
Target::GlobalAsm => "global asm",
166158
Target::TyAlias => "type alias",
167159
Target::OpaqueTy => "opaque type",
168-
Target::ImplTraitPlaceholder => "opaque type in trait",
169160
Target::Enum => "enum",
170161
Target::Variant => "enum variant",
171162
Target::Struct => "struct",

0 commit comments

Comments
 (0)