Prevent alias pass from inserting implicit copies for noncopyable types

Issue #1177
This commit is contained in:
Marijn Haverbeke 2011-11-18 09:46:44 +01:00
parent 17b78c4a7a
commit 7bef89f9b5
2 changed files with 4 additions and 6 deletions

View file

@ -28,8 +28,6 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) -> rval_map {
with *visit::default_visitor()
});
visit::visit_crate(*crate, ctx, visit);
// FIXME go through alias's copy_map, check implicit copies (either here,
// or in alias.rs)
tcx.sess.abort_if_errors();
ret ctx.rval_map;
}

View file

@ -1122,9 +1122,9 @@ pure fn type_has_dynamic_size(cx: ctxt, ty: t) -> bool {
}
}
// Returns true for types where a copy of a value can be distinguished from
// the value itself. I.e. types with mutable content that's not shared through
// a pointer.
// Returns true for noncopyable types and types where a copy of a value can be
// distinguished from the value itself. I.e. types with mutable content that's
// not shared through a pointer.
fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
ret !type_structurally_contains(cx, ty, fn (sty: sty) -> bool {
ret alt sty {
@ -1143,7 +1143,7 @@ fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
}
_ { false }
};
});
}) && type_kind(cx, t) != ast::kind_noncopyable;
}
fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {