Skip to content

Commit 89d5d24

Browse files
committed
Rollup merge of #22213 - eddyb:ty_open-case-closed, r=nikomatsakis
This type wasn't necessary, as there was no place using it and unsized types not wrapped in it, at the same time. r? @nikomatsakis
2 parents e711ac7 + 8659de0 commit 89d5d24

File tree

27 files changed

+184
-320
lines changed

27 files changed

+184
-320
lines changed

src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,6 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
153153
ty::ty_err => {
154154
mywrite!(w, "e");
155155
}
156-
ty::ty_open(_) => {
157-
cx.diag.handler().bug("unexpected type in enc_sty (ty_open)");
158-
}
159156
}
160157

161158
let end = w.tell().unwrap();

src/librustc/middle/fast_reject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn simplify_type(tcx: &ty::ctxt,
9393
None
9494
}
9595
}
96-
ty::ty_open(_) | ty::ty_infer(_) | ty::ty_err => None,
96+
ty::ty_infer(_) | ty::ty_err => None,
9797
}
9898
}
9999

src/librustc/middle/infer/freshen.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
135135
t
136136
}
137137

138-
ty::ty_open(..) |
139138
ty::ty_bool |
140139
ty::ty_char |
141140
ty::ty_int(..) |

src/librustc/middle/traits/coherence.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
194194

195195
ty::ty_closure(..) |
196196
ty::ty_infer(..) |
197-
ty::ty_open(..) |
198197
ty::ty_err => {
199198
tcx.sess.bug(
200199
&format!("ty_is_local invoked on unexpected type: {}",

src/librustc/middle/traits/select.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,25 +1626,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
16261626
Ok(AmbiguousBuiltin)
16271627
}
16281628

1629-
ty::ty_open(ty) => {
1630-
// these only crop up in trans, and represent an
1631-
// "opened" unsized/existential type (one that has
1632-
// been dereferenced)
1633-
match bound {
1634-
ty::BoundCopy => {
1635-
Ok(If(vec!(ty)))
1636-
}
1637-
1638-
ty::BoundSized => {
1639-
Err(Unimplemented)
1640-
}
1641-
1642-
ty::BoundSync |
1643-
ty::BoundSend => {
1644-
self.tcx().sess.bug("Send/Sync shouldn't occur in builtin_bounds()");
1645-
}
1646-
}
1647-
}
16481629
ty::ty_err => {
16491630
Ok(If(Vec::new()))
16501631
}

src/librustc/middle/ty.rs

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ impl<'tcx> ctxt<'tcx> {
930930
sty_debug_print!(
931931
self,
932932
ty_enum, ty_uniq, ty_vec, ty_ptr, ty_rptr, ty_bare_fn, ty_trait,
933-
ty_struct, ty_closure, ty_tup, ty_param, ty_open, ty_infer, ty_projection);
933+
ty_struct, ty_closure, ty_tup, ty_param, ty_infer, ty_projection);
934934

935935
println!("Substs interner: #{}", self.substs_interner.borrow().len());
936936
println!("BareFnTy interner: #{}", self.bare_fn_interner.borrow().len());
@@ -1374,12 +1374,6 @@ pub enum sty<'tcx> {
13741374
ty_projection(ProjectionTy<'tcx>),
13751375
ty_param(ParamTy), // type parameter
13761376

1377-
ty_open(Ty<'tcx>), // A deref'ed fat pointer, i.e., a dynamically sized value
1378-
// and its size. Only ever used in trans. It is not necessary
1379-
// earlier since we don't need to distinguish a DST with its
1380-
// size (e.g., in a deref) vs a DST with the size elsewhere (
1381-
// e.g., in a field).
1382-
13831377
ty_infer(InferTy), // something used only during inference/typeck
13841378
ty_err, // Also only used during inference/typeck, to represent
13851379
// the type of an erroneous expression (helps cut down
@@ -2689,7 +2683,7 @@ impl FlagComputation {
26892683
self.add_bounds(bounds);
26902684
}
26912685

2692-
&ty_uniq(tt) | &ty_vec(tt, _) | &ty_open(tt) => {
2686+
&ty_uniq(tt) | &ty_vec(tt, _) => {
26932687
self.add_ty(tt)
26942688
}
26952689

@@ -2964,8 +2958,6 @@ pub fn mk_param_from_def<'tcx>(cx: &ctxt<'tcx>, def: &TypeParameterDef) -> Ty<'t
29642958
mk_param(cx, def.space, def.index, def.name)
29652959
}
29662960

2967-
pub fn mk_open<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { mk_t(cx, ty_open(ty)) }
2968-
29692961
impl<'tcx> TyS<'tcx> {
29702962
/// Iterator that walks `self` and any types reachable from
29712963
/// `self`, in depth-first order. Note that just walks the types
@@ -3164,7 +3156,6 @@ pub fn sequence_element_type<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
31643156
match ty.sty {
31653157
ty_vec(ty, _) => ty,
31663158
ty_str => mk_mach_uint(cx, ast::TyU8),
3167-
ty_open(ty) => sequence_element_type(cx, ty),
31683159
_ => cx.sess.bug(&format!("sequence_element_type called on non-sequence value: {}",
31693160
ty_to_string(cx, ty))),
31703161
}
@@ -3583,12 +3574,6 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
35833574
TC::All
35843575
}
35853576

3586-
ty_open(ty) => {
3587-
let result = tc_ty(cx, ty, cache);
3588-
assert!(!result.is_sized(cx));
3589-
result.unsafe_pointer() | TC::Nonsized
3590-
}
3591-
35923577
ty_infer(_) |
35933578
ty_err => {
35943579
cx.sess.bug("asked to compute contents of error type");
@@ -3747,7 +3732,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
37473732
ty_vec(_, None) => {
37483733
false
37493734
}
3750-
ty_uniq(typ) | ty_open(typ) => {
3735+
ty_uniq(typ) => {
37513736
type_requires(cx, seen, r_ty, typ)
37523737
}
37533738
ty_rptr(_, ref mt) => {
@@ -4106,14 +4091,6 @@ pub fn deref<'tcx>(ty: Ty<'tcx>, explicit: bool) -> Option<mt<'tcx>> {
41064091
}
41074092
}
41084093

4109-
pub fn close_type<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
4110-
match ty.sty {
4111-
ty_open(ty) => mk_rptr(cx, cx.mk_region(ReStatic), mt {ty: ty, mutbl:ast::MutImmutable}),
4112-
_ => cx.sess.bug(&format!("Trying to close a non-open type {}",
4113-
ty_to_string(cx, ty)))
4114-
}
4115-
}
4116-
41174094
pub fn type_content<'tcx>(ty: Ty<'tcx>) -> Ty<'tcx> {
41184095
match ty.sty {
41194096
ty_uniq(ty) => ty,
@@ -4122,14 +4099,6 @@ pub fn type_content<'tcx>(ty: Ty<'tcx>) -> Ty<'tcx> {
41224099
}
41234100
}
41244101

4125-
// Extract the unsized type in an open type (or just return ty if it is not open).
4126-
pub fn unopen_type<'tcx>(ty: Ty<'tcx>) -> Ty<'tcx> {
4127-
match ty.sty {
4128-
ty_open(ty) => ty,
4129-
_ => ty
4130-
}
4131-
}
4132-
41334102
// Returns the type of ty[i]
41344103
pub fn index<'tcx>(ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
41354104
match ty.sty {
@@ -4802,7 +4771,6 @@ pub fn ty_sort_string<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> String {
48024771
}
48034772
}
48044773
ty_err => "type error".to_string(),
4805-
ty_open(_) => "opened DST".to_string(),
48064774
}
48074775
}
48084776

@@ -6328,16 +6296,15 @@ pub fn hash_crate_independent<'tcx>(tcx: &ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh) -
63286296
hash!(p.idx);
63296297
hash!(token::get_name(p.name));
63306298
}
6331-
ty_open(_) => byte!(22),
63326299
ty_infer(_) => unreachable!(),
6333-
ty_err => byte!(23),
6300+
ty_err => byte!(21),
63346301
ty_closure(d, r, _) => {
6335-
byte!(24);
6302+
byte!(22);
63366303
did(state, d);
63376304
region(state, *r);
63386305
}
63396306
ty_projection(ref data) => {
6340-
byte!(25);
6307+
byte!(23);
63416308
did(state, data.trait_ref.def_id);
63426309
hash!(token::get_name(data.item_name));
63436310
}
@@ -6666,7 +6633,6 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>,
66666633
ty_projection(_) |
66676634
ty_param(_) |
66686635
ty_infer(_) |
6669-
ty_open(_) |
66706636
ty_err => {
66716637
}
66726638
}

src/librustc/middle/ty_fold.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,6 @@ pub fn super_fold_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
626626
ty::ty_vec(typ, sz) => {
627627
ty::ty_vec(typ.fold_with(this), sz)
628628
}
629-
ty::ty_open(typ) => {
630-
ty::ty_open(typ.fold_with(this))
631-
}
632629
ty::ty_enum(tid, ref substs) => {
633630
let substs = substs.fold_with(this);
634631
ty::ty_enum(tid, this.tcx().mk_substs(substs))

src/librustc/middle/ty_walk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<'tcx> TypeWalker<'tcx> {
2828
ty::ty_bool | ty::ty_char | ty::ty_int(_) | ty::ty_uint(_) | ty::ty_float(_) |
2929
ty::ty_str | ty::ty_infer(_) | ty::ty_param(_) | ty::ty_err => {
3030
}
31-
ty::ty_uniq(ty) | ty::ty_vec(ty, _) | ty::ty_open(ty) => {
31+
ty::ty_uniq(ty) | ty::ty_vec(ty, _) => {
3232
self.stack.push(ty);
3333
}
3434
ty::ty_ptr(ref mt) | ty::ty_rptr(_, ref mt) => {

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use middle::ty::{ReSkolemized, ReVar, BrEnv};
2020
use middle::ty::{mt, Ty, ParamTy};
2121
use middle::ty::{ty_bool, ty_char, ty_struct, ty_enum};
2222
use middle::ty::{ty_err, ty_str, ty_vec, ty_float, ty_bare_fn};
23-
use middle::ty::{ty_param, ty_ptr, ty_rptr, ty_tup, ty_open};
23+
use middle::ty::{ty_param, ty_ptr, ty_rptr, ty_tup};
2424
use middle::ty::{ty_closure};
2525
use middle::ty::{ty_uniq, ty_trait, ty_int, ty_uint, ty_infer};
2626
use middle::ty;
@@ -369,8 +369,6 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
369369
buf.push_str(&mt_to_string(cx, tm));
370370
buf
371371
}
372-
ty_open(typ) =>
373-
format!("opened<{}>", ty_to_string(cx, typ)),
374372
ty_tup(ref elems) => {
375373
let strs = elems
376374
.iter()

src/librustc_trans/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ fn bind_subslice_pat(bcx: Block,
678678
}
679679

680680
fn extract_vec_elems<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
681-
left_ty: Ty,
681+
left_ty: Ty<'tcx>,
682682
before: uint,
683683
after: uint,
684684
val: ValueRef)

0 commit comments

Comments
 (0)