diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-18 09:46:44 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-11-18 12:49:01 +0100 |
| commit | 7bef89f9b5da4ab327a39419c176e65d6e8938b1 (patch) | |
| tree | 14b97fa4a7ff24d7d910edb4a16e6df0040055a8 | |
| parent | 17b78c4a7a8e2a1699e8443cc88fa5f3fd224368 (diff) | |
| download | rust-7bef89f9b5da4ab327a39419c176e65d6e8938b1.tar.gz rust-7bef89f9b5da4ab327a39419c176e65d6e8938b1.zip | |
Prevent alias pass from inserting implicit copies for noncopyable types
Issue #1177
| -rw-r--r-- | src/comp/middle/kind.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/ty.rs | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index abc7ee8413b..c8cb5007c04 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -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; } diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 5cd58c130f0..6a1e647e7f9 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -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 { |
