about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-10-25 19:37:07 +0200
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-10-25 19:37:07 +0200
commit4dc028743dad4d2d71842c2bb20029b412edaca7 (patch)
tree74091d7fa1d0ad8b2fb24797f2cb43d0992a83fb
parentf7629eff32cf23680074ae72144ed748139100fe (diff)
downloadrust-4dc028743dad4d2d71842c2bb20029b412edaca7.tar.gz
rust-4dc028743dad4d2d71842c2bb20029b412edaca7.zip
Explain why we can encounter a `Goto` terminator that we want to promote
-rw-r--r--src/librustc_mir/transform/promote_consts.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs
index bba9260f2b8..1d45850a080 100644
--- a/src/librustc_mir/transform/promote_consts.rs
+++ b/src/librustc_mir/transform/promote_consts.rs
@@ -332,7 +332,13 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
                             let operand = Operand::Copy(promoted_place(ty, span));
                             mem::replace(&mut args[index], operand)
                         }
-                        // already promoted out
+                        // We expected a `TerminatorKind::Call` for which we'd like to promote an
+                        // argument. Since `qualify_consts` saw a `TerminatorKind::Call` here, but
+                        // we are seeing a `Goto`, that means that the `promote_temps` method
+                        // already promoted this call away entirely. This case occurs when calling
+                        // a function requiring a constant argument and as that constant value
+                        // providing a value whose computation contains another call to a function
+                        // requiring a constant argument.
                         TerminatorKind::Goto { .. } => return,
                         _ => bug!()
                     }