Skip to content

Commit 1c86de2

Browse files
authored
Rollup merge of #105628 - spastorino:small-doc-fixes, r=compiler-errors
Small doc fixes r? `@compiler-errors`
2 parents 15b9e20 + b22769a commit 1c86de2

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
7575

7676
const NO_GENERICS: &hir::Generics<'_> = hir::Generics::empty();
7777

78-
// We use an `IndexSet` to preserves order of insertion.
78+
// We use an `IndexSet` to preserve order of insertion.
7979
// Preserving the order of insertion is important here so as not to break UI tests.
8080
let mut predicates: FxIndexSet<(ty::Predicate<'_>, Span)> = FxIndexSet::default();
8181

@@ -97,11 +97,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
9797
| ItemKind::Struct(_, ref generics)
9898
| ItemKind::Union(_, ref generics) => *generics,
9999

100-
ItemKind::Trait(_, _, ref generics, ..) => {
101-
is_trait = Some(ty::TraitRef::identity(tcx, def_id));
102-
*generics
103-
}
104-
ItemKind::TraitAlias(ref generics, _) => {
100+
ItemKind::Trait(_, _, ref generics, ..) | ItemKind::TraitAlias(ref generics, _) => {
105101
is_trait = Some(ty::TraitRef::identity(tcx, def_id));
106102
*generics
107103
}
@@ -406,9 +402,10 @@ pub(super) fn explicit_predicates_of<'tcx>(
406402
// For a predicate from a where clause to become a bound on an
407403
// associated type:
408404
// * It must use the identity substs of the item.
409-
// * Since any generic parameters on the item are not in scope,
410-
// this means that the item is not a GAT, and its identity
411-
// substs are the same as the trait's.
405+
// * We're in the scope of the trait, so we can't name any
406+
// parameters of the GAT. That means that all we need to
407+
// check are that the substs of the projection are the
408+
// identity substs of the trait.
412409
// * It must be an associated type for this trait (*not* a
413410
// supertrait).
414411
if let ty::Projection(projection) = ty.kind() {

compiler/rustc_middle/src/ty/subst.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for GenericArg<'tcx> {
252252
}
253253
}
254254

255-
/// A substitution mapping generic parameters to new values.
255+
/// List of generic arguments that are gonna be used to substitute generic parameters.
256256
pub type InternalSubsts<'tcx> = List<GenericArg<'tcx>>;
257257

258258
pub type SubstsRef<'tcx> = &'tcx InternalSubsts<'tcx>;

0 commit comments

Comments
 (0)