From fc3da915b88bed53c03b03d89bf2e10ad7b841ae Mon Sep 17 00:00:00 2001 From: beepster4096 <19316085+beepster4096@users.noreply.github.com> Date: Fri, 10 Oct 2025 14:54:11 -0700 Subject: [PATCH 1/2] update movepath docs --- .../moves_and_initialization/move_paths.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/borrow_check/moves_and_initialization/move_paths.md b/src/borrow_check/moves_and_initialization/move_paths.md index 95518fbc0..9ed4e67f6 100644 --- a/src/borrow_check/moves_and_initialization/move_paths.md +++ b/src/borrow_check/moves_and_initialization/move_paths.md @@ -67,8 +67,6 @@ We don't actually create a move-path for **every** [`Place`] that gets used. In particular, if it is illegal to move from a [`Place`], then there is no need for a [`MovePathIndex`]. Some examples: -- You cannot move from a static variable, so we do not create a [`MovePathIndex`] - for static variables. - You cannot move an individual element of an array, so if we have e.g. `foo: [String; 3]`, there would be no move-path for `foo[1]`. - You cannot move from inside of a borrowed reference, so if we have e.g. `foo: &String`, @@ -82,6 +80,18 @@ initialized (which lowers overhead). [`move_path_for`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/move_paths/builder/struct.MoveDataBuilder.html#method.move_path_for +## Projections + +Instead of using [`PlaceElem`], projections in move paths are stored as [`MoveSubPath`]s. +Projections that can't be moved out of and projections that can be skipped are not represented. + +Subslice projections of arrays (produced by slice patterns) are special; they're turned into +multiple [`ConstantIndex`] subpaths, one for each element in the subslice. + +[`PlaceElem`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/type.PlaceElem.html +[`MoveSubPath`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/move_paths/enum.MoveSubPath.html +[`ConstantIndex`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/move_paths/enum.MoveSubPath.html#variant.ConstantIndex + ## Looking up a move-path If you have a [`Place`] and you would like to convert it to a [`MovePathIndex`], you From 730eb697787a4dff256c5d63c4794fa02e323342 Mon Sep 17 00:00:00 2001 From: The rustc-josh-sync Cronjob Bot Date: Mon, 20 Oct 2025 04:16:31 +0000 Subject: [PATCH 2/2] Prepare for merging from rust-lang/rust This updates the rust-version file to c0c37cafdcf74a8c8b53fe19c85d546c57437e98. --- rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-version b/rust-version index 47552aee0..7d8b16105 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -4fa824bb78318a3cba8c7339d5754b4909922547 +c0c37cafdcf74a8c8b53fe19c85d546c57437e98