Skip to content

Commit 8e1e0f0

Browse files
Ariel Ben-Yehudaarielb1
Ariel Ben-Yehuda
authored andcommitted
Remove onceness & bounds - they don't do anything.
1 parent e0eb3cc commit 8e1e0f0

File tree

8 files changed

+7
-76
lines changed

8 files changed

+7
-76
lines changed

src/librustc/metadata/tydecode.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,6 @@ fn parse_abi_set(st: &mut PState) -> abi::Abi {
628628
})
629629
}
630630

631-
fn parse_onceness(c: char) -> ast::Onceness {
632-
match c {
633-
'o' => ast::Once,
634-
'm' => ast::Many,
635-
_ => panic!("parse_onceness: bad onceness")
636-
}
637-
}
638-
639631
fn parse_closure_ty<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>,
640632
mut conv: F) -> ty::ClosureTy<'tcx> where
641633
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
@@ -648,14 +640,10 @@ fn parse_closure_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>,
648640
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
649641
{
650642
let unsafety = parse_unsafety(next(st));
651-
let onceness = parse_onceness(next(st));
652-
let bounds = parse_existential_bounds_(st, conv);
653643
let sig = parse_sig_(st, conv);
654644
let abi = parse_abi_set(st);
655645
ty::ClosureTy {
656646
unsafety: unsafety,
657-
onceness: onceness,
658-
bounds: bounds,
659647
sig: sig,
660648
abi: abi,
661649
}

src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,6 @@ fn enc_abi(w: &mut SeekableMemWriter, abi: Abi) {
318318
mywrite!(w, "]")
319319
}
320320

321-
fn enc_onceness(w: &mut SeekableMemWriter, o: ast::Onceness) {
322-
match o {
323-
ast::Once => mywrite!(w, "o"),
324-
ast::Many => mywrite!(w, "m")
325-
}
326-
}
327-
328321
pub fn enc_bare_fn_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>,
329322
ft: &ty::BareFnTy<'tcx>) {
330323
enc_unsafety(w, ft.unsafety);
@@ -335,8 +328,6 @@ pub fn enc_bare_fn_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>,
335328
pub fn enc_closure_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>,
336329
ft: &ty::ClosureTy<'tcx>) {
337330
enc_unsafety(w, ft.unsafety);
338-
enc_onceness(w, ft.onceness);
339-
enc_existential_bounds(w, cx, &ft.bounds);
340331
enc_fn_sig(w, cx, &ft.sig);
341332
enc_abi(w, ft.abi);
342333
}

src/librustc/middle/ty.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,8 @@ pub struct BareFnTy<'tcx> {
10321032
#[derive(Clone, PartialEq, Eq, Hash, Show)]
10331033
pub struct ClosureTy<'tcx> {
10341034
pub unsafety: ast::Unsafety,
1035-
pub onceness: ast::Onceness,
1036-
pub bounds: ExistentialBounds<'tcx>,
1037-
pub sig: PolyFnSig<'tcx>,
10381035
pub abi: abi::Abi,
1036+
pub sig: PolyFnSig<'tcx>,
10391037
}
10401038

10411039
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
@@ -7296,10 +7294,8 @@ impl ReferencesError for Region
72967294

72977295
impl<'tcx> Repr<'tcx> for ClosureTy<'tcx> {
72987296
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
7299-
format!("ClosureTy({},{},{},{},{})",
7297+
format!("ClosureTy({},{},{})",
73007298
self.unsafety,
7301-
self.onceness,
7302-
self.bounds.repr(tcx),
73037299
self.sig.repr(tcx),
73047300
self.abi)
73057301
}
@@ -7330,5 +7326,5 @@ impl<'a, 'tcx> Repr<'tcx> for ParameterEnvironment<'a, 'tcx> {
73307326
self.free_substs.repr(tcx),
73317327
self.implicit_region_bound.repr(tcx),
73327328
self.caller_bounds.repr(tcx))
7333-
}
73347329
}
7330+
}

src/librustc/middle/ty_fold.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,6 @@ pub fn super_fold_closure_ty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
691691
ty::ClosureTy {
692692
sig: fty.sig.fold_with(this),
693693
unsafety: fty.unsafety,
694-
onceness: fty.onceness,
695-
bounds: fty.bounds.fold_with(this),
696694
abi: fty.abi,
697695
}
698696
}

src/librustc/util/ppaux.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
276276
_ => { }
277277
}
278278

279-
push_sig_to_string(cx, &mut s, '(', ')', sig, "");
279+
push_sig_to_string(cx, &mut s, '(', ')', sig);
280280

281281
match opt_def_id {
282282
Some(def_id) => {
@@ -302,14 +302,7 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
302302
}
303303
};
304304

305-
let bounds_str = cty.bounds.user_string(cx);
306-
307-
match cty.onceness {
308-
ast::Many => {}
309-
ast::Once => s.push_str("once ")
310-
}
311-
push_sig_to_string(cx, &mut s, '|', '|', &cty.sig,
312-
&bounds_str[]);
305+
push_sig_to_string(cx, &mut s, '|', '|', &cty.sig);
313306

314307
s
315308
}
@@ -318,8 +311,7 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
318311
s: &mut String,
319312
bra: char,
320313
ket: char,
321-
sig: &ty::PolyFnSig<'tcx>,
322-
bounds: &str) {
314+
sig: &ty::PolyFnSig<'tcx>) {
323315
s.push(bra);
324316
let strs = sig.0.inputs
325317
.iter()
@@ -331,11 +323,6 @@ pub fn ty_to_string<'tcx>(cx: &ctxt<'tcx>, typ: &ty::TyS<'tcx>) -> String {
331323
}
332324
s.push(ket);
333325

334-
if !bounds.is_empty() {
335-
s.push_str(":");
336-
s.push_str(bounds);
337-
}
338-
339326
match sig.0.output {
340327
ty::FnConverging(t) => {
341328
if !ty::type_is_nil(t) {

src/librustc_trans/trans/debuginfo.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -551,18 +551,13 @@ impl<'tcx> TypeMap<'tcx> {
551551
closure_ty: ty::ClosureTy<'tcx>,
552552
unique_type_id: &mut String) {
553553
let ty::ClosureTy { unsafety,
554-
onceness,
555-
ref bounds,
556554
ref sig,
557555
abi: _ } = closure_ty;
556+
558557
if unsafety == ast::Unsafety::Unsafe {
559558
unique_type_id.push_str("unsafe ");
560559
}
561560

562-
if onceness == ast::Once {
563-
unique_type_id.push_str("once ");
564-
}
565-
566561
unique_type_id.push_str("|");
567562

568563
let sig = ty::erase_late_bound_regions(cx.tcx(), sig);
@@ -592,18 +587,6 @@ impl<'tcx> TypeMap<'tcx> {
592587
unique_type_id.push_str("!");
593588
}
594589
}
595-
596-
unique_type_id.push(':');
597-
598-
for bound in bounds.builtin_bounds.iter() {
599-
match bound {
600-
ty::BoundSend => unique_type_id.push_str("Send"),
601-
ty::BoundSized => unique_type_id.push_str("Sized"),
602-
ty::BoundCopy => unique_type_id.push_str("Copy"),
603-
ty::BoundSync => unique_type_id.push_str("Sync"),
604-
};
605-
unique_type_id.push('+');
606-
}
607590
}
608591

609592
// Get the UniqueTypeId for an enum variant. Enum variants are not really

src/librustc_typeck/astconv.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,8 +1457,6 @@ fn determine_explicit_self_category<'a, 'tcx>(this: &AstConv<'tcx>,
14571457
pub fn ty_of_closure<'tcx>(
14581458
this: &AstConv<'tcx>,
14591459
unsafety: ast::Unsafety,
1460-
onceness: ast::Onceness,
1461-
bounds: ty::ExistentialBounds<'tcx>,
14621460
decl: &ast::FnDecl,
14631461
abi: abi::Abi,
14641462
expected_sig: Option<ty::FnSig<'tcx>>)
@@ -1508,8 +1506,6 @@ pub fn ty_of_closure<'tcx>(
15081506

15091507
ty::ClosureTy {
15101508
unsafety: unsafety,
1511-
onceness: onceness,
1512-
bounds: bounds,
15131509
abi: abi,
15141510
sig: ty::Binder(ty::FnSig {inputs: input_tys,
15151511
output: output_ty,

src/librustc_typeck/check/closure.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ fn check_unboxed_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
8989
let mut fn_ty = astconv::ty_of_closure(
9090
fcx,
9191
ast::Unsafety::Normal,
92-
ast::Many,
93-
94-
// The `RegionTraitStore` and region_existential_bounds
95-
// are lies, but we ignore them so it doesn't matter.
96-
//
97-
// FIXME(pcwalton): Refactor this API.
98-
ty::region_existential_bound(ty::ReStatic),
99-
10092
decl,
10193
abi::RustCall,
10294
expected_sig);

0 commit comments

Comments
 (0)