From c9159262d161cd64d828f7821dca5e07926e34f2 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 20 Nov 2017 11:09:45 -0300 Subject: [PATCH] Check NullaryOp Rvalue --- src/librustc_mir/transform/type_check.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/librustc_mir/transform/type_check.rs b/src/librustc_mir/transform/type_check.rs index 3599a3174f7..6c6ae3d02da 100644 --- a/src/librustc_mir/transform/type_check.rs +++ b/src/librustc_mir/transform/type_check.rs @@ -1137,6 +1137,15 @@ fn check_rvalue(&mut self, mir: &Mir<'tcx>, rvalue: &Rvalue<'tcx>, location: Loc } } + Rvalue::NullaryOp(_, ty) => { + let trait_ref = ty::TraitRef { + def_id: tcx.lang_items().sized_trait().unwrap(), + substs: tcx.mk_substs_trait(ty, &[]), + }; + + self.prove_trait_ref(trait_ref, location); + } + // FIXME: These other cases have to be implemented in future PRs Rvalue::Use(..) | Rvalue::Ref(..) | @@ -1145,8 +1154,7 @@ fn check_rvalue(&mut self, mir: &Mir<'tcx>, rvalue: &Rvalue<'tcx>, location: Loc Rvalue::BinaryOp(..) | Rvalue::CheckedBinaryOp(..) | Rvalue::UnaryOp(..) | - Rvalue::Discriminant(..) | - Rvalue::NullaryOp(..) => {} + Rvalue::Discriminant(..) => {} } }