1
Fork 0

Use a dedicated type instead of a reference for the diagnostic context

This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
This commit is contained in:
Oli Scherer 2024-06-18 10:35:56 +00:00
parent c91edc3888
commit 7ba82d61eb
77 changed files with 363 additions and 328 deletions

View file

@ -12,6 +12,7 @@ use rustc_ast::visit::{walk_list, AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor}
use rustc_ast::*;
use rustc_ast_pretty::pprust::{self, State};
use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::DiagCtxtHandle;
use rustc_feature::Features;
use rustc_parse::validate_attr;
use rustc_session::lint::builtin::{
@ -269,7 +270,7 @@ impl<'a> AstValidator<'a> {
}
}
fn dcx(&self) -> &rustc_errors::DiagCtxt {
fn dcx(&self) -> DiagCtxtHandle<'a> {
self.session.dcx()
}
@ -809,11 +810,7 @@ impl<'a> AstValidator<'a> {
/// Checks that generic parameters are in the correct order,
/// which is lifetimes, then types and then consts. (`<'a, T, const N: usize>`)
fn validate_generic_param_order(
dcx: &rustc_errors::DiagCtxt,
generics: &[GenericParam],
span: Span,
) {
fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericParam], span: Span) {
let mut max_param: Option<ParamKindOrd> = None;
let mut out_of_order = FxIndexMap::default();
let mut param_idents = Vec::with_capacity(generics.len());