Skip to content

Commit 124fb14

Browse files
committed
update Operand::Move docs
1 parent 95392ef commit 124fb14

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

compiler/rustc_middle/src/mir/syntax.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,6 @@ pub type PlaceElem<'tcx> = ProjectionElem<Local, Ty<'tcx>>;
10501050
/// there may be other effects: if the type has a validity constraint loading the place might be UB
10511051
/// if the validity constraint is not met.
10521052
///
1053-
/// **Needs clarification:** Ralf proposes that loading a place not have side-effects.
1054-
/// This is what is implemented in miri today. Are these the semantics we want for MIR? Is this
1055-
/// something we can even decide without knowing more about Rust's memory model?
1056-
///
10571053
/// **Needs clarification:** Is loading a place that has its variant index set well-formed? Miri
10581054
/// currently implements it, but it seems like this may be something to check against in the
10591055
/// validator.
@@ -1071,6 +1067,16 @@ pub enum Operand<'tcx> {
10711067
/// in [UCG#188]. You should not emit MIR that may attempt a subsequent second load of this
10721068
/// place without first re-initializing it.
10731069
///
1070+
/// **Needs clarification:** The operational impact of `Move` is unclear. Currently (both in
1071+
/// Miri and codegen) it has no effect at all unless it appears in an argument to `Call`; for
1072+
/// `Call` it allows the argument to be passed to the callee "in-place", i.e. the callee might
1073+
/// just get a reference to this place instead of a full copy. Miri implements this with a
1074+
/// combination of aliasing model "protectors" and putting `uninit` into the place. Ralf
1075+
/// proposes that we don't want these semantics for `Move` in regular assignments, because
1076+
/// loading a place should not have side-effects, and the aliasing model "protectors" are
1077+
/// inherently tied to a function call. Are these the semantics we want for MIR? Is this
1078+
/// something we can even decide without knowing more about Rust's memory model?
1079+
///
10741080
/// [UCG#188]: https://github.com/rust-lang/unsafe-code-guidelines/issues/188
10751081
Move(Place<'tcx>),
10761082

0 commit comments

Comments
 (0)