Prefer DiagnosticBuilder
over Diagnostic
in diagnostic modifiers.
There are lots of functions that modify a diagnostic. This can be via a `&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type wraps the former and impls `DerefMut`. This commit converts all the `&mut Diagnostic` occurrences to `&mut DiagnosticBuilder`. This is a step towards greatly simplifying `Diagnostic`. Some of the relevant function are made generic, because they deal with both errors and warnings. No function bodies are changed, because all the modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`.
This commit is contained in:
parent
8b21296b5d
commit
b18f3e11fa
66 changed files with 536 additions and 454 deletions
|
@ -8,7 +8,7 @@ use super::{AttrWrapper, Capturing, FnParseMode, ForceCollect, Parser, PathStyle
|
|||
use rustc_ast as ast;
|
||||
use rustc_ast::attr;
|
||||
use rustc_ast::token::{self, Delimiter, Nonterminal};
|
||||
use rustc_errors::{codes::*, Diagnostic, PResult};
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder, PResult};
|
||||
use rustc_span::{sym, BytePos, Span};
|
||||
use thin_vec::ThinVec;
|
||||
use tracing::debug;
|
||||
|
@ -141,7 +141,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
fn annotate_following_item_if_applicable(
|
||||
&self,
|
||||
err: &mut Diagnostic,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
span: Span,
|
||||
attr_type: OuterAttributeType,
|
||||
) -> Option<Span> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue