about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2025-03-04 19:37:06 -0800
committerGitHub <noreply@github.com>2025-03-04 19:37:06 -0800
commit7f6ad7f96e480a4e6beaa090591d44ffa0c8b425 (patch)
treef4db3d44786b9dac11669764fc5c8a00b362d42a /compiler/rustc_mir_transform/src
parent349f6af4e991cf4df235bd9a2c7f4ce94b09c9f2 (diff)
parent84dd2a77769be235c19302d69b3bd1916718819e (diff)
downloadrust-7f6ad7f96e480a4e6beaa090591d44ffa0c8b425.tar.gz
rust-7f6ad7f96e480a4e6beaa090591d44ffa0c8b425.zip
Rollup merge of #137993 - tmiasko:deduce-comment, r=compiler-errors
Remove obsolete comment from DeduceReadOnly

The situation described in the comment does arise in practice now and described panic is long gone.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/deduce_param_attrs.rs29
1 files changed, 0 insertions, 29 deletions
diff --git a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs
index 049f13ce96d..a0db8bdb7ed 100644
--- a/compiler/rustc_mir_transform/src/deduce_param_attrs.rs
+++ b/compiler/rustc_mir_transform/src/deduce_param_attrs.rs
@@ -80,35 +80,6 @@ impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
         // `f` passes. Note that function arguments are the only situation in which this problem can
         // arise: every other use of `move` in MIR doesn't actually write to the value it moves
         // from.
-        //
-        // Anyway, right now this situation doesn't actually arise in practice. Instead, the MIR for
-        // that function looks like this:
-        //
-        //      fn f(_1: BigStruct) -> () {
-        //          let mut _0: ();
-        //          let mut _2: BigStruct;
-        //          bb0: {
-        //              _2 = move _1;
-        //              _0 = g(move _2) -> bb1;
-        //          }
-        //          ...
-        //      }
-        //
-        // Because of that extra move that MIR construction inserts, `x` (i.e. `_1`) can *in
-        // practice* safely be marked `readonly`.
-        //
-        // To handle the possibility that other optimizations (for example, destination propagation)
-        // might someday generate MIR like the first example above, we panic upon seeing an argument
-        // to *our* function that is directly moved into *another* function as an argument. Having
-        // eliminated that problematic case, we can safely treat moves as copies in this analysis.
-        //
-        // In the future, if MIR optimizations cause arguments of a caller to be directly moved into
-        // the argument of a callee, we can just add that argument to `mutated_args` instead of
-        // panicking.
-        //
-        // Note that, because the problematic MIR is never actually generated, we can't add a test
-        // case for this.
-
         if let TerminatorKind::Call { ref args, .. } = terminator.kind {
             for arg in args {
                 if let Operand::Move(place) = arg.node {