Skip to content

Commit c915926

Browse files
spastorinonikomatsakis
authored andcommitted
Check NullaryOp Rvalue
1 parent 7f20b91 commit c915926

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/librustc_mir/transform/type_check.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,15 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
11371137
}
11381138
}
11391139

1140+
Rvalue::NullaryOp(_, ty) => {
1141+
let trait_ref = ty::TraitRef {
1142+
def_id: tcx.lang_items().sized_trait().unwrap(),
1143+
substs: tcx.mk_substs_trait(ty, &[]),
1144+
};
1145+
1146+
self.prove_trait_ref(trait_ref, location);
1147+
}
1148+
11401149
// FIXME: These other cases have to be implemented in future PRs
11411150
Rvalue::Use(..) |
11421151
Rvalue::Ref(..) |
@@ -1145,8 +1154,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
11451154
Rvalue::BinaryOp(..) |
11461155
Rvalue::CheckedBinaryOp(..) |
11471156
Rvalue::UnaryOp(..) |
1148-
Rvalue::Discriminant(..) |
1149-
Rvalue::NullaryOp(..) => {}
1157+
Rvalue::Discriminant(..) => {}
11501158
}
11511159
}
11521160

0 commit comments

Comments
 (0)