about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/transform
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-14 14:13:35 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-15 10:13:12 +1100
commit9a7841251115c79fe7e1c12e2e5d637e19ad940a (patch)
tree073dcbd11af1207ae334d4dae991f2f4990d4c59 /compiler/rustc_const_eval/src/transform
parent2c2c7f13a65f22969adf52a8040fb1bed842fb94 (diff)
downloadrust-9a7841251115c79fe7e1c12e2e5d637e19ad940a.tar.gz
rust-9a7841251115c79fe7e1c12e2e5d637e19ad940a.zip
Split `Handler::emit_diagnostic` in two.
Currently, `emit_diagnostic` takes `&mut self`.

This commit changes it so `emit_diagnostic` takes `self` and the new
`emit_diagnostic_without_consuming` function takes `&mut self`.

I find the distinction useful. The former case is much more common, and
avoids a bunch of `mut` and `&mut` occurrences. We can also restrict the
latter with `pub(crate)` which is nice.
Diffstat (limited to 'compiler/rustc_const_eval/src/transform')
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index 5380d3071d6..bb17602d3ba 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -277,8 +277,8 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
         // "secondary" errors if they occurred.
         let secondary_errors = mem::take(&mut self.secondary_errors);
         if self.error_emitted.is_none() {
-            for mut error in secondary_errors {
-                self.tcx.sess.diagnostic().emit_diagnostic(&mut error);
+            for error in secondary_errors {
+                self.tcx.sess.diagnostic().emit_diagnostic(error);
             }
         } else {
             assert!(self.tcx.sess.has_errors().is_some());