Fix typos in compiler
This commit is contained in:
parent
a73288371e
commit
677357d32b
71 changed files with 140 additions and 136 deletions
|
@ -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)]
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue