]> git.lizzy.rs Git - rust.git/commitdiff
small mir typeck cleanup
authorlcnr <rust@lcnr.de>
Thu, 7 Apr 2022 09:16:37 +0000 (11:16 +0200)
committerlcnr <rust@lcnr.de>
Fri, 19 Aug 2022 14:38:26 +0000 (16:38 +0200)
compiler/rustc_borrowck/src/type_check/canonical.rs
compiler/rustc_borrowck/src/type_check/free_region_relations.rs
compiler/rustc_borrowck/src/type_check/mod.rs

index 6cfe5efb68886de601772d5f277627c277efb302..451b82c5c18700f07f1967ab571f604ebc9cf584 100644 (file)
@@ -90,12 +90,13 @@ pub(super) fn prove_trait_ref(
         locations: Locations,
         category: ConstraintCategory<'tcx>,
     ) {
-        self.prove_predicates(
-            Some(ty::Binder::dummy(ty::PredicateKind::Trait(ty::TraitPredicate {
+        self.prove_predicate(
+            ty::Binder::dummy(ty::PredicateKind::Trait(ty::TraitPredicate {
                 trait_ref,
                 constness: ty::BoundConstness::NotConst,
                 polarity: ty::ImplPolarity::Positive,
-            }))),
+            }))
+            .to_predicate(self.tcx()),
             locations,
             category,
         );
index 74655369faf0388d5872ffae944e3895202f3d4a..bb28622edf931b98b00bdeb27db1aab5d4a6e1c8 100644 (file)
@@ -268,7 +268,7 @@ pub(crate) fn create(mut self) -> CreateResult<'tcx> {
                 // }
                 // impl Foo for () {
                 //   type Bar = ();
-                //   fn foo(&self) ->&() {}
+                //   fn foo(&self) -> &() {}
                 // }
                 // ```
                 // Both &Self::Bar and &() are WF
index 7bf7f7357bf4f57c5d4f6d8cb71b447f2434aba2..bb2e773189c03ec720457a227e2a2b8d202fe71d 100644 (file)
@@ -1911,7 +1911,7 @@ fn check_rvalue(&mut self, body: &Body<'tcx>, rvalue: &Rvalue<'tcx>, location: L
                 }
             }
 
-            &Rvalue::NullaryOp(_, ty) => {
+            &Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, ty) => {
                 let trait_ref = ty::TraitRef {
                     def_id: tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
                     substs: tcx.mk_substs_trait(ty, &[]),