diff options
| author | Michael Goulet <michael@errs.io> | 2022-09-02 16:55:24 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-09-09 01:31:45 +0000 |
| commit | 70775304cd83bf01bf91d5cf206923064fca68ef (patch) | |
| tree | 92b44a10d78c7770433e8cabeb36f6e90190d5c0 /compiler | |
| parent | 249ede4195a40147c45411f1fa27e376d40f4f95 (diff) | |
| download | rust-70775304cd83bf01bf91d5cf206923064fca68ef.tar.gz rust-70775304cd83bf01bf91d5cf206923064fca68ef.zip | |
Address nits
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/def.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/project.rs | 6 |
4 files changed, 9 insertions, 7 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 8814d184c55..8fa2c593193 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1357,7 +1357,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { ) } ImplTraitContext::InTrait => { - // FIXME(RPITIT): Should we use def_node_id here? self.lower_impl_trait_in_trait(span, def_node_id, |lctx| { lctx.lower_param_bounds( bounds, diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index 8563b588585..e7c26bd726f 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -193,7 +193,6 @@ impl DefKind { | DefKind::Variant | DefKind::Trait | DefKind::OpaqueTy - | DefKind::ImplTraitPlaceholder | DefKind::TyAlias | DefKind::ForeignTy | DefKind::TraitAlias @@ -221,7 +220,8 @@ impl DefKind { | DefKind::Use | DefKind::ForeignMod | DefKind::GlobalAsm - | DefKind::Impl => None, + | DefKind::Impl + | DefKind::ImplTraitPlaceholder => None, } } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 334d4fd0b04..8b1ebe34cb0 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2551,7 +2551,10 @@ pub enum TyKind<'hir> { /// The generic argument list contains the lifetimes (and in the future /// possibly parameters) that are actually bound on the `impl Trait`. 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), /// A trait object type `Bound1 + Bound2 + Bound3` /// where `Bound` is a trait or a lifetime. diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 6ccb91c8cab..6c9efea8ca8 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1308,9 +1308,9 @@ fn project<'cx, 'tcx>( } } -/// The first thing we have to do is scan through the parameter -/// environment to see whether there are any projection predicates -/// there that can answer this question. +/// If the predicate's item is an `ImplTraitPlaceholder`, we do a select on the +/// corresponding trait ref. If this yields an `impl`, then we're able to project +/// 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>( selcx: &mut SelectionContext<'cx, 'tcx>, obligation: &ProjectionTyObligation<'tcx>, |
