rebase
This commit is contained in:
parent
e14b34c386
commit
15c1c06522
10 changed files with 36 additions and 82 deletions
|
@ -97,7 +97,7 @@ pub(crate) fn try_destructure_const<'tcx>(
|
|||
tcx: TyCtxt<'tcx>,
|
||||
const_: ty::Const<'tcx>,
|
||||
) -> Option<ty::DestructuredConst<'tcx>> {
|
||||
if let ty::ConstKind::Value(valtree) = const_.val() {
|
||||
if let ty::ConstKind::Value(valtree) = const_.kind() {
|
||||
let branches = match valtree {
|
||||
ty::ValTree::Branch(b) => b,
|
||||
_ => return None,
|
||||
|
@ -216,7 +216,7 @@ pub(crate) fn deref_mir_constant<'tcx>(
|
|||
let mplace = ecx.deref_operand(&op).unwrap();
|
||||
if let Some(alloc_id) = mplace.ptr.provenance {
|
||||
assert_eq!(
|
||||
tcx.get_global_alloc(alloc_id).unwrap().unwrap_memory().0 .0.mutability,
|
||||
tcx.get_global_alloc(alloc_id).unwrap().unwrap_memory().0.0.mutability,
|
||||
Mutability::Not,
|
||||
"deref_mir_constant cannot be used with mutable allocations as \
|
||||
that could allow pattern matching to observe mutable statics",
|
||||
|
|
|
@ -638,7 +638,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
span_bug!(self.cur_span(), "const_to_op: Unexpected ConstKind {:?}", c)
|
||||
}
|
||||
ty::ConstKind::Value(valtree) => {
|
||||
let ty = val.ty();
|
||||
let ty = c.ty();
|
||||
let const_val = self.tcx.valtree_to_const_val((ty, valtree));
|
||||
self.const_val_to_op(const_val, ty, layout)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue