use type_of;
use value::Value;
use Disr;
-use rustc::ty::adjustment::{AdjustDerefRef, AdjustReifyFnPointer};
+use rustc::ty::adjustment::{AdjustNeverToAny, AdjustDerefRef, AdjustReifyFnPointer};
use rustc::ty::adjustment::{AdjustUnsafeFnPointer, AdjustMutToConstPointer};
use rustc::ty::adjustment::CustomCoerceUnsized;
use rustc::ty::{self, Ty, TyCtxt};
hir::ExprPath(..) => {
match bcx.tcx().expect_def(expr.id) {
Def::Const(did) | Def::AssociatedConst(did) => {
- let empty_substs = bcx.tcx().mk_substs(Substs::empty());
+ let empty_substs = Substs::empty(bcx.tcx());
let const_expr = consts::get_const_expr(bcx.ccx(), did, expr,
empty_substs);
// Temporarily get cleanup scopes out of the way,
}
match adjustment {
+ AdjustNeverToAny(..) => true,
AdjustReifyFnPointer => true,
AdjustUnsafeFnPointer | AdjustMutToConstPointer => {
// purely a type-level thing
debug!("unadjusted datum for expr {:?}: {:?} adjustment={:?}",
expr, datum, adjustment);
match adjustment {
+ AdjustNeverToAny(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, Lvalue::new("never")).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)