mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
interpret/visitor: ensure we only see normalized types
This commit is contained in:
parent
0809f78c19
commit
29db7890ba
@ -149,6 +149,8 @@ where
|
||||
"`field` projection called on a slice -- call `index` projection instead"
|
||||
);
|
||||
let offset = base.layout().fields.offset(field);
|
||||
// Computing the layout does normalization, so we get a normalized type out of this
|
||||
// even if the field type is non-normalized (possible e.g. via associated types).
|
||||
let field_layout = base.layout().field(self, field);
|
||||
|
||||
// Offset may need adjustment for unsized fields.
|
||||
|
@ -153,6 +153,16 @@ pub trait ValueVisitor<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>>: Sized {
|
||||
// We visited all parts of this one.
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Non-normalized types should never show up here.
|
||||
ty::Param(..)
|
||||
| ty::Alias(..)
|
||||
| ty::Bound(..)
|
||||
| ty::Placeholder(..)
|
||||
| ty::Infer(..)
|
||||
| ty::Error(..) => throw_inval!(TooGeneric),
|
||||
|
||||
// The rest is handled below.
|
||||
_ => {}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user