Skip to content

Commit

Permalink
rustc: remove unused MethodStaticClosure variant of MethodOrigin.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Jul 4, 2015
1 parent 50c952b commit fe354e5
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 51 deletions.
20 changes: 4 additions & 16 deletions src/librustc/middle/astencode.rs
Expand Up @@ -755,14 +755,8 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
})
}

ty::MethodStaticClosure(def_id) => {
this.emit_enum_variant("MethodStaticClosure", 1, 1, |this| {
Ok(this.emit_def_id(def_id))
})
}

ty::MethodTypeParam(ref p) => {
this.emit_enum_variant("MethodTypeParam", 2, 1, |this| {
this.emit_enum_variant("MethodTypeParam", 1, 1, |this| {
this.emit_struct("MethodParam", 2, |this| {
try!(this.emit_struct_field("trait_ref", 0, |this| {
Ok(this.emit_trait_ref(ecx, &p.trait_ref))
Expand All @@ -786,7 +780,7 @@ impl<'a, 'tcx> rbml_writer_helpers<'tcx> for Encoder<'a> {
}

ty::MethodTraitObject(ref o) => {
this.emit_enum_variant("MethodTraitObject", 3, 1, |this| {
this.emit_enum_variant("MethodTraitObject", 2, 1, |this| {
this.emit_struct("MethodObject", 2, |this| {
try!(this.emit_struct_field("trait_ref", 0, |this| {
Ok(this.emit_trait_ref(ecx, &o.trait_ref))
Expand Down Expand Up @@ -1239,8 +1233,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
-> ty::MethodOrigin<'tcx>
{
self.read_enum("MethodOrigin", |this| {
let variants = &["MethodStatic", "MethodStaticClosure",
"MethodTypeParam", "MethodTraitObject"];
let variants = &["MethodStatic", "MethodTypeParam", "MethodTraitObject"];
this.read_enum_variant(variants, |this, i| {
Ok(match i {
0 => {
Expand All @@ -1249,11 +1242,6 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
}

1 => {
let def_id = this.read_def_id(dcx);
ty::MethodStaticClosure(def_id)
}

2 => {
this.read_struct("MethodTypeParam", 2, |this| {
Ok(ty::MethodTypeParam(
ty::MethodParam {
Expand Down Expand Up @@ -1282,7 +1270,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
}).unwrap()
}

3 => {
2 => {
this.read_struct("MethodTraitObject", 2, |this| {
Ok(ty::MethodTraitObject(
ty::MethodObject {
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/dead.rs
Expand Up @@ -105,7 +105,6 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
None => self.check_def_id(def_id)
}
}
ty::MethodStaticClosure(_) => {}
ty::MethodTypeParam(ty::MethodParam {
ref trait_ref,
method_num: index,
Expand Down
15 changes: 0 additions & 15 deletions src/librustc/middle/expr_use_visitor.rs
Expand Up @@ -254,27 +254,12 @@ impl OverloadedCallType {
OverloadedCallType::from_trait_id(tcx, trait_ref.def_id)
}

fn from_closure(tcx: &ty::ctxt, closure_did: ast::DefId)
-> OverloadedCallType {
let trait_did =
tcx.tables
.borrow()
.closure_kinds
.get(&closure_did)
.expect("OverloadedCallType::from_closure: didn't find closure id")
.trait_did(tcx);
OverloadedCallType::from_trait_id(tcx, trait_did)
}

fn from_method_origin(tcx: &ty::ctxt, origin: &MethodOrigin)
-> OverloadedCallType {
match *origin {
MethodStatic(def_id) => {
OverloadedCallType::from_method_id(tcx, def_id)
}
MethodStaticClosure(def_id) => {
OverloadedCallType::from_closure(tcx, def_id)
}
MethodTypeParam(MethodParam { ref trait_ref, .. }) |
MethodTraitObject(MethodObject { ref trait_ref, .. }) => {
OverloadedCallType::from_trait_id(tcx, trait_ref.def_id)
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/middle/stability.rs
Expand Up @@ -412,9 +412,6 @@ pub fn check_expr(tcx: &ty::ctxt, e: &ast::Expr,
ty::MethodStatic(def_id) => {
def_id
}
ty::MethodStaticClosure(def_id) => {
def_id
}
ty::MethodTypeParam(ty::MethodParam {
ref trait_ref,
method_num: index,
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/middle/ty.rs
Expand Up @@ -631,9 +631,6 @@ pub enum MethodOrigin<'tcx> {
// fully statically resolved method
MethodStatic(ast::DefId),

// fully statically resolved closure invocation
MethodStaticClosure(ast::DefId),

// method invoked on a type parameter with a bounded trait
MethodTypeParam(MethodParam<'tcx>),

Expand Down
3 changes: 0 additions & 3 deletions src/librustc/middle/ty_fold.rs
Expand Up @@ -316,9 +316,6 @@ impl<'tcx> TypeFoldable<'tcx> for ty::MethodOrigin<'tcx> {
ty::MethodStatic(def_id) => {
ty::MethodStatic(def_id)
}
ty::MethodStaticClosure(def_id) => {
ty::MethodStaticClosure(def_id)
}
ty::MethodTypeParam(ref param) => {
ty::MethodTypeParam(ty::MethodParam {
trait_ref: param.trait_ref.fold_with(folder),
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/util/ppaux.rs
Expand Up @@ -500,9 +500,6 @@ impl<'tcx> fmt::Debug for ty::MethodOrigin<'tcx> {
ty::MethodStatic(def_id) => {
write!(f, "MethodStatic({:?})", def_id)
}
ty::MethodStaticClosure(def_id) => {
write!(f, "MethodStaticClosure({:?})", def_id)
}
ty::MethodTypeParam(ref p) => write!(f, "{:?}", p),
ty::MethodTraitObject(ref p) => write!(f, "{:?}", p)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/builtin.rs
Expand Up @@ -2003,7 +2003,7 @@ impl LintPass for UnconditionalRecursion {
ty::MethodTraitObject(_) => return false,

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

// MethodTypeParam are methods from traits:

Expand Down
1 change: 0 additions & 1 deletion src/librustc_privacy/lib.rs
Expand Up @@ -854,7 +854,6 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
MethodStatic(method_id) => {
self.check_static_method(span, method_id, name)
}
MethodStaticClosure(_) => {}
// Trait methods are always all public. The only controlling factor
// is whether the trait itself is accessible or not.
MethodTypeParam(MethodParam { ref trait_ref, .. }) |
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_trans/save/dump_csv.rs
Expand Up @@ -889,8 +889,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
let method_map = &self.tcx.tables.borrow().method_map;
let method_callee = method_map.get(&ty::MethodCall::expr(ex.id)).unwrap();
let (def_id, decl_id) = match method_callee.origin {
ty::MethodStatic(def_id) |
ty::MethodStaticClosure(def_id) => {
ty::MethodStatic(def_id) => {
// method invoked on an object with a concrete type (not a static method)
let decl_id =
match self.tcx.trait_item_of_item(def_id) {
Expand All @@ -907,7 +906,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
_ => self.sess
.span_bug(ex.span,
"save::process_method_call: non-method \
DefId in MethodStatic or MethodStaticClosure"),
DefId in MethodStatic"),
};
(Some(def_id), decl_id)
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_trans/trans/meth.rs
Expand Up @@ -117,8 +117,7 @@ pub fn trans_method_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
.unwrap();

match origin {
ty::MethodStatic(did) |
ty::MethodStaticClosure(did) => {
ty::MethodStatic(did) => {
debug!("trans_method_callee: static, {:?}", did);
Callee {
bcx: bcx,
Expand Down

0 comments on commit fe354e5

Please sign in to comment.