Sort NLL error diagnostics by span in an attempt to make them match source order

(and thus, hopefully, more closely match user expectation).
This commit is contained in:
Felix S. Klock II 2018-07-31 14:30:46 +02:00
parent 54628c8ea8
commit e8c29959cd

View File

@ -331,6 +331,10 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
}
if mbcx.errors_buffer.len() > 0 {
mbcx.errors_buffer.sort_by(|diag1, diag2| {
diag1.span.primary_span().cmp(&diag2.span.primary_span())
});
if tcx.migrate_borrowck() {
match tcx.borrowck(def_id).signalled_any_error {
SignalledError::NoErrorsSeen => {