Skip to content

Commit 9173797

Browse files
committed
rollup merge of #21372: arielb1/remove-the-box
It is not used anymore
2 parents 5fda9bc + 8e1e0f0 commit 9173797

File tree

14 files changed

+15
-636
lines changed

14 files changed

+15
-636
lines changed

src/librustc/metadata/tydecode.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,6 @@ fn parse_size(st: &mut PState) -> Option<uint> {
243243
}
244244
}
245245

246-
fn parse_trait_store_<F>(st: &mut PState, conv: &mut F) -> ty::TraitStore where
247-
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
248-
{
249-
match next(st) {
250-
'~' => ty::UniqTraitStore,
251-
'&' => ty::RegionTraitStore(parse_region_(st, conv), parse_mutability(st)),
252-
c => {
253-
st.tcx.sess.bug(&format!("parse_trait_store(): bad input '{}'",
254-
c)[])
255-
}
256-
}
257-
}
258-
259246
fn parse_vec_per_param_space<'a, 'tcx, T, F>(st: &mut PState<'a, 'tcx>,
260247
mut f: F)
261248
-> VecPerParamSpace<T> where
@@ -641,14 +628,6 @@ fn parse_abi_set(st: &mut PState) -> abi::Abi {
641628
})
642629
}
643630

644-
fn parse_onceness(c: char) -> ast::Onceness {
645-
match c {
646-
'o' => ast::Once,
647-
'm' => ast::Many,
648-
_ => panic!("parse_onceness: bad onceness")
649-
}
650-
}
651-
652631
fn parse_closure_ty<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>,
653632
mut conv: F) -> ty::ClosureTy<'tcx> where
654633
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
@@ -661,16 +640,10 @@ fn parse_closure_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>,
661640
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
662641
{
663642
let unsafety = parse_unsafety(next(st));
664-
let onceness = parse_onceness(next(st));
665-
let store = parse_trait_store_(st, conv);
666-
let bounds = parse_existential_bounds_(st, conv);
667643
let sig = parse_sig_(st, conv);
668644
let abi = parse_abi_set(st);
669645
ty::ClosureTy {
670646
unsafety: unsafety,
671-
onceness: onceness,
672-
store: store,
673-
bounds: bounds,
674647
sig: sig,
675648
abi: abi,
676649
}

src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,6 @@ pub fn enc_trait_ref<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>,
305305
enc_substs(w, cx, s.substs);
306306
}
307307

308-
pub fn enc_trait_store(w: &mut SeekableMemWriter, cx: &ctxt, s: ty::TraitStore) {
309-
match s {
310-
ty::UniqTraitStore => mywrite!(w, "~"),
311-
ty::RegionTraitStore(re, m) => {
312-
mywrite!(w, "&");
313-
enc_region(w, cx, re);
314-
enc_mutability(w, m);
315-
}
316-
}
317-
}
318-
319308
fn enc_unsafety(w: &mut SeekableMemWriter, p: ast::Unsafety) {
320309
match p {
321310
ast::Unsafety::Normal => mywrite!(w, "n"),
@@ -329,13 +318,6 @@ fn enc_abi(w: &mut SeekableMemWriter, abi: Abi) {
329318
mywrite!(w, "]")
330319
}
331320

332-
fn enc_onceness(w: &mut SeekableMemWriter, o: ast::Onceness) {
333-
match o {
334-
ast::Once => mywrite!(w, "o"),
335-
ast::Many => mywrite!(w, "m")
336-
}
337-
}
338-
339321
pub fn enc_bare_fn_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>,
340322
ft: &ty::BareFnTy<'tcx>) {
341323
enc_unsafety(w, ft.unsafety);
@@ -346,9 +328,6 @@ pub fn enc_bare_fn_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>,
346328
pub fn enc_closure_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>,
347329
ft: &ty::ClosureTy<'tcx>) {
348330
enc_unsafety(w, ft.unsafety);
349-
enc_onceness(w, ft.onceness);
350-
enc_trait_store(w, cx, ft.store);
351-
enc_existential_bounds(w, cx, &ft.bounds);
352331
enc_fn_sig(w, cx, &ft.sig);
353332
enc_abi(w, ft.abi);
354333
}

src/librustc/middle/astencode.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -515,17 +515,6 @@ impl tr for ty::BoundRegion {
515515
}
516516
}
517517

518-
impl tr for ty::TraitStore {
519-
fn tr(&self, dcx: &DecodeContext) -> ty::TraitStore {
520-
match *self {
521-
ty::RegionTraitStore(r, m) => {
522-
ty::RegionTraitStore(r.tr(dcx), m)
523-
}
524-
ty::UniqTraitStore => ty::UniqTraitStore
525-
}
526-
}
527-
}
528-
529518
// ______________________________________________________________________
530519
// Encoding and decoding of freevar information
531520

src/librustc/middle/infer/combine.rs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -202,39 +202,6 @@ pub trait Combine<'tcx> : Sized {
202202
sig: sig})
203203
}
204204

205-
fn closure_tys(&self, a: &ty::ClosureTy<'tcx>,
206-
b: &ty::ClosureTy<'tcx>) -> cres<'tcx, ty::ClosureTy<'tcx>> {
207-
208-
let store = match (a.store, b.store) {
209-
(ty::RegionTraitStore(a_r, a_m),
210-
ty::RegionTraitStore(b_r, b_m)) if a_m == b_m => {
211-
let r = try!(self.contraregions(a_r, b_r));
212-
ty::RegionTraitStore(r, a_m)
213-
}
214-
215-
_ if a.store == b.store => {
216-
a.store
217-
}
218-
219-
_ => {
220-
return Err(ty::terr_sigil_mismatch(expected_found(self, a.store, b.store)))
221-
}
222-
};
223-
let unsafety = try!(self.unsafeties(a.unsafety, b.unsafety));
224-
let onceness = try!(self.oncenesses(a.onceness, b.onceness));
225-
let bounds = try!(self.existential_bounds(&a.bounds, &b.bounds));
226-
let sig = try!(self.binders(&a.sig, &b.sig));
227-
let abi = try!(self.abi(a.abi, b.abi));
228-
Ok(ty::ClosureTy {
229-
unsafety: unsafety,
230-
onceness: onceness,
231-
store: store,
232-
bounds: bounds,
233-
sig: sig,
234-
abi: abi,
235-
})
236-
}
237-
238205
fn fn_sigs(&self, a: &ty::FnSig<'tcx>, b: &ty::FnSig<'tcx>) -> cres<'tcx, ty::FnSig<'tcx>> {
239206
if a.variadic != b.variadic {
240207
return Err(ty::terr_variadic_mismatch(expected_found(self, a.variadic, b.variadic)));
@@ -356,31 +323,6 @@ pub trait Combine<'tcx> : Sized {
356323

357324
fn regions(&self, a: ty::Region, b: ty::Region) -> cres<'tcx, ty::Region>;
358325

359-
fn trait_stores(&self,
360-
vk: ty::terr_vstore_kind,
361-
a: ty::TraitStore,
362-
b: ty::TraitStore)
363-
-> cres<'tcx, ty::TraitStore> {
364-
debug!("{}.trait_stores(a={:?}, b={:?})", self.tag(), a, b);
365-
366-
match (a, b) {
367-
(ty::RegionTraitStore(a_r, a_m),
368-
ty::RegionTraitStore(b_r, b_m)) if a_m == b_m => {
369-
self.contraregions(a_r, b_r).and_then(|r| {
370-
Ok(ty::RegionTraitStore(r, a_m))
371-
})
372-
}
373-
374-
_ if a == b => {
375-
Ok(a)
376-
}
377-
378-
_ => {
379-
Err(ty::terr_trait_stores_differ(vk, expected_found(self, a, b)))
380-
}
381-
}
382-
}
383-
384326
fn trait_refs(&self,
385327
a: &ty::TraitRef<'tcx>,
386328
b: &ty::TraitRef<'tcx>)

src/librustc/middle/ty.rs

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub use self::InferTy::*;
1717
pub use self::InferRegion::*;
1818
pub use self::ImplOrTraitItemId::*;
1919
pub use self::UnboxedClosureKind::*;
20-
pub use self::TraitStore::*;
2120
pub use self::ast_ty_to_ty_cache_entry::*;
2221
pub use self::Variance::*;
2322
pub use self::AutoAdjustment::*;
@@ -61,7 +60,7 @@ use middle::ty;
6160
use middle::ty_fold::{self, TypeFoldable, TypeFolder};
6261
use middle::ty_walk::TypeWalker;
6362
use util::ppaux::{note_and_explain_region, bound_region_ptr_to_string};
64-
use util::ppaux::{trait_store_to_string, ty_to_string};
63+
use util::ppaux::ty_to_string;
6564
use util::ppaux::{Repr, UserString};
6665
use util::common::{memoized, ErrorReported};
6766
use util::nodemap::{NodeMap, NodeSet, DefIdMap, DefIdSet};
@@ -247,14 +246,6 @@ pub struct mt<'tcx> {
247246
pub mutbl: ast::Mutability,
248247
}
249248

250-
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)]
251-
pub enum TraitStore {
252-
/// Box<Trait>
253-
UniqTraitStore,
254-
/// &Trait and &mut Trait
255-
RegionTraitStore(Region, ast::Mutability),
256-
}
257-
258249
#[derive(Clone, Copy, Show)]
259250
pub struct field_ty {
260251
pub name: Name,
@@ -1041,11 +1032,8 @@ pub struct BareFnTy<'tcx> {
10411032
#[derive(Clone, PartialEq, Eq, Hash, Show)]
10421033
pub struct ClosureTy<'tcx> {
10431034
pub unsafety: ast::Unsafety,
1044-
pub onceness: ast::Onceness,
1045-
pub store: TraitStore,
1046-
pub bounds: ExistentialBounds<'tcx>,
1047-
pub sig: PolyFnSig<'tcx>,
10481035
pub abi: abi::Abi,
1036+
pub sig: PolyFnSig<'tcx>,
10491037
}
10501038

10511039
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
@@ -1545,7 +1533,6 @@ pub enum type_err<'tcx> {
15451533
terr_onceness_mismatch(expected_found<Onceness>),
15461534
terr_abi_mismatch(expected_found<abi::Abi>),
15471535
terr_mutability,
1548-
terr_sigil_mismatch(expected_found<TraitStore>),
15491536
terr_box_mutability,
15501537
terr_ptr_mutability,
15511538
terr_ref_mutability,
@@ -1559,7 +1546,6 @@ pub enum type_err<'tcx> {
15591546
terr_regions_no_overlap(Region, Region),
15601547
terr_regions_insufficiently_polymorphic(BoundRegion, Region),
15611548
terr_regions_overly_polymorphic(BoundRegion, Region),
1562-
terr_trait_stores_differ(terr_vstore_kind, expected_found<TraitStore>),
15631549
terr_sorts(expected_found<Ty<'tcx>>),
15641550
terr_integer_as_char,
15651551
terr_int_mismatch(expected_found<IntVarValue>),
@@ -4194,19 +4180,6 @@ pub fn ty_fn_args<'tcx>(fty: Ty<'tcx>) -> ty::Binder<Vec<Ty<'tcx>>> {
41944180
ty_fn_sig(fty).inputs()
41954181
}
41964182

4197-
pub fn ty_closure_store(fty: Ty) -> TraitStore {
4198-
match fty.sty {
4199-
ty_unboxed_closure(..) => {
4200-
// Close enough for the purposes of all the callers of this
4201-
// function (which is soon to be deprecated anyhow).
4202-
UniqTraitStore
4203-
}
4204-
ref s => {
4205-
panic!("ty_closure_store() called on non-closure type: {:?}", s)
4206-
}
4207-
}
4208-
}
4209-
42104183
pub fn ty_fn_ret<'tcx>(fty: Ty<'tcx>) -> Binder<FnOutput<'tcx>> {
42114184
match fty.sty {
42124185
ty_bare_fn(_, ref f) => f.sig.output(),
@@ -4751,13 +4724,6 @@ impl<'tcx> Repr<'tcx> for ty::type_err<'tcx> {
47514724
/// afterwards to present additional details, particularly when it comes to lifetime-related
47524725
/// errors.
47534726
pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
4754-
fn tstore_to_closure(s: &TraitStore) -> String {
4755-
match s {
4756-
&UniqTraitStore => "proc".to_string(),
4757-
&RegionTraitStore(..) => "closure".to_string()
4758-
}
4759-
}
4760-
47614727
match *err {
47624728
terr_cyclic_ty => "cyclic type of infinite size".to_string(),
47634729
terr_mismatch => "types differ".to_string(),
@@ -4776,11 +4742,6 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
47764742
values.expected,
47774743
values.found)
47784744
}
4779-
terr_sigil_mismatch(values) => {
4780-
format!("expected {}, found {}",
4781-
tstore_to_closure(&values.expected),
4782-
tstore_to_closure(&values.found))
4783-
}
47844745
terr_mutability => "values differ in mutability".to_string(),
47854746
terr_box_mutability => {
47864747
"boxed values differ in mutability".to_string()
@@ -4828,11 +4789,6 @@ pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
48284789
found bound lifetime parameter {}",
48294790
bound_region_ptr_to_string(cx, br))
48304791
}
4831-
terr_trait_stores_differ(_, ref values) => {
4832-
format!("trait storage differs: expected `{}`, found `{}`",
4833-
trait_store_to_string(cx, (*values).expected),
4834-
trait_store_to_string(cx, (*values).found))
4835-
}
48364792
terr_sorts(values) => {
48374793
// A naive approach to making sure that we're not reporting silly errors such as:
48384794
// (expected closure, found closure).
@@ -7317,11 +7273,8 @@ impl ReferencesError for Region
73177273

73187274
impl<'tcx> Repr<'tcx> for ClosureTy<'tcx> {
73197275
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
7320-
format!("ClosureTy({},{},{:?},{},{},{})",
7276+
format!("ClosureTy({},{},{})",
73217277
self.unsafety,
7322-
self.onceness,
7323-
self.store,
7324-
self.bounds.repr(tcx),
73257278
self.sig.repr(tcx),
73267279
self.abi)
73277280
}
@@ -7352,5 +7305,5 @@ impl<'a, 'tcx> Repr<'tcx> for ParameterEnvironment<'a, 'tcx> {
73527305
self.free_substs.repr(tcx),
73537306
self.implicit_region_bound.repr(tcx),
73547307
self.caller_bounds.repr(tcx))
7355-
}
73567308
}
7309+
}

src/librustc/middle/ty_fold.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ pub trait TypeFolder<'tcx> : Sized {
124124
r
125125
}
126126

127-
fn fold_trait_store(&mut self, s: ty::TraitStore) -> ty::TraitStore {
128-
super_fold_trait_store(self, s)
129-
}
130-
131127
fn fold_existential_bounds(&mut self, s: &ty::ExistentialBounds<'tcx>)
132128
-> ty::ExistentialBounds<'tcx> {
133129
super_fold_existential_bounds(self, s)
@@ -225,12 +221,6 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for VecPerParamSpace<T> {
225221
}
226222
}
227223

228-
impl<'tcx> TypeFoldable<'tcx> for ty::TraitStore {
229-
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::TraitStore {
230-
folder.fold_trait_store(*self)
231-
}
232-
}
233-
234224
impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
235225
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Ty<'tcx> {
236226
folder.fold_ty(*self)
@@ -699,11 +689,8 @@ pub fn super_fold_closure_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
699689
-> ty::ClosureTy<'tcx>
700690
{
701691
ty::ClosureTy {
702-
store: fty.store.fold_with(this),
703692
sig: fty.sig.fold_with(this),
704693
unsafety: fty.unsafety,
705-
onceness: fty.onceness,
706-
bounds: fty.bounds.fold_with(this),
707694
abi: fty.abi,
708695
}
709696
}
@@ -726,17 +713,6 @@ pub fn super_fold_mt<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
726713
mutbl: mt.mutbl}
727714
}
728715

729-
pub fn super_fold_trait_store<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
730-
trait_store: ty::TraitStore)
731-
-> ty::TraitStore {
732-
match trait_store {
733-
ty::UniqTraitStore => ty::UniqTraitStore,
734-
ty::RegionTraitStore(r, m) => {
735-
ty::RegionTraitStore(r.fold_with(this), m)
736-
}
737-
}
738-
}
739-
740716
pub fn super_fold_existential_bounds<'tcx, T: TypeFolder<'tcx>>(
741717
this: &mut T,
742718
bounds: &ty::ExistentialBounds<'tcx>)

0 commit comments

Comments
 (0)