1
Fork 0

Fix typos in compiler

This commit is contained in:
DaniPopes 2023-04-10 22:02:52 +02:00
parent a73288371e
commit 677357d32b
No known key found for this signature in database
GPG key ID: 0F09640DDB7AC692
71 changed files with 140 additions and 136 deletions

View file

@ -593,7 +593,7 @@ pub struct MultipleMutBorrows {
#[primary_span]
pub span: Span,
#[subdiagnostic]
pub occurences: Vec<Conflict>,
pub occurrences: Vec<Conflict>,
}
#[derive(Diagnostic)]
@ -602,7 +602,7 @@ pub struct AlreadyBorrowed {
#[primary_span]
pub span: Span,
#[subdiagnostic]
pub occurences: Vec<Conflict>,
pub occurrences: Vec<Conflict>,
}
#[derive(Diagnostic)]
@ -611,7 +611,7 @@ pub struct AlreadyMutBorrowed {
#[primary_span]
pub span: Span,
#[subdiagnostic]
pub occurences: Vec<Conflict>,
pub occurrences: Vec<Conflict>,
}
#[derive(Diagnostic)]
@ -620,7 +620,7 @@ pub struct MovedWhileBorrowed {
#[primary_span]
pub span: Span,
#[subdiagnostic]
pub occurences: Vec<Conflict>,
pub occurrences: Vec<Conflict>,
}
#[derive(Subdiagnostic)]

View file

@ -966,30 +966,30 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, '_, 'tcx>,
let report_mut_ref = !conflicts_mut_ref.is_empty();
let report_move_conflict = !conflicts_move.is_empty();
let mut occurences = match mut_outer {
let mut occurrences = match mut_outer {
Mutability::Mut => vec![Conflict::Mut { span: pat.span, name }],
Mutability::Not => vec![Conflict::Ref { span: pat.span, name }],
};
occurences.extend(conflicts_mut_mut);
occurences.extend(conflicts_mut_ref);
occurences.extend(conflicts_move);
occurrences.extend(conflicts_mut_mut);
occurrences.extend(conflicts_mut_ref);
occurrences.extend(conflicts_move);
// Report errors if any.
if report_mut_mut {
// Report mutability conflicts for e.g. `ref mut x @ Some(ref mut y)`.
sess.emit_err(MultipleMutBorrows { span: pat.span, occurences });
sess.emit_err(MultipleMutBorrows { span: pat.span, occurrences });
} else if report_mut_ref {
// Report mutability conflicts for e.g. `ref x @ Some(ref mut y)` or the converse.
match mut_outer {
Mutability::Mut => {
sess.emit_err(AlreadyMutBorrowed { span: pat.span, occurences });
sess.emit_err(AlreadyMutBorrowed { span: pat.span, occurrences });
}
Mutability::Not => {
sess.emit_err(AlreadyBorrowed { span: pat.span, occurences });
sess.emit_err(AlreadyBorrowed { span: pat.span, occurrences });
}
};
} else if report_move_conflict {
// Report by-ref and by-move conflicts, e.g. `ref x @ y`.
sess.emit_err(MovedWhileBorrowed { span: pat.span, occurences });
sess.emit_err(MovedWhileBorrowed { span: pat.span, occurrences });
}
}