Skip to content

Commit 50c2a58

Browse files
authored
Fix borrowck errors
Reborrowing doesn't work for loops
1 parent fdce416 commit 50c2a58

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc_errors/emitter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ impl EmitterWriter {
760760
annotations_position.push((p, annotation));
761761
for (j, next) in annotations.iter().enumerate() {
762762
if j > i {
763-
let l = next.label.map_or(0, |label| label.len() + 2);
763+
let l = next.label.as_ref().map_or(0, |label| label.len() + 2);
764764
if (overlaps(next, annotation, l) // Do not allow two labels to be in the same
765765
// line if they overlap including padding, to
766766
// avoid situations like:
@@ -1655,7 +1655,7 @@ impl FileWithAnnotatedLines {
16551655
line_index: usize,
16561656
ann: Annotation) {
16571657

1658-
for slot in file_vec {
1658+
for slot in file_vec.iter_mut() {
16591659
// Look through each of our files for the one we're adding to
16601660
if slot.file.name == file.name {
16611661
// See if we already have a line for it

0 commit comments

Comments
 (0)