Skip to content

Commit 2ced8b3

Browse files
authored
Rollup merge of #134187 - nnethercote:rm-PErr, r=jieyouxu
Remove `PErr`. It's just a synonym for `Diag` that adds no value and is only used in a few places. r? ``@spastorino``
2 parents 1055659 + 40c9645 commit 2ced8b3

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

‎compiler/rustc_errors/src/lib.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ mod styled_buffer;
9494
mod tests;
9595
pubmod translation;
9696

97-
pubtypePErr<'a> = Diag<'a>;
98-
pubtypePResult<'a,T> = Result<T,PErr<'a>>;
97+
pubtypePResult<'a,T> = Result<T,Diag<'a>>;
9998

10099
rustc_fluent_macro::fluent_messages! {"../messages.ftl"}
101100

‎compiler/rustc_parse/src/lexer/tokentrees.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_ast::token::{self,Delimiter,Token};
22
use rustc_ast::tokenstream::{DelimSpacing,DelimSpan,Spacing,TokenStream,TokenTree};
33
use rustc_ast_pretty::pprust::token_to_string;
4-
use rustc_errors::{Applicability,PErr};
4+
use rustc_errors::{Applicability,Diag};
55
use rustc_span::symbol::kw;
66

77
usesuper::diagnostics::{report_suspicious_mismatch_block, same_indentation_level};
@@ -14,7 +14,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
1414
pub(super)fnlex_token_trees(
1515
&mutself,
1616
is_delimited:bool,
17-
) -> (Spacing,TokenStream,Result<(),Vec<PErr<'psess>>>){
17+
) -> (Spacing,TokenStream,Result<(),Vec<Diag<'psess>>>){
1818
// Move past the opening delimiter.
1919
let open_spacing = self.bump_minimal();
2020

@@ -56,7 +56,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
5656
}
5757
}
5858

59-
fneof_err(&mutself) -> PErr<'psess>{
59+
fneof_err(&mutself) -> Diag<'psess>{
6060
let msg = "this file contains an unclosed delimiter";
6161
letmut err = self.dcx().struct_span_err(self.token.span, msg);
6262

@@ -98,7 +98,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
9898
fnlex_token_tree_open_delim(
9999
&mutself,
100100
open_delim:Delimiter,
101-
) -> Result<TokenTree,Vec<PErr<'psess>>>{
101+
) -> Result<TokenTree,Vec<Diag<'psess>>>{
102102
// The span for beginning of the delimited section.
103103
let pre_span = self.token.span;
104104

@@ -250,8 +250,8 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
250250
fnunclosed_delim_err(
251251
&mutself,
252252
tts:TokenStream,
253-
muterrs:Vec<PErr<'psess>>,
254-
) -> Vec<PErr<'psess>>{
253+
muterrs:Vec<Diag<'psess>>,
254+
) -> Vec<Diag<'psess>>{
255255
// If there are unclosed delims, see if there are diff markers and if so, point them
256256
// out instead of complaining about the unclosed delims.
257257
letmut parser = Parser::new(self.psess, tts,None);
@@ -308,7 +308,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> {
308308
errs
309309
}
310310

311-
fnclose_delim_err(&mutself,delim:Delimiter) -> PErr<'psess>{
311+
fnclose_delim_err(&mutself,delim:Delimiter) -> Diag<'psess>{
312312
// An unexpected closing delimiter (i.e., there is no matching opening delimiter).
313313
let token_str = token_to_string(&self.token);
314314
let msg = format!("unexpected closing delimiter: `{token_str}`");

‎compiler/rustc_parse/src/parser/diagnostics.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_ast_pretty::pprust;
1616
use rustc_data_structures::fx::FxHashSet;
1717
use rustc_data_structures::sync::Lrc;
1818
use rustc_errors::{
19-
Applicability,Diag,DiagCtxtHandle,ErrorGuaranteed,FatalError,PErr,PResult,Subdiagnostic,
19+
Applicability,Diag,DiagCtxtHandle,ErrorGuaranteed,FatalError,PResult,Subdiagnostic,
2020
Suggestions, pluralize,
2121
};
2222
use rustc_session::errors::ExprParenthesesNeeded;
@@ -2132,7 +2132,7 @@ impl<'a> Parser<'a> {
21322132
&mutself,
21332133
delim:Delimiter,
21342134
lo:Span,
2135-
err:PErr<'a>,
2135+
err:Diag<'a>,
21362136
) -> P<Expr>{
21372137
let guar = err.emit();
21382138
// Recover from parse error, callers expect the closing delim to be consumed.
@@ -3014,7 +3014,7 @@ impl<'a> Parser<'a> {
30143014
}
30153015

30163016
/// Check for exclusive ranges written as `..<`
3017-
pub(crate)fnmaybe_err_dotdotlt_syntax(&self,maybe_lt:Token,muterr:PErr<'a>) -> PErr<'a>{
3017+
pub(crate)fnmaybe_err_dotdotlt_syntax(&self,maybe_lt:Token,muterr:Diag<'a>) -> Diag<'a>{
30183018
if maybe_lt == token::Lt
30193019
&& (self.expected_tokens.contains(&TokenType::Token(token::Gt))
30203020
|| matches!(self.token.kind, token::Literal(..)))

0 commit comments

Comments
 (0)