1
Fork 0

Rename Handler as DiagCtxt.

This commit is contained in:
Nicholas Nethercote 2023-12-17 21:48:57 +11:00
parent 321b6565a5
commit cde19c016e
58 changed files with 216 additions and 204 deletions

View file

@ -1042,7 +1042,7 @@ impl<'a> IntoDiagnostic<'a> for ExpectedIdentifier {
#[track_caller]
fn into_diagnostic(
self,
handler: &'a rustc_errors::Handler,
handler: &'a rustc_errors::DiagCtxt,
) -> rustc_errors::DiagnosticBuilder<'a, ErrorGuaranteed> {
let token_descr = TokenDescription::from_token(&self.token);
@ -1099,7 +1099,7 @@ impl<'a> IntoDiagnostic<'a> for ExpectedSemi {
#[track_caller]
fn into_diagnostic(
self,
handler: &'a rustc_errors::Handler,
handler: &'a rustc_errors::DiagCtxt,
) -> rustc_errors::DiagnosticBuilder<'a, ErrorGuaranteed> {
let token_descr = TokenDescription::from_token(&self.token);

View file

@ -3,14 +3,14 @@
use std::iter::once;
use std::ops::Range;
use rustc_errors::{Applicability, Handler};
use rustc_errors::{Applicability, DiagCtxt};
use rustc_lexer::unescape::{EscapeError, Mode};
use rustc_span::{BytePos, Span};
use crate::errors::{MoreThanOneCharNote, MoreThanOneCharSugg, NoBraceUnicodeSub, UnescapeError};
pub(crate) fn emit_unescape_error(
handler: &Handler,
handler: &DiagCtxt,
// interior part of the literal, between quotes
lit: &str,
// full span of the literal, including quotes and any prefix

View file

@ -34,8 +34,8 @@ use rustc_ast::{
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{
pluralize, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, DiagnosticMessage,
ErrorGuaranteed, FatalError, Handler, IntoDiagnostic, MultiSpan, PResult,
pluralize, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
DiagnosticMessage, ErrorGuaranteed, FatalError, IntoDiagnostic, MultiSpan, PResult,
};
use rustc_session::errors::ExprParenthesesNeeded;
use rustc_span::source_map::Spanned;
@ -253,7 +253,7 @@ impl<'a> Parser<'a> {
self.diagnostic().span_bug(sp, msg)
}
pub(super) fn diagnostic(&self) -> &'a Handler {
pub(super) fn diagnostic(&self) -> &'a DiagCtxt {
&self.sess.span_diagnostic
}