Replace item names containing an error code with something more meaningful
or inline such functions if useless.
This commit is contained in:
parent
dec1d16a9b
commit
2a1d748254
19 changed files with 55 additions and 50 deletions
|
@ -10,9 +10,7 @@ use rustc_arena::{DroplessArena, TypedArena};
|
|||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{
|
||||
codes::*, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan,
|
||||
};
|
||||
use rustc_errors::{codes::*, struct_span_code_err, Applicability, ErrorGuaranteed, MultiSpan};
|
||||
use rustc_hir::def::*;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::{self as hir, BindingMode, ByRef, HirId};
|
||||
|
@ -24,7 +22,6 @@ use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
|
|||
use rustc_session::lint::builtin::{
|
||||
BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS,
|
||||
};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::{sym, Span};
|
||||
|
||||
|
@ -64,10 +61,6 @@ pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), Err
|
|||
visitor.error
|
||||
}
|
||||
|
||||
fn create_e0004(sess: &Session, sp: Span, error_message: String) -> Diag<'_> {
|
||||
struct_span_code_err!(sess.dcx(), sp, E0004, "{}", &error_message)
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
enum RefutableFlag {
|
||||
Irrefutable,
|
||||
|
@ -975,10 +968,11 @@ fn report_non_exhaustive_match<'p, 'tcx>(
|
|||
|
||||
// FIXME: migration of this diagnostic will require list support
|
||||
let joined_patterns = joined_uncovered_patterns(cx, &witnesses);
|
||||
let mut err = create_e0004(
|
||||
cx.tcx.sess,
|
||||
let mut err = struct_span_code_err!(
|
||||
cx.tcx.dcx(),
|
||||
sp,
|
||||
format!("non-exhaustive patterns: {joined_patterns} not covered"),
|
||||
E0004,
|
||||
"non-exhaustive patterns: {joined_patterns} not covered"
|
||||
);
|
||||
err.span_label(
|
||||
sp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue