Skip to content

Commit e27bae0

Browse files
committed
Remove 'not reporting regions error due to nll' warning
1 parent 1114ab6 commit e27bae0

File tree

1 file changed

+10
-33
lines changed
  • src/librustc/infer/error_reporting

1 file changed

+10
-33
lines changed

src/librustc/infer/error_reporting/mod.rs

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ use middle::region;
6868
use traits::{ObligationCause, ObligationCauseCode};
6969
use ty::{self, subst::Subst, Region, Ty, TyCtxt, TypeFoldable, TyKind};
7070
use ty::error::TypeError;
71+
use session::config::BorrowckMode;
7172
use syntax::ast::DUMMY_NODE_ID;
7273
use syntax_pos::{Pos, Span};
7374
use errors::{Applicability, DiagnosticBuilder, DiagnosticStyledString};
@@ -303,40 +304,16 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
303304
) {
304305
debug!("report_region_errors(): {} errors to start", errors.len());
305306

306-
if will_later_be_reported_by_nll &&
307-
// FIXME: `use_mir_borrowck` seems wrong here...
308-
self.tcx.use_mir_borrowck() &&
309-
// ... this is a band-aid; may be better to explicitly
310-
// match on every borrowck_mode variant to guide decision
311-
// here.
312-
!self.tcx.migrate_borrowck() {
313-
314-
// With `#![feature(nll)]`, we want to present a nice user
315-
// experience, so don't even mention the errors from the
316-
// AST checker.
317-
if self.tcx.features().nll {
318-
return;
307+
// If the errors will later be reported by NLL, choose wether to display them or not based
308+
// on the borrowck mode
309+
if will_later_be_reported_by_nll {
310+
match self.tcx.borrowck_mode() {
311+
// If we're on AST or Migrate mode, report AST region errors
312+
BorrowckMode::Ast | BorrowckMode::Migrate => {},
313+
// If we're on MIR or Compare mode, don't report AST region errors as they should
314+
// be reported by NLL
315+
BorrowckMode::Compare | BorrowckMode::Mir => return,
319316
}
320-
321-
// But with nll, it's nice to have some note for later.
322-
for error in errors {
323-
match *error {
324-
RegionResolutionError::ConcreteFailure(ref origin, ..)
325-
| RegionResolutionError::GenericBoundFailure(ref origin, ..) => {
326-
self.tcx
327-
.sess
328-
.span_warn(origin.span(), "not reporting region error due to nll");
329-
}
330-
331-
RegionResolutionError::SubSupConflict(ref rvo, ..) => {
332-
self.tcx
333-
.sess
334-
.span_warn(rvo.span(), "not reporting region error due to nll");
335-
}
336-
}
337-
}
338-
339-
return;
340317
}
341318

342319
// try to pre-process the errors, which will group some of them

0 commit comments

Comments
 (0)