Make adjustments for comments
This commit is contained in:
parent
5c8b3c38f1
commit
ed9227abbd
2 changed files with 12 additions and 9 deletions
|
|
@ -593,9 +593,13 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
|
|||
let ty = self.monomorphize(val.ty)?;
|
||||
self.layout_of(ty)
|
||||
})?;
|
||||
let op = match val.val {
|
||||
ConstValue::Param(_) => return Err(EvalErrorKind::TooGeneric.into()),
|
||||
let val = match val.val {
|
||||
ConstValue::Param(_) => self.monomorphize(val)?.val,
|
||||
ConstValue::Infer(_) => bug!(),
|
||||
val => val,
|
||||
};
|
||||
let op = match val {
|
||||
ConstValue::Param(_) | ConstValue::Infer(_) => unreachable!(),
|
||||
ConstValue::ByRef(ptr, alloc) => {
|
||||
// We rely on mutability being set correctly in that allocation to prevent writes
|
||||
// where none should happen -- and for `static mut`, we copy on demand anyway.
|
||||
|
|
|
|||
|
|
@ -467,14 +467,13 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
{
|
||||
let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count();
|
||||
let const_length = instance.substs.consts()
|
||||
.filter_map(|ct| {
|
||||
if let ty::LazyConst::Evaluated(ct) = ct {
|
||||
Some(ct.ty.walk())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
.flat_map(|ct| {
|
||||
let ty = match ct {
|
||||
ty::LazyConst::Evaluated(ct) => ct.ty,
|
||||
ty::LazyConst::Unevaluated(def_id, _) => tcx.type_of(*def_id),
|
||||
};
|
||||
ty.walk()
|
||||
})
|
||||
.flatten()
|
||||
.count();
|
||||
debug!(" => type length={}, const length={}", type_length, const_length);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue