Merge branch 'exterior_and_mutable_types' of git@github.com:graydon/rust into exterior_and_mutable_types
This commit is contained in:
commit
41fa7a404e
@ -1180,6 +1180,13 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
|
||||
| STMT_slice _ -> fmt ff "?stmt_slice?"
|
||||
end
|
||||
|
||||
and fmt_decl_param (ff:Format.formatter) (param:ty_param) : unit =
|
||||
let (ident, (i, e)) = param in
|
||||
fmt_effect ff e;
|
||||
if e <> PURE then fmt ff " ";
|
||||
fmt_ident ff ident;
|
||||
fmt ff "=<p#%d>" i
|
||||
|
||||
and fmt_decl_params (ff:Format.formatter) (params:ty_param array) : unit =
|
||||
if Array.length params = 0
|
||||
then ()
|
||||
@ -1190,11 +1197,7 @@ and fmt_decl_params (ff:Format.formatter) (params:ty_param array) : unit =
|
||||
do
|
||||
if i <> 0
|
||||
then fmt ff ", ";
|
||||
let (ident, (i, e)) = params.(i) in
|
||||
fmt_effect ff e;
|
||||
if e <> PURE then fmt ff " ";
|
||||
fmt_ident ff ident;
|
||||
fmt ff "=<p#%d>" i
|
||||
fmt_decl_param ff params.(i)
|
||||
done;
|
||||
fmt ff "]"
|
||||
end;
|
||||
@ -1350,6 +1353,7 @@ let sprintf_tag = sprintf_fmt fmt_tag;;
|
||||
let sprintf_carg = sprintf_fmt fmt_carg;;
|
||||
let sprintf_constr = sprintf_fmt fmt_constr;;
|
||||
let sprintf_mod_items = sprintf_fmt fmt_mod_items;;
|
||||
let sprintf_decl_param = sprintf_fmt fmt_decl_param;;
|
||||
let sprintf_decl_params = sprintf_fmt fmt_decl_params;;
|
||||
let sprintf_app_args = sprintf_fmt fmt_app_args;;
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
type option[T] = tag(none(), some(T));
|
||||
type box[T] = tup(@T);
|
||||
type boxo[T] = option[box[T]];
|
||||
type boxm[T] = tup(mutable @T);
|
||||
type boxmo[T] = option[boxm[T]];
|
||||
|
||||
type map[T, U] = fn(&T) -> U;
|
||||
|
||||
@ -17,28 +13,6 @@ fn option_map[T, U](map[T, U] f, &option[T] opt) -> option[U] {
|
||||
}
|
||||
}
|
||||
|
||||
fn unbox[T](&box[T] b) -> T {
|
||||
ret b._0;
|
||||
}
|
||||
|
||||
|
||||
fn unboxm[T](&boxm[T] b) -> T {
|
||||
ret b._0;
|
||||
}
|
||||
|
||||
fn unboxo[T](boxo[T] b) -> option[T] {
|
||||
// Pending issue #90, no need to alias the function item in order to pass
|
||||
// it as an arg.
|
||||
let map[box[T], T] f = unbox[T];
|
||||
be option_map[box[T], T](f, b);
|
||||
}
|
||||
|
||||
fn unboxmo[T](boxmo[T] b) -> option[T] {
|
||||
// Issue #90, as above
|
||||
let map[boxm[T], T] f = unboxm[T];
|
||||
be option_map[boxm[T], T](f, b);
|
||||
}
|
||||
|
||||
fn id[T](T x) -> T {
|
||||
ret x;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user