diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-18 11:10:18 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-18 15:42:11 +0000 |
| commit | 3f34196839730cfb5b241667cfcc9b94599ea0c1 (patch) | |
| tree | 80ece39632f7158170271228cab2199e5f54d0e0 /compiler/rustc_expand/src | |
| parent | 7ba82d61eb519c9c8cb8c47a3030a2bd2faaa186 (diff) | |
| download | rust-3f34196839730cfb5b241667cfcc9b94599ea0c1.tar.gz rust-3f34196839730cfb5b241667cfcc9b94599ea0c1.zip | |
Remove redundant argument from `subdiagnostic` method
Diffstat (limited to 'compiler/rustc_expand/src')
| -rw-r--r-- | compiler/rustc_expand/src/mbe/diagnostics.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_rules.rs | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs index 85ecfa62188..bf475c1dc96 100644 --- a/compiler/rustc_expand/src/mbe/diagnostics.rs +++ b/compiler/rustc_expand/src/mbe/diagnostics.rs @@ -7,7 +7,7 @@ use crate::mbe::{ use rustc_ast::token::{self, Token, TokenKind}; use rustc_ast::tokenstream::TokenStream; use rustc_ast_pretty::pprust; -use rustc_errors::{Applicability, Diag, DiagCtxtHandle, DiagMessage}; +use rustc_errors::{Applicability, Diag, DiagMessage}; use rustc_macros::Subdiagnostic; use rustc_parse::parser::{Parser, Recovery}; use rustc_span::source_map::SourceMap; @@ -61,7 +61,7 @@ pub(super) fn failed_to_match_macro<'cx>( err.span_label(cx.source_map().guess_head_span(def_span), "when calling this macro"); } - annotate_doc_comment(cx.sess.dcx(), &mut err, psess.source_map(), span); + annotate_doc_comment(&mut err, psess.source_map(), span); if let Some(span) = remaining_matcher.span() { err.span_note(span, format!("while trying to match {remaining_matcher}")); @@ -324,17 +324,12 @@ enum ExplainDocComment { }, } -pub(super) fn annotate_doc_comment( - dcx: DiagCtxtHandle<'_>, - err: &mut Diag<'_>, - sm: &SourceMap, - span: Span, -) { +pub(super) fn annotate_doc_comment(err: &mut Diag<'_>, sm: &SourceMap, span: Span) { if let Ok(src) = sm.span_to_snippet(span) { if src.starts_with("///") || src.starts_with("/**") { - err.subdiagnostic(dcx, ExplainDocComment::Outer { span }); + err.subdiagnostic(ExplainDocComment::Outer { span }); } else if src.starts_with("//!") || src.starts_with("/*!") { - err.subdiagnostic(dcx, ExplainDocComment::Inner { span }); + err.subdiagnostic(ExplainDocComment::Inner { span }); } } } diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index fd1aa44fd70..49b1f5ce0e3 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -463,7 +463,7 @@ pub fn compile_declarative_macro( let sp = token.span.substitute_dummy(def.span); let mut err = sess.dcx().struct_span_err(sp, s); err.span_label(sp, msg); - annotate_doc_comment(sess.dcx(), &mut err, sess.source_map(), sp); + annotate_doc_comment(&mut err, sess.source_map(), sp); let guar = err.emit(); return dummy_syn_ext(guar); } |
