Skip to content

Commit d84c74f

Browse files
committed
---
yaml --- r: 10918 b: refs/heads/master c: 25d6017 h: refs/heads/master v: v3
1 parent 61748c5 commit d84c74f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b9bb58f104400294d00cb821dfe15c19ed1b641d
2+
refs/heads/master: 25d60172d6a66b2a620a228ce6642640e9faa517
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/comp/middle/kind.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,24 @@ fn maybe_copy(cx: ctx, ex: @expr) {
215215
check_copy_ex(cx, ex, true);
216216
}
217217

218+
fn is_nullary_variant(cx: ctx, ex: @expr) -> bool {
219+
alt ex.node {
220+
expr_path(_) {
221+
alt cx.tcx.def_map.get(ex.id) {
222+
def_variant(edid, vdid) {
223+
vec::len(ty::enum_variant_with_id(cx.tcx, edid, vdid).args) == 0u
224+
}
225+
_ { false }
226+
}
227+
}
228+
_ { false }
229+
}
230+
}
231+
218232
fn check_copy_ex(cx: ctx, ex: @expr, _warn: bool) {
219233
if ty::expr_is_lval(cx.method_map, ex) &&
220-
!cx.last_uses.contains_key(ex.id) {
234+
!cx.last_uses.contains_key(ex.id) &&
235+
!is_nullary_variant(cx, ex) {
221236
let ty = ty::expr_ty(cx.tcx, ex);
222237
check_copy(cx, ty, ex.span);
223238
// FIXME turn this on again once vector types are no longer unique.

0 commit comments

Comments
 (0)