Skip to content
Permalink
Browse files

Make adjustments for comments

  • Loading branch information...
varkor committed Mar 5, 2019
1 parent 5c8b3c3 commit ed9227abbdb14728777691c0d595a93c57a796bf
Showing with 12 additions and 9 deletions.
  1. +6 −2 src/librustc_mir/interpret/operand.rs
  2. +6 −7 src/librustc_mir/monomorphize/collector.rs
@@ -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);

0 comments on commit ed9227a

Please sign in to comment.
You can’t perform that action at this time.