Skip to content

Commit e9b87c1

Browse files
committed
---
yaml --- r: 5727 b: refs/heads/master c: 8db7153 h: refs/heads/master i: 5725: 4dfcaf4 5723: 1eb672a 5719: 8ee6215 5711: 9fb5a03 5695: e3a4f43 v: v3
1 parent 82d8e18 commit e9b87c1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 2ff89469d43a3da326d7da50e4a97fb9c0ba359b
2+
refs/heads/master: 8db71530f55d21b9b5d076ac24242eb74e2f96bd

trunk/src/comp/middle/alias.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,18 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> copy_map {
5757
ret cx.copy_map;
5858
}
5959

60-
fn visit_fn(cx: @ctx, f: ast::_fn, _tp: [ast::ty_param], _sp: span,
61-
_name: fn_ident, _id: ast::node_id, sc: scope, v: vt<scope>) {
60+
fn visit_fn(cx: @ctx, f: ast::_fn, _tp: [ast::ty_param], sp: span,
61+
_name: fn_ident, id: ast::node_id, sc: scope, v: vt<scope>) {
6262
visit::visit_fn_decl(f.decl, sc, v);
63+
let args = ty::ty_fn_args(cx.tcx, ty::node_id_to_type(cx.tcx, id));
64+
for arg in args {
65+
if arg.mode == ast::by_val &&
66+
ty::type_has_dynamic_size(cx.tcx, arg.ty) {
67+
cx.tcx.sess.span_err
68+
(sp, "can not pass a dynamically-sized type by value");
69+
}
70+
}
71+
6372
let bs = alt f.proto {
6473
// Blocks need to obey any restrictions from the enclosing scope.
6574
ast::proto_block. | ast::proto_closure. { sc.bs }

0 commit comments

Comments
 (0)