1
Fork 0

small mir typeck cleanup

This commit is contained in:
lcnr 2022-04-07 11:16:37 +02:00
parent 6c943bad02
commit 7d2083c58e
3 changed files with 6 additions and 5 deletions

View file

@ -90,12 +90,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
locations: Locations, locations: Locations,
category: ConstraintCategory<'tcx>, category: ConstraintCategory<'tcx>,
) { ) {
self.prove_predicates( self.prove_predicate(
Some(ty::Binder::dummy(ty::PredicateKind::Trait(ty::TraitPredicate { ty::Binder::dummy(ty::PredicateKind::Trait(ty::TraitPredicate {
trait_ref, trait_ref,
constness: ty::BoundConstness::NotConst, constness: ty::BoundConstness::NotConst,
polarity: ty::ImplPolarity::Positive, polarity: ty::ImplPolarity::Positive,
}))), }))
.to_predicate(self.tcx()),
locations, locations,
category, category,
); );

View file

@ -268,7 +268,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
// } // }
// impl Foo for () { // impl Foo for () {
// type Bar = (); // type Bar = ();
// fn foo(&self) ->&() {} // fn foo(&self) -> &() {}
// } // }
// ``` // ```
// Both &Self::Bar and &() are WF // Both &Self::Bar and &() are WF

View file

@ -1911,7 +1911,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
} }
} }
&Rvalue::NullaryOp(_, ty) => { &Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, ty) => {
let trait_ref = ty::TraitRef { let trait_ref = ty::TraitRef {
def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)), def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
substs: tcx.mk_substs_trait(ty, &[]), substs: tcx.mk_substs_trait(ty, &[]),