Skip to content

Commit d608c5a

Browse files
committed
---
yaml --- r: 41415 b: refs/heads/snap-stage3 c: 76679c1 h: refs/heads/master i: 41413: 0362b32 41411: 240d6af 41407: d5c6340 v: v3
1 parent 1e582a7 commit d608c5a

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 63c16e9e79839ba767e2a8c7172d9a330c782600
4+
refs/heads/snap-stage3: 76679c1f91fc68134c850b2d77ff2b83b32a108f
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/trans/glue.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,30 @@ pub fn decr_refcnt_maybe_free(bcx: block,
571571
}
572572
}
573573

574+
pub fn copy_glue_should_never_be_called(bcx: block, t: ty::t) -> bool {
575+
match ty::get(t).sty {
576+
ty::ty_infer(*)
577+
| ty::ty_type
578+
| ty::ty_opaque_closure_ptr(*)
579+
| ty::ty_opaque_box
580+
| ty::ty_unboxed_vec(*)
581+
| ty::ty_err => {
582+
// Not sure under what scenarios these non-types get take glue
583+
false
584+
}
585+
_ => !ty::type_is_copyable(bcx.tcx(), t)
586+
}
587+
}
574588

575589
pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
576590
let _icx = bcx.insn_ctxt("make_take_glue");
591+
592+
if copy_glue_should_never_be_called(bcx, t) {
593+
controlflow::trans_fail(bcx, bcx.fcx.span,
594+
~"calling take glue on non-copyable");
595+
return;
596+
}
597+
577598
// NB: v is a *pointer* to type t here, not a direct value.
578599
let bcx = match ty::get(t).sty {
579600
ty::ty_box(_) | ty::ty_opaque_box |

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,8 @@ pub fn type_kind_ext(cx: ctxt, ty: t, allow_ty_var: bool) -> Kind {
21812181
21822182
ty_type | ty_opaque_closure_ptr(_)
21832183
| ty_opaque_box | ty_unboxed_vec(_) | ty_err => {
2184-
cx.sess.bug(~"Asked to compute kind of fictitious type");
2184+
kind_copyable()
2185+
//cx.sess.bug(~"Asked to compute kind of fictitious type");
21852186
}
21862187
};
21872188

0 commit comments

Comments
 (0)