Prevent alias pass from inserting implicit copies for noncopyable types
Issue #1177
This commit is contained in:
parent
17b78c4a7a
commit
7bef89f9b5
@ -28,8 +28,6 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) -> rval_map {
|
|||||||
with *visit::default_visitor()
|
with *visit::default_visitor()
|
||||||
});
|
});
|
||||||
visit::visit_crate(*crate, ctx, visit);
|
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();
|
tcx.sess.abort_if_errors();
|
||||||
ret ctx.rval_map;
|
ret ctx.rval_map;
|
||||||
}
|
}
|
||||||
|
@ -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
|
// Returns true for noncopyable types and types where a copy of a value can be
|
||||||
// the value itself. I.e. types with mutable content that's not shared through
|
// distinguished from the value itself. I.e. types with mutable content that's
|
||||||
// a pointer.
|
// not shared through a pointer.
|
||||||
fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
|
fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
|
||||||
ret !type_structurally_contains(cx, ty, fn (sty: sty) -> bool {
|
ret !type_structurally_contains(cx, ty, fn (sty: sty) -> bool {
|
||||||
ret alt sty {
|
ret alt sty {
|
||||||
@ -1143,7 +1143,7 @@ fn type_allows_implicit_copy(cx: ctxt, ty: t) -> bool {
|
|||||||
}
|
}
|
||||||
_ { false }
|
_ { false }
|
||||||
};
|
};
|
||||||
});
|
}) && type_kind(cx, t) != ast::kind_noncopyable;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {
|
fn type_structurally_contains_uniques(cx: ctxt, ty: t) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user