Skip to content

Commit 8f7364b

Browse files
committed
Don't try to compute kinds of fictitious types. Indicate a bug instead.
1 parent 2ab1b58 commit 8f7364b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/rustc/middle/ty.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,14 +1434,8 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
14341434
ty_ptr(_) { kind_implicitly_sendable() | kind_const() }
14351435
// FIXME: this *shouldn't* be implicitly copyable (#2450)
14361436
ty_str { kind_implicitly_sendable() | kind_const() }
1437-
ty_type { kind_copyable() }
14381437
ty_fn(f) { proto_kind(f.proto) }
14391438

1440-
// Closures have kind determined by capture mode
1441-
ty_opaque_closure_ptr(ck_block) { kind_noncopyable() }
1442-
ty_opaque_closure_ptr(ck_box) { kind_implicitly_copyable() }
1443-
ty_opaque_closure_ptr(ck_uniq) { kind_sendable() }
1444-
14451439
// Those with refcounts raise noncopyable to copyable,
14461440
// lower sendable to copyable. Therefore just set result to copyable.
14471441
ty_box(tm) {
@@ -1456,7 +1450,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
14561450
else { kind_implicitly_copyable() }
14571451
}
14581452
}
1459-
ty_iface(_, _) | ty_opaque_box { kind_implicitly_copyable() }
1453+
ty_iface(_, _) { kind_implicitly_copyable() }
14601454
ty_rptr(_, _) { kind_implicitly_copyable() }
14611455

14621456
// Unique boxes and vecs have the kind of their contained type,
@@ -1548,6 +1542,9 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
15481542
ty_self { kind_noncopyable() }
15491543

15501544
ty_var(_) { cx.sess.bug("Asked to compute kind of a type variable"); }
1545+
ty_type | ty_opaque_closure_ptr(_) | ty_opaque_box {
1546+
cx.sess.bug("Asked to compute kind of fictitious type");
1547+
}
15511548
};
15521549

15531550
cx.kind_cache.insert(ty, result);

0 commit comments

Comments
 (0)