Give DiagnosticBuilder
a default type.
`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
This commit is contained in:
parent
6257f3bf1f
commit
757d6f6ef8
59 changed files with 250 additions and 454 deletions
|
@ -4,7 +4,7 @@ use crate::query::plumbing::CycleError;
|
|||
use crate::query::DepKind;
|
||||
use crate::query::{QueryContext, QueryStackFrame};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{DiagCtxt, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, Level};
|
||||
use rustc_errors::{DiagCtxt, Diagnostic, DiagnosticBuilder, Level};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
|
@ -559,7 +559,7 @@ pub fn deadlock(query_map: QueryMap, registry: &rayon_core::Registry) {
|
|||
pub(crate) fn report_cycle<'a>(
|
||||
sess: &'a Session,
|
||||
CycleError { usage, cycle: stack }: &CycleError,
|
||||
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
|
||||
) -> DiagnosticBuilder<'a> {
|
||||
assert!(!stack.is_empty());
|
||||
|
||||
let span = stack[0].query.default_span(stack[1 % stack.len()].span);
|
||||
|
|
|
@ -19,7 +19,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
|
|||
use rustc_data_structures::sync::Lock;
|
||||
#[cfg(parallel_compiler)]
|
||||
use rustc_data_structures::{outline, sync};
|
||||
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError, StashKey};
|
||||
use rustc_errors::{DiagnosticBuilder, FatalError, StashKey};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use std::cell::Cell;
|
||||
use std::collections::hash_map::Entry;
|
||||
|
@ -112,7 +112,7 @@ fn handle_cycle_error<Q, Qcx>(
|
|||
query: Q,
|
||||
qcx: Qcx,
|
||||
cycle_error: &CycleError,
|
||||
mut error: DiagnosticBuilder<'_, ErrorGuaranteed>,
|
||||
mut error: DiagnosticBuilder<'_>,
|
||||
) -> Q::Value
|
||||
where
|
||||
Q: QueryConfig<Qcx>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue