Skip to content

Commit 03a4f9d

Browse files
Rollup merge of rust-lang#48902 - csmoe:refactor_BorrowckErrors_fn_self, r=petrochenkov
refactor the `BorrowckErrors` trait to take `fn(self)` Fixes rust-lang#48783
2 parents a06899c + cb5ac97 commit 03a4f9d

File tree

2 files changed

+127
-95
lines changed

2 files changed

+127
-95
lines changed

src/librustc_borrowck/borrowck/mod.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -253,28 +253,28 @@ pub struct BorrowckCtxt<'a, 'tcx: 'a> {
253253
used_mut_nodes: RefCell<FxHashSet<HirId>>,
254254
}
255255

256-
impl<'b, 'tcx: 'b> BorrowckErrors for BorrowckCtxt<'b, 'tcx> {
257-
fn struct_span_err_with_code<'a, S: Into<MultiSpan>>(&'a self,
258-
sp: S,
259-
msg: &str,
260-
code: DiagnosticId)
261-
-> DiagnosticBuilder<'a>
256+
impl<'a, 'b, 'tcx: 'b> BorrowckErrors<'a> for &'a BorrowckCtxt<'b, 'tcx> {
257+
fn struct_span_err_with_code<S: Into<MultiSpan>>(self,
258+
sp: S,
259+
msg: &str,
260+
code: DiagnosticId)
261+
-> DiagnosticBuilder<'a>
262262
{
263263
self.tcx.sess.struct_span_err_with_code(sp, msg, code)
264264
}
265265

266-
fn struct_span_err<'a, S: Into<MultiSpan>>(&'a self,
267-
sp: S,
268-
msg: &str)
269-
-> DiagnosticBuilder<'a>
266+
fn struct_span_err<S: Into<MultiSpan>>(self,
267+
sp: S,
268+
msg: &str)
269+
-> DiagnosticBuilder<'a>
270270
{
271271
self.tcx.sess.struct_span_err(sp, msg)
272272
}
273273

274-
fn cancel_if_wrong_origin<'a>(&'a self,
275-
mut diag: DiagnosticBuilder<'a>,
276-
o: Origin)
277-
-> DiagnosticBuilder<'a>
274+
fn cancel_if_wrong_origin(self,
275+
mut diag: DiagnosticBuilder<'a>,
276+
o: Origin)
277+
-> DiagnosticBuilder<'a>
278278
{
279279
if !o.should_emit_errors(self.tcx.borrowck_mode()) {
280280
self.tcx.sess.diagnostic().cancel(&mut diag);

0 commit comments

Comments
 (0)