Skip to content

Commit 02eeaad

Browse files
committed
Rustup to rustc 1.38.0-nightly (71f9384e3 2019-07-12)
1 parent 55b9923 commit 02eeaad

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/constant.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn trans_promoted<'a, 'tcx: 'a>(
6565
}))
6666
{
6767
Ok(const_) => {
68-
let cplace = trans_const_place(fx, *const_);
68+
let cplace = trans_const_place(fx, const_);
6969
debug_assert_eq!(cplace.layout(), fx.layout_of(dest_ty));
7070
cplace
7171
}
@@ -90,7 +90,7 @@ pub fn trans_constant<'a, 'tcx: 'a>(
9090
pub fn force_eval_const<'a, 'tcx: 'a>(
9191
fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
9292
const_: &'tcx Const,
93-
) -> Const<'tcx> {
93+
) -> &'tcx Const<'tcx> {
9494
match const_.val {
9595
ConstValue::Unevaluated(def_id, ref substs) => {
9696
let param_env = ParamEnv::reveal_all();
@@ -100,15 +100,15 @@ pub fn force_eval_const<'a, 'tcx: 'a>(
100100
instance,
101101
promoted: None,
102102
};
103-
*fx.tcx.const_eval(param_env.and(cid)).unwrap()
103+
fx.tcx.const_eval(param_env.and(cid)).unwrap()
104104
}
105-
_ => *fx.monomorphize(&const_),
105+
_ => fx.monomorphize(&const_),
106106
}
107107
}
108108

109109
pub fn trans_const_value<'a, 'tcx: 'a>(
110110
fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
111-
const_: Const<'tcx>,
111+
const_: &'tcx Const<'tcx>,
112112
) -> CValue<'tcx> {
113113
let ty = fx.monomorphize(&const_.ty);
114114
let layout = fx.layout_of(ty);
@@ -137,7 +137,7 @@ pub fn trans_const_value<'a, 'tcx: 'a>(
137137

138138
fn trans_const_place<'a, 'tcx: 'a>(
139139
fx: &mut FunctionCx<'a, 'tcx, impl Backend>,
140-
const_: Const<'tcx>,
140+
const_: &'tcx Const<'tcx>,
141141
) -> CPlace<'tcx> {
142142
// Adapted from https://github.com/rust-lang/rust/pull/53671/files#diff-e0b58bb6712edaa8595ad7237542c958L551
143143
let result = || -> InterpResult<'tcx, &'tcx Allocation> {
@@ -160,13 +160,13 @@ fn trans_const_place<'a, 'tcx: 'a>(
160160
span: DUMMY_SP,
161161
ty: const_.ty,
162162
user_ty: None,
163-
literal: fx.tcx.mk_const(const_),
163+
literal: const_,
164164
})),
165165
None,
166166
)?;
167167
let ptr = ecx.allocate(op.layout, MemoryKind::Stack);
168168
ecx.copy_op(op, ptr.into())?;
169-
let alloc = ecx.memory().get(ptr.to_ptr()?.alloc_id)?;
169+
let alloc = ecx.memory().get(ptr.to_ref().to_scalar()?.to_ptr()?.alloc_id)?;
170170
Ok(fx.tcx.intern_const_alloc(alloc.clone()))
171171
};
172172
let alloc = result().expect("unable to convert ConstValue to Allocation");

src/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub fn codegen_intrinsic_call<'a, 'tcx: 'a>(
200200
};
201201
type_name, <T> () {
202202
let type_name = fx.tcx.type_name(T);
203-
let type_name = crate::constant::trans_const_value(fx, *type_name);
203+
let type_name = crate::constant::trans_const_value(fx, type_name);
204204
ret.write_cvalue(fx, type_name);
205205
};
206206

0 commit comments

Comments
 (0)