From 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:43 +0200 Subject: Merging upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_ast_passes/src/show_span.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_ast_passes/src/show_span.rs') diff --git a/compiler/rustc_ast_passes/src/show_span.rs b/compiler/rustc_ast_passes/src/show_span.rs index 27637e311..280cf3284 100644 --- a/compiler/rustc_ast_passes/src/show_span.rs +++ b/compiler/rustc_ast_passes/src/show_span.rs @@ -9,6 +9,8 @@ use rustc_ast as ast; use rustc_ast::visit; use rustc_ast::visit::Visitor; +use crate::errors; + enum Mode { Expression, Pattern, @@ -36,21 +38,21 @@ struct ShowSpanVisitor<'a> { impl<'a> Visitor<'a> for ShowSpanVisitor<'a> { fn visit_expr(&mut self, e: &'a ast::Expr) { if let Mode::Expression = self.mode { - self.span_diagnostic.span_warn(e.span, "expression"); + self.span_diagnostic.emit_warning(errors::ShowSpan { span: e.span, msg: "expression" }); } visit::walk_expr(self, e); } fn visit_pat(&mut self, p: &'a ast::Pat) { if let Mode::Pattern = self.mode { - self.span_diagnostic.span_warn(p.span, "pattern"); + self.span_diagnostic.emit_warning(errors::ShowSpan { span: p.span, msg: "pattern" }); } visit::walk_pat(self, p); } fn visit_ty(&mut self, t: &'a ast::Ty) { if let Mode::Type = self.mode { - self.span_diagnostic.span_warn(t.span, "type"); + self.span_diagnostic.emit_warning(errors::ShowSpan { span: t.span, msg: "type" }); } visit::walk_ty(self, t); } -- cgit v1.2.3