use type_of;
use value::Value;
use Disr;
-use rustc::ty::adjustment::{AdjustDerefRef, AdjustReifyFnPointer};
+use rustc::ty::adjustment::{AdjustEmptyToAny, AdjustDerefRef, AdjustReifyFnPointer};
use rustc::ty::adjustment::{AdjustUnsafeFnPointer, AdjustMutToConstPointer};
use rustc::ty::adjustment::CustomCoerceUnsized;
use rustc::ty::{self, Ty, TyCtxt};
}
match adjustment {
+ AdjustEmptyToAny(..) => true,
AdjustReifyFnPointer => true,
AdjustUnsafeFnPointer | AdjustMutToConstPointer => {
// purely a type-level thing
debug!("unadjusted datum for expr {:?}: {:?} adjustment={:?}",
expr, datum, adjustment);
match adjustment {
+ AdjustEmptyToAny(ref target) => {
+ let mono_target = bcx.monomorphize(target);
+ let llty = type_of::type_of(bcx.ccx(), mono_target);
+ let dummy = C_undef(llty.ptr_to());
+ datum = Datum::new(dummy, mono_target, Rvalue::new(ByRef)).to_expr_datum();
+ }
AdjustReifyFnPointer => {
match datum.ty.sty {
ty::TyFnDef(def_id, substs, _) => {
let ix_datum = unpack_datum!(bcx, trans(bcx, idx));
let ref_ty = // invoked methods have LB regions instantiated:
- bcx.tcx().no_late_bound_regions(&method_ty.fn_ret()).unwrap().unwrap();
+ bcx.tcx().no_late_bound_regions(&method_ty.fn_ret()).unwrap();
let elt_ty = match ref_ty.builtin_deref(true, ty::NoPreference) {
None => {
span_bug!(index_expr.span,
};
let ref_ty = // invoked methods have their LB regions instantiated
- ccx.tcx().no_late_bound_regions(&method_ty.fn_ret()).unwrap().unwrap();
+ ccx.tcx().no_late_bound_regions(&method_ty.fn_ret()).unwrap();
let scratch = rvalue_scratch_datum(bcx, ref_ty, "overloaded_deref");
bcx = Callee::method(bcx, method)