File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
branches/try/src/comp/middle Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: b9bb58f104400294d00cb821dfe15c19ed1b641d
5
+ refs/heads/try: 25d60172d6a66b2a620a228ce6642640e9faa517
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -215,9 +215,24 @@ fn maybe_copy(cx: ctx, ex: @expr) {
215
215
check_copy_ex ( cx, ex, true ) ;
216
216
}
217
217
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 ) == 0 u
224
+ }
225
+ _ { false }
226
+ }
227
+ }
228
+ _ { false }
229
+ }
230
+ }
231
+
218
232
fn check_copy_ex ( cx : ctx , ex: @expr, _warn : bool ) {
219
233
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) {
221
236
let ty = ty:: expr_ty ( cx. tcx , ex) ;
222
237
check_copy ( cx, ty, ex. span ) ;
223
238
// FIXME turn this on again once vector types are no longer unique.
You can’t perform that action at this time.
0 commit comments