Skip to content

Commit fe354e5

Browse files
committed
rustc: remove unused MethodStaticClosure variant of MethodOrigin.
1 parent 50c952b commit fe354e5

File tree

11 files changed

+8
-51
lines changed

11 files changed

+8
-51
lines changed

src/librustc/middle/astencode.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,8 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
755755
})
756756
}
757757

758-
ty::MethodStaticClosure(def_id) => {
759-
this.emit_enum_variant("MethodStaticClosure", 1, 1, |this| {
760-
Ok(this.emit_def_id(def_id))
761-
})
762-
}
763-
764758
ty::MethodTypeParam(ref p) => {
765-
this.emit_enum_variant("MethodTypeParam", 2, 1, |this| {
759+
this.emit_enum_variant("MethodTypeParam", 1, 1, |this| {
766760
this.emit_struct("MethodParam", 2, |this| {
767761
try!(this.emit_struct_field("trait_ref", 0, |this| {
768762
Ok(this.emit_trait_ref(ecx, &p.trait_ref))
@@ -786,7 +780,7 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
786780
}
787781

788782
ty::MethodTraitObject(ref o) => {
789-
this.emit_enum_variant("MethodTraitObject", 3, 1, |this| {
783+
this.emit_enum_variant("MethodTraitObject", 2, 1, |this| {
790784
this.emit_struct("MethodObject", 2, |this| {
791785
try!(this.emit_struct_field("trait_ref", 0, |this| {
792786
Ok(this.emit_trait_ref(ecx, &o.trait_ref))
@@ -1239,8 +1233,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
12391233
-> ty::MethodOrigin<'tcx>
12401234
{
12411235
self.read_enum("MethodOrigin", |this| {
1242-
let variants = &["MethodStatic", "MethodStaticClosure",
1243-
"MethodTypeParam", "MethodTraitObject"];
1236+
let variants = &["MethodStatic", "MethodTypeParam", "MethodTraitObject"];
12441237
this.read_enum_variant(variants, |this, i| {
12451238
Ok(match i {
12461239
0 => {
@@ -1249,11 +1242,6 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
12491242
}
12501243

12511244
1 => {
1252-
let def_id = this.read_def_id(dcx);
1253-
ty::MethodStaticClosure(def_id)
1254-
}
1255-
1256-
2 => {
12571245
this.read_struct("MethodTypeParam", 2, |this| {
12581246
Ok(ty::MethodTypeParam(
12591247
ty::MethodParam {
@@ -1282,7 +1270,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
12821270
}).unwrap()
12831271
}
12841272

1285-
3 => {
1273+
2 => {
12861274
this.read_struct("MethodTraitObject", 2, |this| {
12871275
Ok(ty::MethodTraitObject(
12881276
ty::MethodObject {

src/librustc/middle/dead.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
105105
None => self.check_def_id(def_id)
106106
}
107107
}
108-
ty::MethodStaticClosure(_) => {}
109108
ty::MethodTypeParam(ty::MethodParam {
110109
ref trait_ref,
111110
method_num: index,

src/librustc/middle/expr_use_visitor.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -254,27 +254,12 @@ impl OverloadedCallType {
254254
OverloadedCallType::from_trait_id(tcx, trait_ref.def_id)
255255
}
256256

257-
fn from_closure(tcx: &ty::ctxt, closure_did: ast::DefId)
258-
-> OverloadedCallType {
259-
let trait_did =
260-
tcx.tables
261-
.borrow()
262-
.closure_kinds
263-
.get(&closure_did)
264-
.expect("OverloadedCallType::from_closure: didn't find closure id")
265-
.trait_did(tcx);
266-
OverloadedCallType::from_trait_id(tcx, trait_did)
267-
}
268-
269257
fn from_method_origin(tcx: &ty::ctxt, origin: &MethodOrigin)
270258
-> OverloadedCallType {
271259
match *origin {
272260
MethodStatic(def_id) => {
273261
OverloadedCallType::from_method_id(tcx, def_id)
274262
}
275-
MethodStaticClosure(def_id) => {
276-
OverloadedCallType::from_closure(tcx, def_id)
277-
}
278263
MethodTypeParam(MethodParam { ref trait_ref, .. }) |
279264
MethodTraitObject(MethodObject { ref trait_ref, .. }) => {
280265
OverloadedCallType::from_trait_id(tcx, trait_ref.def_id)

src/librustc/middle/stability.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,6 @@ pub fn check_expr(tcx: &ty::ctxt, e: &ast::Expr,
412412
ty::MethodStatic(def_id) => {
413413
def_id
414414
}
415-
ty::MethodStaticClosure(def_id) => {
416-
def_id
417-
}
418415
ty::MethodTypeParam(ty::MethodParam {
419416
ref trait_ref,
420417
method_num: index,

src/librustc/middle/ty.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,6 @@ pub enum MethodOrigin<'tcx> {
631631
// fully statically resolved method
632632
MethodStatic(ast::DefId),
633633

634-
// fully statically resolved closure invocation
635-
MethodStaticClosure(ast::DefId),
636-
637634
// method invoked on a type parameter with a bounded trait
638635
MethodTypeParam(MethodParam<'tcx>),
639636

src/librustc/middle/ty_fold.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::MethodOrigin<'tcx> {
316316
ty::MethodStatic(def_id) => {
317317
ty::MethodStatic(def_id)
318318
}
319-
ty::MethodStaticClosure(def_id) => {
320-
ty::MethodStaticClosure(def_id)
321-
}
322319
ty::MethodTypeParam(ref param) => {
323320
ty::MethodTypeParam(ty::MethodParam {
324321
trait_ref: param.trait_ref.fold_with(folder),

src/librustc/util/ppaux.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,6 @@ impl<'tcx> fmt::Debug for ty::MethodOrigin<'tcx> {
500500
ty::MethodStatic(def_id) => {
501501
write!(f, "MethodStatic({:?})", def_id)
502502
}
503-
ty::MethodStaticClosure(def_id) => {
504-
write!(f, "MethodStaticClosure({:?})", def_id)
505-
}
506503
ty::MethodTypeParam(ref p) => write!(f, "{:?}", p),
507504
ty::MethodTraitObject(ref p) => write!(f, "{:?}", p)
508505
}

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ impl LintPass for UnconditionalRecursion {
20032003
ty::MethodTraitObject(_) => return false,
20042004

20052005
// This `did` refers directly to the method definition.
2006-
ty::MethodStatic(did) | ty::MethodStaticClosure(did) => did,
2006+
ty::MethodStatic(did) => did,
20072007

20082008
// MethodTypeParam are methods from traits:
20092009

src/librustc_privacy/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,6 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
854854
MethodStatic(method_id) => {
855855
self.check_static_method(span, method_id, name)
856856
}
857-
MethodStaticClosure(_) => {}
858857
// Trait methods are always all public. The only controlling factor
859858
// is whether the trait itself is accessible or not.
860859
MethodTypeParam(MethodParam { ref trait_ref, .. }) |

src/librustc_trans/save/dump_csv.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
889889
let method_map = &self.tcx.tables.borrow().method_map;
890890
let method_callee = method_map.get(&ty::MethodCall::expr(ex.id)).unwrap();
891891
let (def_id, decl_id) = match method_callee.origin {
892-
ty::MethodStatic(def_id) |
893-
ty::MethodStaticClosure(def_id) => {
892+
ty::MethodStatic(def_id) => {
894893
// method invoked on an object with a concrete type (not a static method)
895894
let decl_id =
896895
match self.tcx.trait_item_of_item(def_id) {
@@ -907,7 +906,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
907906
_ => self.sess
908907
.span_bug(ex.span,
909908
"save::process_method_call: non-method \
910-
DefId in MethodStatic or MethodStaticClosure"),
909+
DefId in MethodStatic"),
911910
};
912911
(Some(def_id), decl_id)
913912
}

src/librustc_trans/trans/meth.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
117117
.unwrap();
118118

119119
match origin {
120-
ty::MethodStatic(did) |
121-
ty::MethodStaticClosure(did) => {
120+
ty::MethodStatic(did) => {
122121
debug!("trans_method_callee: static, {:?}", did);
123122
Callee {
124123
bcx: bcx,

0 commit comments

Comments
 (0)