diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-09-28 14:37:28 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-09-28 15:35:21 -0700 |
| commit | cb4e99b68809a17db5624aabbdf9189225333d85 (patch) | |
| tree | 05cb947d09288074da6f9dd6a77a98da9980b56a /src/comp/middle | |
| parent | 14bac217b0cfc5e1640a739605e3c3d7e33525c4 (diff) | |
Don't allow vectors of pinned kinds
Vectors of pinned kinds can't be safe because most interesting uses of vector perform copies
Diffstat (limited to 'src/comp/middle')
| -rw-r--r-- | src/comp/middle/kind.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/comp/middle/kind.rs b/src/comp/middle/kind.rs index f4c23d3d4d7..da908f55429 100644 --- a/src/comp/middle/kind.rs +++ b/src/comp/middle/kind.rs @@ -189,6 +189,9 @@ fn need_shared_or_pinned_ctor(tcx: ty::ctxt, a: @ast::expr, descr: str) { ast::expr_tup(_) { true } + ast::expr_vec(exprs, _) { + true + } _ { false } } } @@ -262,6 +265,13 @@ fn check_expr(tcx: ty::ctxt, e: @ast::expr) { need_shared_or_pinned_ctor(tcx, expr, "tuple parameter"); } } + ast::expr_vec(exprs, _) { + // Putting pinned things into vectors is pretty useless since vector + // addition can't work (it's a copy) + for expr in exprs { + need_expr_kind(tcx, expr, ast::kind_shared, "vector element"); + } + } _ { } } } |
