From 79ba84fa79959b3e4b1143861c0ae5d256f8a049 Mon Sep 17 00:00:00 2001 From: scalexm Date: Wed, 31 Oct 2018 19:03:23 +0100 Subject: [PATCH] Adjust documentation --- src/librustc/ty/subst.rs | 4 ++++ src/librustc_traits/lowering/mod.rs | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 636014023e1..b7f1731ba44 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -179,6 +179,10 @@ pub fn identity_for_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId) }) } + /// Creates a `Substs` that maps each generic parameter to a higher-ranked + /// var bound at index `0`. For types, we use a `BoundVar` index equal to + /// the type parameter index. For regions, we use the `BoundRegion::BrNamed` + /// variant (which has a def-id). pub fn bound_vars_for_item( tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 021ec18009a..27bf0a757b2 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -246,7 +246,8 @@ fn program_clauses_for_trait<'a, 'tcx>( // and that named bound regions have a def-id, it is safe // to just inject `hypotheses` (which contains named vars bound at index `0`) // into this binding level. This may change if we ever allow where clauses - // to bind types (e.g. for GATs things). + // to bind types (e.g. for GATs things), because bound types only use a `BoundVar` + // index (no def-id). hypotheses, category: ProgramClauseCategory::ImpliedBound, @@ -368,7 +369,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( }; let well_formed_clause = Clause::ForAll(ty::Binder::bind(well_formed_clause)); - // Rule FromEnv-Type + // Rule Implied-Bound-From-Type // // For each where clause `WC`: // ``` @@ -409,7 +410,7 @@ pub fn program_clauses_for_associated_type_def<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { - // Rule ProjectionEq-Skolemize + // Rule ProjectionEq-Placeholder // // ``` // trait Trait {