about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorAnthonyMikh <anthony.mikh@yandex.ru>2019-10-01 03:22:07 +0300
committerGitHub <noreply@github.com>2019-10-01 03:22:07 +0300
commit50c2a58d086ec9124a6749eb75afc35c0bc1652f (patch)
tree643d7ef3b4288aa1c5b547d63771e30b7d521622 /src/librustc_errors
parentfdce4168fc4c0a46bbe59d482f3d8a4cb4155537 (diff)
downloadrust-50c2a58d086ec9124a6749eb75afc35c0bc1652f.tar.gz
rust-50c2a58d086ec9124a6749eb75afc35c0bc1652f.zip
Fix borrowck errors
Reborrowing doesn't work for loops
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 263ffb0d17c..0c7aa3582ac 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -760,7 +760,7 @@ impl EmitterWriter {
             annotations_position.push((p, annotation));
             for (j, next) in annotations.iter().enumerate() {
                 if j > i  {
-                    let l = next.label.map_or(0, |label| label.len() + 2);
+                    let l = next.label.as_ref().map_or(0, |label| label.len() + 2);
                     if (overlaps(next, annotation, l) // Do not allow two labels to be in the same
                                                      // line if they overlap including padding, to
                                                      // avoid situations like:
@@ -1655,7 +1655,7 @@ impl FileWithAnnotatedLines {
                                   line_index: usize,
                                   ann: Annotation) {
 
-            for slot in file_vec {
+            for slot in file_vec.iter_mut() {
                 // Look through each of our files for the one we're adding to
                 if slot.file.name == file.name {
                     // See if we already have a line for it