Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit dea752e

Browse files
committed
Rename ShowSpanVisitor::span_diagnostic as ShowSpanVisitor::dcx.
1 parent 5ad7144 commit dea752e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/rustc_ast_passes/src/show_span.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,37 @@ impl FromStr for Mode {
3131
}
3232

3333
struct ShowSpanVisitor<'a> {
34-
span_diagnostic: &'a rustc_errors::DiagCtxt,
34+
dcx: &'a rustc_errors::DiagCtxt,
3535
mode: Mode,
3636
}
3737

3838
impl<'a> Visitor<'a> for ShowSpanVisitor<'a> {
3939
fn visit_expr(&mut self, e: &'a ast::Expr) {
4040
if let Mode::Expression = self.mode {
41-
self.span_diagnostic.emit_warning(errors::ShowSpan { span: e.span, msg: "expression" });
41+
self.dcx.emit_warning(errors::ShowSpan { span: e.span, msg: "expression" });
4242
}
4343
visit::walk_expr(self, e);
4444
}
4545

4646
fn visit_pat(&mut self, p: &'a ast::Pat) {
4747
if let Mode::Pattern = self.mode {
48-
self.span_diagnostic.emit_warning(errors::ShowSpan { span: p.span, msg: "pattern" });
48+
self.dcx.emit_warning(errors::ShowSpan { span: p.span, msg: "pattern" });
4949
}
5050
visit::walk_pat(self, p);
5151
}
5252

5353
fn visit_ty(&mut self, t: &'a ast::Ty) {
5454
if let Mode::Type = self.mode {
55-
self.span_diagnostic.emit_warning(errors::ShowSpan { span: t.span, msg: "type" });
55+
self.dcx.emit_warning(errors::ShowSpan { span: t.span, msg: "type" });
5656
}
5757
visit::walk_ty(self, t);
5858
}
5959
}
6060

61-
pub fn run(span_diagnostic: &rustc_errors::DiagCtxt, mode: &str, krate: &ast::Crate) {
61+
pub fn run(dcx: &rustc_errors::DiagCtxt, mode: &str, krate: &ast::Crate) {
6262
let Ok(mode) = mode.parse() else {
6363
return;
6464
};
65-
let mut v = ShowSpanVisitor { span_diagnostic, mode };
65+
let mut v = ShowSpanVisitor { dcx, mode };
6666
visit::walk_crate(&mut v, krate);
6767
}

0 commit comments

Comments
 (0)