Skip to content

Commit 7077530

Browse files
Address nits
1 parent 249ede4 commit 7077530

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
13571357
)
13581358
}
13591359
ImplTraitContext::InTrait => {
1360-
// FIXME(RPITIT): Should we use def_node_id here?
13611360
self.lower_impl_trait_in_trait(span, def_node_id, |lctx| {
13621361
lctx.lower_param_bounds(
13631362
bounds,

compiler/rustc_hir/src/def.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ impl DefKind {
193193
| DefKind::Variant
194194
| DefKind::Trait
195195
| DefKind::OpaqueTy
196-
| DefKind::ImplTraitPlaceholder
197196
| DefKind::TyAlias
198197
| DefKind::ForeignTy
199198
| DefKind::TraitAlias
@@ -221,7 +220,8 @@ impl DefKind {
221220
| DefKind::Use
222221
| DefKind::ForeignMod
223222
| DefKind::GlobalAsm
224-
| DefKind::Impl => None,
223+
| DefKind::Impl
224+
| DefKind::ImplTraitPlaceholder => None,
225225
}
226226
}
227227

compiler/rustc_hir/src/hir.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2551,7 +2551,10 @@ pub enum TyKind<'hir> {
25512551
/// The generic argument list contains the lifetimes (and in the future
25522552
/// possibly parameters) that are actually bound on the `impl Trait`.
25532553
OpaqueDef(ItemId, &'hir [GenericArg<'hir>]),
2554-
/// The placeholder
2554+
/// A type that represents an `impl Trait` in a trait function. This is
2555+
/// not an opaque type, since it acts more like an associated type than
2556+
/// an opaque, and since it needs no generics since it inherits those
2557+
/// from the item's parent.
25552558
ImplTraitInTrait(ItemId),
25562559
/// A trait object type `Bound1 + Bound2 + Bound3`
25572560
/// where `Bound` is a trait or a lifetime.

compiler/rustc_trait_selection/src/traits/project.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,9 +1308,9 @@ fn project<'cx, 'tcx>(
13081308
}
13091309
}
13101310

1311-
/// The first thing we have to do is scan through the parameter
1312-
/// environment to see whether there are any projection predicates
1313-
/// there that can answer this question.
1311+
/// If the predicate's item is an `ImplTraitPlaceholder`, we do a select on the
1312+
/// corresponding trait ref. If this yields an `impl`, then we're able to project
1313+
/// to a concrete type, since we have an `impl`'s method to provide the RPITIT.
13141314
fn assemble_candidate_for_impl_trait_in_trait<'cx, 'tcx>(
13151315
selcx: &mut SelectionContext<'cx, 'tcx>,
13161316
obligation: &ProjectionTyObligation<'tcx>,

0 commit comments

Comments
 (0)