Skip to content

Commit bd4fcd4

Browse files
committed
---
yaml --- r: 859 b: refs/heads/master c: ee90185 h: refs/heads/master i: 857: 4ad95cd 855: e366645 v: v3
1 parent 783098b commit bd4fcd4

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 429964b4393bb96b59d56c5687dd55e23a51c850
2+
refs/heads/master: ee901858a27bf00c7dd66e7cfecb9dd97029dba8

trunk/src/boot/me/type.ml

+20-1
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,23 @@ let process_crate (cx:Semant.ctxt) (crate:Ast.crate) : unit =
13081308
Common.err (Some item_id) "this function must return a value"
13091309
in
13101310

1311+
let check_fn_ty_validity item_id (ty_sig, _) =
1312+
let check_input_slot i slot =
1313+
match slot with
1314+
{
1315+
Ast.slot_ty = Some (Ast.TY_param _);
1316+
Ast.slot_mode = Ast.MODE_local
1317+
} ->
1318+
Common.err
1319+
(Some item_id)
1320+
"parameter %d of this type-parametric function must be \
1321+
passed by reference, not by value"
1322+
(i + 1)
1323+
| _ -> ()
1324+
in
1325+
Array.iteri check_input_slot ty_sig.Ast.sig_input_slots
1326+
in
1327+
13111328
let visit_mod_item_pre _ _ item =
13121329
let { Common.node = item; Common.id = item_id } = item in
13131330
match item.Ast.decl_item with
@@ -1316,7 +1333,9 @@ let process_crate (cx:Semant.ctxt) (crate:Ast.crate) : unit =
13161333
let fn_ty = Hashtbl.find cx.Semant.ctxt_all_item_types item_id in
13171334
begin
13181335
match fn_ty with
1319-
Ast.TY_fn ty_fn -> push_fn_ctx_of_ty_fn ty_fn
1336+
Ast.TY_fn ty_fn ->
1337+
check_fn_ty_validity item_id ty_fn;
1338+
push_fn_ctx_of_ty_fn ty_fn
13201339
| _ ->
13211340
Common.bug ()
13221341
"Type.visit_mod_item_pre: fn item didn't have a fn type"

trunk/src/lib/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tag list[T] {
1212
nil;
1313
}
1414

15-
fn foldl[T,U](&list[T] ls, U u, fn(&T t, U u) -> U f) -> U {
15+
fn foldl[T,U](&list[T] ls, &U u, fn(&T t, U u) -> U f) -> U {
1616
alt(ls) {
1717
case (cons[T](?hd, ?tl)) {
1818
auto u_ = f(hd, u);

0 commit comments

Comments
 (0)