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)
}
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)
}
* 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 {
};
// 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
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")
}
}
let fields = lookup_struct_fields(cx, did);
fields.len()
}
- _ => fail!("simd_size called on invalid type")
+ _ => panic!("simd_size called on invalid type")
}
}
// 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);
_ => {
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");
}
}
}
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)
}
}
}
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)
}
}
}
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"),
}
}
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)
}
}
}
UniqTraitStore
}
ref s => {
- fail!("ty_closure_store() called on non-closure type: {}", s)
+ panic!("ty_closure_store() called on non-closure type: {}", s)
}
}
}
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)
}
}
}
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) {
ast::StmtDecl(_, id) | StmtExpr(_, id) | StmtSemi(_, id) => {
return id;
}
- ast::StmtMac(..) => fail!("unexpanded macro in trans")
+ ast::StmtMac(..) => panic!("unexpanded macro in trans")
}
}
}
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());