lint: LintDiagnosticBuilder into rustc_errors
Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
@@ -2,10 +2,7 @@ use std::cmp;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_errors::{
|
||||
Diagnostic, DiagnosticBuilder, DiagnosticId, DiagnosticMessage, EmissionGuarantee,
|
||||
ErrorGuaranteed, MultiSpan,
|
||||
};
|
||||
use rustc_errors::{Diagnostic, DiagnosticId, LintDiagnosticBuilder, MultiSpan};
|
||||
use rustc_hir::HirId;
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_query_system::ich::StableHashingContext;
|
||||
@@ -228,28 +225,6 @@ impl LintExpectation {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LintDiagnosticBuilder<'a, G: EmissionGuarantee>(DiagnosticBuilder<'a, G>);
|
||||
|
||||
impl<'a, G: EmissionGuarantee> LintDiagnosticBuilder<'a, G> {
|
||||
/// Return the inner `DiagnosticBuilder`, first setting the primary message to `msg`.
|
||||
pub fn build(mut self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'a, G> {
|
||||
self.0.set_primary_message(msg);
|
||||
self.0.set_is_lint();
|
||||
self.0
|
||||
}
|
||||
|
||||
/// Create a `LintDiagnosticBuilder` from some existing `DiagnosticBuilder`.
|
||||
pub fn new(err: DiagnosticBuilder<'a, G>) -> LintDiagnosticBuilder<'a, G> {
|
||||
LintDiagnosticBuilder(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> LintDiagnosticBuilder<'a, ErrorGuaranteed> {
|
||||
pub fn forget_guarantee(self) -> LintDiagnosticBuilder<'a, ()> {
|
||||
LintDiagnosticBuilder(self.0.forget_guarantee())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn explain_lint_level_source(
|
||||
lint: &'static Lint,
|
||||
level: Level,
|
||||
|
||||
Reference in New Issue
Block a user