diff options
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/mod.rs | 9 |
2 files changed, 6 insertions, 10 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index f153c613f8c..01af9585135 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -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) { diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index c690d2b9d33..9f7832c8a64 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -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` |
