address review comments

This commit is contained in:
Ariel Ben-Yehuda 2017-04-12 00:44:17 +03:00
parent 0144613078
commit 540a069761
1 changed files with 4 additions and 0 deletions

View File

@ -666,6 +666,10 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
let span = local_decl.source_info.span;
let ty = local_decl.ty;
if !ty.is_sized(self.tcx().global_tcx(), self.infcx.param_env(), span) {
// in current MIR construction, all non-control-flow rvalue
// expressions evaluate through `as_temp` or `into` a return
// slot or local, so to find all unsized rvalues it is enough
// to check all temps, return slots and locals.
if let None = self.reported_errors.replace((ty, span)) {
span_err!(self.tcx().sess, span, E0161,
"cannot move a value of type {0}: the size of {0} \