Skip to content

Commit

Permalink
Check NullaryOp Rvalue
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino authored and nikomatsakis committed Dec 13, 2017
1 parent 7f20b91 commit c915926
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/librustc_mir/transform/type_check.rs
Expand Up @@ -1137,6 +1137,15 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
}
}

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(..) |
Expand All @@ -1145,8 +1154,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
Rvalue::BinaryOp(..) |
Rvalue::CheckedBinaryOp(..) |
Rvalue::UnaryOp(..) |
Rvalue::Discriminant(..) |
Rvalue::NullaryOp(..) => {}
Rvalue::Discriminant(..) => {}
}
}

Expand Down

0 comments on commit c915926

Please sign in to comment.