diff options
| author | Graydon Hoare <[email protected]> | 2010-10-14 12:41:48 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-10-14 12:41:48 -0700 |
| commit | f234750d802fde35f6607fd1599f805e490f3dd2 (patch) | |
| tree | 8cc749712920857e9a348e72b8a7855085b893c6 | |
| parent | Move the friendly-names table to semant, reuse it in the name mangler. (diff) | |
| download | rust-f234750d802fde35f6607fd1599f805e490f3dd2.tar.xz rust-f234750d802fde35f6607fd1599f805e490f3dd2.zip | |
Fix crasher in rustc.
| -rw-r--r-- | src/Makefile | 1 | ||||
| -rw-r--r-- | src/boot/be/abi.ml | 6 | ||||
| -rw-r--r-- | src/boot/me/semant.ml | 7 | ||||
| -rw-r--r-- | src/test/run-pass/drop-parametric-closure-with-bound-box.rs | 5 |
4 files changed, 14 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile index 12956baa..1b994940 100644 --- a/src/Makefile +++ b/src/Makefile @@ -465,6 +465,7 @@ TEST_XFAILS_LLVM := $(TASK_XFAILS) \ destructor-ordering.rs \ drop-bind-thunk-args.rs \ drop-on-empty-block-exit.rs \ + drop-parametric-closure-with-bound-box.rs \ export-non-interference.rs \ exterior.rs \ fn-lval.rs \ diff --git a/src/boot/be/abi.ml b/src/boot/be/abi.ml index 9ea085b5..13df33cd 100644 --- a/src/boot/be/abi.ml +++ b/src/boot/be/abi.ml @@ -62,10 +62,12 @@ let obj_body_elt_fields = 1;; let fn_field_code = binding_field_dispatch;; let fn_field_box = binding_field_bound_data;; +(* NB: bound ty params come last to facilitate ignoring them on + * closure-dropping. *) let closure_body_elt_bound_args_tydesc = 0;; let closure_body_elt_target = 1;; -let closure_body_elt_bound_ty_params = 2;; -let closure_body_elt_bound_args = 3;; +let closure_body_elt_bound_args = 2;; +let closure_body_elt_bound_ty_params = 3;; let tag_elt_discriminant = 0;; let tag_elt_variant = 1;; diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml index 010494b4..1e568df0 100644 --- a/src/boot/me/semant.ml +++ b/src/boot/me/semant.ml @@ -2219,9 +2219,10 @@ let rec closure_box_rty r (Array.init n_ty_params (fun _ -> tydesc)) in let bound_args = r (Array.map (slot_referent_type cx) bs) in - (* First tydesc is the one describing bound_args; second tydesc is the one - * to pass to targ when invoking it. *) - r [| rc; r [| tydesc; targ; ty_param_rtys; bound_args |] |] + (* First tydesc is the one describing bound_args; second tydesc cluster + * are those to pass to targ when invoking it, along with the merged + * bound args. *) + r [| rc; r [| tydesc; targ; bound_args; ty_param_rtys |] |] and fn_rty (cx:ctxt) (opaque_box_body:bool) : Il.referent_ty = let s t = Il.ScalarTy t in diff --git a/src/test/run-pass/drop-parametric-closure-with-bound-box.rs b/src/test/run-pass/drop-parametric-closure-with-bound-box.rs new file mode 100644 index 00000000..cf1ff750 --- /dev/null +++ b/src/test/run-pass/drop-parametric-closure-with-bound-box.rs @@ -0,0 +1,5 @@ +fn f[T](@int i, T t) {} + +fn main() { + auto x = bind f[char](@0xdeafbeef, _); +}
\ No newline at end of file |