Skip to content

Commit

Permalink
Rollup merge of rust-lang#48902 - csmoe:refactor_BorrowckErrors_fn_se…
Browse files Browse the repository at this point in the history
…lf, r=petrochenkov

refactor the `BorrowckErrors` trait to take `fn(self)`

Fixes rust-lang#48783
  • Loading branch information
Mark-Simulacrum authored Mar 12, 2018
2 parents a06899c + cb5ac97 commit 03a4f9d
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 95 deletions.
28 changes: 14 additions & 14 deletions src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,28 +253,28 @@ pub struct BorrowckCtxt<'a, 'tcx: 'a> {
used_mut_nodes: RefCell<FxHashSet<HirId>>,
}

impl<'b, 'tcx: 'b> BorrowckErrors for BorrowckCtxt<'b, 'tcx> {
fn struct_span_err_with_code<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str,
code: DiagnosticId)
-> DiagnosticBuilder<'a>
impl<'a, 'b, 'tcx: 'b> BorrowckErrors<'a> for &'a BorrowckCtxt<'b, 'tcx> {
fn struct_span_err_with_code<S: Into<MultiSpan>>(self,
sp: S,
msg: &str,
code: DiagnosticId)
-> DiagnosticBuilder<'a>
{
self.tcx.sess.struct_span_err_with_code(sp, msg, code)
}

fn struct_span_err<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str)
-> DiagnosticBuilder<'a>
fn struct_span_err<S: Into<MultiSpan>>(self,
sp: S,
msg: &str)
-> DiagnosticBuilder<'a>
{
self.tcx.sess.struct_span_err(sp, msg)
}

fn cancel_if_wrong_origin<'a>(&'a self,
mut diag: DiagnosticBuilder<'a>,
o: Origin)
-> DiagnosticBuilder<'a>
fn cancel_if_wrong_origin(self,
mut diag: DiagnosticBuilder<'a>,
o: Origin)
-> DiagnosticBuilder<'a>
{
if !o.should_emit_errors(self.tcx.borrowck_mode()) {
self.tcx.sess.diagnostic().cancel(&mut diag);
Expand Down
Loading

0 comments on commit 03a4f9d

Please sign in to comment.