Skip to content

Commit 7bef89f

Browse files
committed
Prevent alias pass from inserting implicit copies for noncopyable types
Issue #1177
1 parent 17b78c4 commit 7bef89f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/comp/middle/kind.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) -> rval_map {
2828
with *visit::default_visitor()
2929
});
3030
visit::visit_crate(*crate, ctx, visit);
31-
// FIXME go through alias's copy_map, check implicit copies (either here,
32-
// or in alias.rs)
3331
tcx.sess.abort_if_errors();
3432
ret ctx.rval_map;
3533
}

src/comp/middle/ty.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,9 @@ pure fn type_has_dynamic_size(cx: ctxt, ty: t) -> bool {
11221122
}
11231123
}
11241124

1125-
// Returns true for types where a copy of a value can be distinguished from
1126-
// the value itself. I.e. types with mutable content that's not shared through
1127-
// a pointer.
1125+
// Returns true for noncopyable types and types where a copy of a value can be
1126+
// distinguished from the value itself. I.e. types with mutable content that's
1127+
// not shared through a pointer.
11281128
fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
11291129
ret !type_structurally_contains(cx, ty, fn (sty: sty) -> bool {
11301130
ret alt sty {
@@ -1143,7 +1143,7 @@ fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
11431143
}
11441144
_ { false }
11451145
};
1146-
});
1146+
}) && type_kind(cx, t) != ast::kind_noncopyable;
11471147
}
11481148

11491149
fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {

0 commit comments

Comments
 (0)