rustc: remove unused MethodStaticClosure variant of MethodOrigin.
This commit is contained in:
parent
50c952b5b7
commit
fe354e58bd
11 changed files with 8 additions and 51 deletions
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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 => {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>),
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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, .. }) |
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue