1
Fork 0

Address nits

This commit is contained in:
Michael Goulet 2022-09-02 16:55:24 +00:00
parent 249ede4195
commit 70775304cd
4 changed files with 9 additions and 7 deletions

View file

@ -1357,7 +1357,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
) )
} }
ImplTraitContext::InTrait => { ImplTraitContext::InTrait => {
// FIXME(RPITIT): Should we use def_node_id here?
self.lower_impl_trait_in_trait(span, def_node_id, |lctx| { self.lower_impl_trait_in_trait(span, def_node_id, |lctx| {
lctx.lower_param_bounds( lctx.lower_param_bounds(
bounds, bounds,

View file

@ -193,7 +193,6 @@ impl DefKind {
| DefKind::Variant | DefKind::Variant
| DefKind::Trait | DefKind::Trait
| DefKind::OpaqueTy | DefKind::OpaqueTy
| DefKind::ImplTraitPlaceholder
| DefKind::TyAlias | DefKind::TyAlias
| DefKind::ForeignTy | DefKind::ForeignTy
| DefKind::TraitAlias | DefKind::TraitAlias
@ -221,7 +220,8 @@ impl DefKind {
| DefKind::Use | DefKind::Use
| DefKind::ForeignMod | DefKind::ForeignMod
| DefKind::GlobalAsm | DefKind::GlobalAsm
| DefKind::Impl => None, | DefKind::Impl
| DefKind::ImplTraitPlaceholder => None,
} }
} }

View file

@ -2551,7 +2551,10 @@ pub enum TyKind<'hir> {
/// The generic argument list contains the lifetimes (and in the future /// The generic argument list contains the lifetimes (and in the future
/// possibly parameters) that are actually bound on the `impl Trait`. /// possibly parameters) that are actually bound on the `impl Trait`.
OpaqueDef(ItemId, &'hir [GenericArg<'hir>]), OpaqueDef(ItemId, &'hir [GenericArg<'hir>]),
/// The placeholder /// A type that represents an `impl Trait` in a trait function. This is
/// not an opaque type, since it acts more like an associated type than
/// an opaque, and since it needs no generics since it inherits those
/// from the item's parent.
ImplTraitInTrait(ItemId), ImplTraitInTrait(ItemId),
/// A trait object type `Bound1 + Bound2 + Bound3` /// A trait object type `Bound1 + Bound2 + Bound3`
/// where `Bound` is a trait or a lifetime. /// where `Bound` is a trait or a lifetime.

View file

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