Remove rule that place loads may not happen with variant index set
This commit is contained in:
parent
4bce639c3b
commit
8732bf5db3
2 changed files with 6 additions and 10 deletions
|
@ -246,12 +246,9 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
|||
self.super_projection_elem(local, proj_base, elem, context, location);
|
||||
}
|
||||
|
||||
fn visit_place(&mut self, place: &Place<'tcx>, _: PlaceContext, location: Location) {
|
||||
fn visit_place(&mut self, place: &Place<'tcx>, _: PlaceContext, _: Location) {
|
||||
// Set off any `bug!`s in the type computation code
|
||||
let ty = place.ty(&self.body.local_decls, self.tcx);
|
||||
if ty.variant_index.is_some() {
|
||||
self.fail(location, "Top level places may not have their variant index set!");
|
||||
}
|
||||
let _ = place.ty(&self.body.local_decls, self.tcx);
|
||||
}
|
||||
|
||||
fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
|
||||
|
|
|
@ -1931,7 +1931,7 @@ pub struct CopyNonOverlapping<'tcx> {
|
|||
/// pointee type is unsized, the pointer additionally stored the value of the metadata.
|
||||
///
|
||||
/// Computing a place may cause UB. One possibility is that the pointer used for a `Deref` may not
|
||||
/// be suitably aligned. Another possibility is that the place is not in bouns, meaning it does not
|
||||
/// be suitably aligned. Another possibility is that the place is not in bounds, meaning it does not
|
||||
/// point to an actual allocation.
|
||||
///
|
||||
/// However, if this is actually UB and when the UB kicks in is undecided. This is being discussed
|
||||
|
@ -2325,10 +2325,9 @@ pub struct SourceScopeLocalData {
|
|||
/// This is what is implemented in miri today. Are these the semantics we want for MIR? Is this
|
||||
/// something we can even decide without knowing more about Rust's memory model?
|
||||
///
|
||||
/// Loading a place that has its variant index set is not well-formed. However, note that this rule
|
||||
/// only applies to places appearing in MIR bodies. Many functions, such as [`Place::ty`], still
|
||||
/// accept such a place. If you write a function for which it might be ambiguous whether such a
|
||||
/// thing is accepted, make sure to document your choice clearly.
|
||||
/// **Needs clarifiation:** Is loading a place that has its variant index set well-formed? Miri
|
||||
/// currently implements it, but it seems like this may be something to check against in the
|
||||
/// validator.
|
||||
#[derive(Clone, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||
pub enum Operand<'tcx> {
|
||||
/// Creates a value by loading the given place. The type of the place must be `Copy`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue