1
Fork 0

Prevent the creation of TraitRef without dedicated methods

This commit is contained in:
Oli Scherer 2022-12-13 11:18:58 +00:00
parent a5cd3bde95
commit 6af3638709
9 changed files with 44 additions and 47 deletions

View file

@ -570,7 +570,7 @@ fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
assoc_item,
assoc_item,
default.span,
ty::TraitRef { def_id: it.owner_id.to_def_id(), substs: trait_substs },
tcx.mk_trait_ref(it.owner_id.to_def_id(), trait_substs),
);
}
_ => {}

View file

@ -160,7 +160,7 @@ fn variance_of_opaque(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Varianc
// instead of requiring an additional `+ 'a`.
match pred.kind().skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(ty::TraitPredicate {
trait_ref: ty::TraitRef { def_id: _, substs },
trait_ref: ty::TraitRef { def_id: _, substs, .. },
constness: _,
polarity: _,
})) => {