Auto merge of #120576 - nnethercote:merge-Diagnostic-DiagnosticBuilder, r=davidtwco

Overhaul `Diagnostic` and `DiagnosticBuilder`

Implements the first part of https://github.com/rust-lang/compiler-team/issues/722, which moves functionality and use away from `Diagnostic`, onto `DiagnosticBuilder`.

Likely follow-ups:
- Move things around, because this PR was written to minimize diff size, so some things end up in sub-optimal places. E.g. `DiagnosticBuilder` has impls in both `diagnostic.rs` and `diagnostic_builder.rs`.
- Rename `Diagnostic` as `DiagInner` and `DiagnosticBuilder` as `Diag`.

r? `@davidtwco`
This commit is contained in:
bors
2024-02-20 12:05:09 +00:00
104 changed files with 1038 additions and 849 deletions

View File

@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
use super::NormalizeExt;
use super::{ObligationCause, PredicateObligation, SelectionContext};
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::Diagnostic;
use rustc_errors::DiagnosticBuilder;
use rustc_hir::def_id::DefId;
use rustc_infer::infer::{InferCtxt, InferOk};
use rustc_middle::ty::GenericArgsRef;
@@ -46,7 +46,7 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> {
/// trait aliases.
pub fn label_with_exp_info(
&self,
diag: &mut Diagnostic,
diag: &mut DiagnosticBuilder<'_>,
top_label: &'static str,
use_desc: &str,
) {