未验证 提交 8e495999 编写于 作者: R Ralf Jung 提交者: Oliver Schneider

fix normalizing associated types. this brings us up to 52 passing tests!

上级 bb6e5224
......@@ -7,9 +7,10 @@
use rustc::mir::visit::{Visitor, LvalueContext};
use rustc::mir;
use rustc::traits::Reveal;
use rustc::ty;
use rustc::ty::{self, TypeFoldable};
use rustc::ty::layout::Layout;
use rustc::ty::subst::{Subst, Substs};
use rustc::infer::TransNormalize;
use error::{EvalResult, EvalError};
use eval_context::{EvalContext, StackPopCleanup};
......@@ -135,8 +136,16 @@ fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> EvalResult<'tcx> {
Validate(op, ref lvalues) => {
for operand in lvalues {
// We need to monomorphize ty *without* erasing lifetimes
let ty = operand.ty.subst(self.tcx, self.substs());
// TODO: do we have to self.tcx.normalize_associated_type(&{ty}) ? That however seems to erase lifetimes.
let mut ty = operand.ty.subst(self.tcx, self.substs());
// This is essentially a copy of normalize_associated_type, but without erasure
if ty.has_projection_types() {
let param_env = ty::ParamEnv::empty(Reveal::All);
ty = self.tcx.infer_ctxt().enter(move |infcx| {
ty.trans_normalize(&infcx, param_env)
})
}
// Now we can do validation at this type
let lvalue = self.eval_lvalue(&operand.lval)?;
self.validate(lvalue, ty, ValidationCtx::new(op))?;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册