rustc_errors: let DiagnosticBuilder::emit return a "guarantee of emission".
This commit is contained in:
@@ -102,7 +102,7 @@ pub trait InferCtxtExt<'tcx> {
|
||||
expected_args: Vec<ArgKind>,
|
||||
found_args: Vec<ArgKind>,
|
||||
is_closure: bool,
|
||||
) -> DiagnosticBuilder<'tcx>;
|
||||
) -> DiagnosticBuilder<'tcx, ErrorReported>;
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
@@ -1019,7 +1019,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
expected_args: Vec<ArgKind>,
|
||||
found_args: Vec<ArgKind>,
|
||||
is_closure: bool,
|
||||
) -> DiagnosticBuilder<'tcx> {
|
||||
) -> DiagnosticBuilder<'tcx, ErrorReported> {
|
||||
let kind = if is_closure { "closure" } else { "function" };
|
||||
|
||||
let args_str = |arguments: &[ArgKind], other: &[ArgKind]| {
|
||||
|
||||
@@ -10,7 +10,8 @@ use crate::traits::normalize_projection_type;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{
|
||||
error_code, pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, Style,
|
||||
error_code, pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder,
|
||||
ErrorReported, Style,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
@@ -122,7 +123,7 @@ pub trait InferCtxtExt<'tcx> {
|
||||
found_span: Option<Span>,
|
||||
expected_ref: ty::PolyTraitRef<'tcx>,
|
||||
found: ty::PolyTraitRef<'tcx>,
|
||||
) -> DiagnosticBuilder<'tcx>;
|
||||
) -> DiagnosticBuilder<'tcx, ErrorReported>;
|
||||
|
||||
fn suggest_fully_qualified_path(
|
||||
&self,
|
||||
@@ -1271,7 +1272,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
found_span: Option<Span>,
|
||||
expected_ref: ty::PolyTraitRef<'tcx>,
|
||||
found: ty::PolyTraitRef<'tcx>,
|
||||
) -> DiagnosticBuilder<'tcx> {
|
||||
) -> DiagnosticBuilder<'tcx, ErrorReported> {
|
||||
crate fn build_fn_sig_string<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
|
||||
@@ -450,7 +450,7 @@ fn report_conflicting_impls(
|
||||
sg.has_errored = true;
|
||||
if overlap.with_impl.is_local() || !tcx.orphan_check_crate(()).contains(&impl_def_id) {
|
||||
let err = struct_span_err!(tcx.sess, impl_span, E0119, "");
|
||||
decorate(LintDiagnosticBuilder::new(err));
|
||||
decorate(LintDiagnosticBuilder::new(err.forget_guarantee()));
|
||||
} else {
|
||||
tcx.sess.delay_span_bug(impl_span, "impl should have failed the orphan check");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user