]> git.lizzy.rs Git - rust.git/commitdiff
rollup merge of #18413 : bkoropoff/issue-18412
authorAlex Crichton <alex@alexcrichton.com>
Thu, 30 Oct 2014 15:57:40 +0000 (08:57 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 30 Oct 2014 16:29:24 +0000 (09:29 -0700)
1  2 
src/librustc/middle/trans/expr.rs
src/librustc/middle/ty.rs

index 4d004c85f6e5f1ce47b3c93e23bef00d0a8426cd,36635da3a9e1fc2c6f2b60e155c345664d15601a..2fcc4f6af151700a88e9292c0a49f08fddea2642
@@@ -833,7 -833,7 +833,7 @@@ fn trans_def<'blk, 'tcx>(bcx: Block<'bl
  
      let _icx = push_ctxt("trans_def_lvalue");
      match def {
-         def::DefFn(..) | def::DefStaticMethod(..) |
+         def::DefFn(..) | def::DefStaticMethod(..) | def::DefMethod(..) |
          def::DefStruct(_) | def::DefVariant(..) => {
              trans_def_fn_unadjusted(bcx, ref_expr, def)
          }
@@@ -1191,10 -1191,12 +1191,12 @@@ fn trans_def_fn_unadjusted<'blk, 'tcx>(
      let llfn = match def {
          def::DefFn(did, _, _) |
          def::DefStruct(did) | def::DefVariant(_, did, _) |
-         def::DefStaticMethod(did, def::FromImpl(_), _) => {
+         def::DefStaticMethod(did, def::FromImpl(_), _) |
+         def::DefMethod(did, _, def::FromImpl(_)) => {
              callee::trans_fn_ref(bcx, did, ExprId(ref_expr.id))
          }
-         def::DefStaticMethod(impl_did, def::FromTrait(trait_did), _) => {
+         def::DefStaticMethod(impl_did, def::FromTrait(trait_did), _) |
+         def::DefMethod(impl_did, _, def::FromTrait(trait_did)) => {
              meth::trans_static_method_callee(bcx, impl_did,
                                               trait_did, ref_expr.id)
          }
@@@ -1263,7 -1265,7 +1265,7 @@@ pub fn with_field_tys<R>(tcx: &ty::ctxt
       * Helper for enumerating the field types of structs, enums, or records.
       * The optional node ID here is the node ID of the path identifying the enum
       * variant in use. If none, this cannot possibly an enum variant (so, if it
 -     * is and `node_id_opt` is none, this function fails).
 +     * is and `node_id_opt` is none, this function panics).
       */
  
      match ty::get(ty).sty {
@@@ -1421,7 -1423,7 +1423,7 @@@ pub fn trans_adt<'blk, 'tcx>(mut bcx: B
      };
  
      // This scope holds intermediates that must be cleaned should
 -    // failure occur before the ADT as a whole is ready.
 +    // panic occur before the ADT as a whole is ready.
      let custom_cleanup_scope = fcx.push_custom_cleanup_scope();
  
      // First we trans the base, if we have one, to the dest
index edb67f7fddf8b3f971dd7538964dbf0f11b27204,fda47dba7d4b6725aaf7472733ba5b0825434c20..3a1dbb887be67d40c0571071a80651096a405527
@@@ -2083,7 -2083,7 +2083,7 @@@ pub fn simd_type(cx: &ctxt, ty: t) -> 
              let fields = lookup_struct_fields(cx, did);
              lookup_field_type(cx, did, fields[0].id, substs)
          }
 -        _ => fail!("simd_type called on invalid type")
 +        _ => panic!("simd_type called on invalid type")
      }
  }
  
@@@ -2093,7 -2093,7 +2093,7 @@@ pub fn simd_size(cx: &ctxt, ty: t) -> u
              let fields = lookup_struct_fields(cx, did);
              fields.len()
          }
 -        _ => fail!("simd_size called on invalid type")
 +        _ => panic!("simd_size called on invalid type")
      }
  }
  
@@@ -2564,7 -2564,7 +2564,7 @@@ pub fn type_contents(cx: &ctxt, ty: t) 
                  // the current crate; therefore, the only type parameters that
                  // could be in scope are those defined in the current crate.
                  // If this assertion fails, it is likely because of a
 -                // failure in the cross-crate inlining code to translate a
 +                // failure of the cross-crate inlining code to translate a
                  // def-id.
                  assert_eq!(p.def_id.krate, ast::LOCAL_CRATE);
  
@@@ -3097,7 -3097,7 +3097,7 @@@ pub fn unsized_part_of_type(cx: &ctxt, 
          _ => {
              assert!(type_is_sized(cx, ty),
                      "unsized_part_of_type failed even though ty is unsized");
 -            fail!("called unsized_part_of_type with sized ty");
 +            panic!("called unsized_part_of_type with sized ty");
          }
      }
  }
@@@ -3229,7 -3229,7 +3229,7 @@@ pub fn fn_is_variadic(fty: t) -> bool 
          ty_bare_fn(ref f) => f.sig.variadic,
          ty_closure(ref f) => f.sig.variadic,
          ref s => {
 -            fail!("fn_is_variadic() called on non-fn type: {}", s)
 +            panic!("fn_is_variadic() called on non-fn type: {}", s)
          }
      }
  }
@@@ -3239,7 -3239,7 +3239,7 @@@ pub fn ty_fn_sig(fty: t) -> FnSig 
          ty_bare_fn(ref f) => f.sig.clone(),
          ty_closure(ref f) => f.sig.clone(),
          ref s => {
 -            fail!("ty_fn_sig() called on non-fn type: {}", s)
 +            panic!("ty_fn_sig() called on non-fn type: {}", s)
          }
      }
  }
@@@ -3249,7 -3249,7 +3249,7 @@@ pub fn ty_fn_abi(fty: t) -> abi::Abi 
      match get(fty).sty {
          ty_bare_fn(ref f) => f.abi,
          ty_closure(ref f) => f.abi,
 -        _ => fail!("ty_fn_abi() called on non-fn type"),
 +        _ => panic!("ty_fn_abi() called on non-fn type"),
      }
  }
  
@@@ -3259,7 -3259,7 +3259,7 @@@ pub fn ty_fn_args(fty: t) -> Vec<t> 
          ty_bare_fn(ref f) => f.sig.inputs.clone(),
          ty_closure(ref f) => f.sig.inputs.clone(),
          ref s => {
 -            fail!("ty_fn_args() called on non-fn type: {}", s)
 +            panic!("ty_fn_args() called on non-fn type: {}", s)
          }
      }
  }
@@@ -3273,7 -3273,7 +3273,7 @@@ pub fn ty_closure_store(fty: t) -> Trai
              UniqTraitStore
          }
          ref s => {
 -            fail!("ty_closure_store() called on non-closure type: {}", s)
 +            panic!("ty_closure_store() called on non-closure type: {}", s)
          }
      }
  }
@@@ -3283,7 -3283,7 +3283,7 @@@ pub fn ty_fn_ret(fty: t) -> FnOutput 
          ty_bare_fn(ref f) => f.sig.output,
          ty_closure(ref f) => f.sig.output,
          ref s => {
 -            fail!("ty_fn_ret() called on non-fn type: {}", s)
 +            panic!("ty_fn_ret() called on non-fn type: {}", s)
          }
      }
  }
@@@ -3631,7 -3631,7 +3631,7 @@@ pub fn expr_kind(tcx: &ctxt, expr: &ast
                  def::DefFn(_, _, true) => RvalueDpsExpr,
  
                  // Fn pointers are just scalar values.
-                 def::DefFn(..) | def::DefStaticMethod(..) => RvalueDatumExpr,
+                 def::DefFn(..) | def::DefStaticMethod(..) | def::DefMethod(..) => RvalueDatumExpr,
  
                  // Note: there is actually a good case to be made that
                  // DefArg's, particularly those of immediate type, ought to
              // Special case `Box<T>` for now:
              let definition = match tcx.def_map.borrow().find(&place.id) {
                  Some(&def) => def,
 -                None => fail!("no def for place"),
 +                None => panic!("no def for place"),
              };
              let def_id = definition.def_id();
              if tcx.lang_items.exchange_heap() == Some(def_id) {
@@@ -3760,7 -3760,7 +3760,7 @@@ pub fn stmt_node_id(s: &ast::Stmt) -> a
        ast::StmtDecl(_, id) | StmtExpr(_, id) | StmtSemi(_, id) => {
          return id;
        }
 -      ast::StmtMac(..) => fail!("unexpanded macro in trans")
 +      ast::StmtMac(..) => panic!("unexpanded macro in trans")
      }
  }
  
@@@ -4068,7 -4068,7 +4068,7 @@@ fn lookup_locally_or_in_crate_store<V:C
      }
  
      if def_id.krate == ast::LOCAL_CRATE {
 -        fail!("No def'n found for {} in tcx.{}", def_id, descr);
 +        panic!("No def'n found for {} in tcx.{}", def_id, descr);
      }
      let v = load_external();
      map.insert(def_id, v.clone());