Use identifiers in diagnostics more often
This commit is contained in:
parent
f85c6de552
commit
ac1c6c50f4
21 changed files with 83 additions and 72 deletions
|
@ -7,7 +7,7 @@ use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
|||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_pattern_analysis::errors::Uncovered;
|
||||
use rustc_pattern_analysis::rustc::RustcPatCtxt;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_span::{Ident, Span, Symbol};
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
|
@ -753,7 +753,7 @@ pub(crate) struct BindingsWithVariantName {
|
|||
#[suggestion(code = "{ty_path}::{name}", applicability = "machine-applicable")]
|
||||
pub(crate) suggestion: Option<Span>,
|
||||
pub(crate) ty_path: String,
|
||||
pub(crate) name: Symbol,
|
||||
pub(crate) name: Ident,
|
||||
}
|
||||
|
||||
#[derive(LintDiagnostic)]
|
||||
|
@ -797,7 +797,7 @@ pub(crate) struct BorrowOfMovedValue {
|
|||
pub(crate) binding_span: Span,
|
||||
#[label(mir_build_value_borrowed_label)]
|
||||
pub(crate) conflicts_ref: Vec<Span>,
|
||||
pub(crate) name: Symbol,
|
||||
pub(crate) name: Ident,
|
||||
pub(crate) ty: String,
|
||||
#[suggestion(code = "ref ", applicability = "machine-applicable")]
|
||||
pub(crate) suggest_borrowing: Option<Span>,
|
||||
|
|
|
@ -25,7 +25,7 @@ use rustc_session::lint::builtin::{
|
|||
};
|
||||
use rustc_span::edit_distance::find_best_match_for_name;
|
||||
use rustc_span::hygiene::DesugaringKind;
|
||||
use rustc_span::{Span, sym};
|
||||
use rustc_span::{Ident, Span, sym};
|
||||
use rustc_trait_selection::infer::InferCtxtExt;
|
||||
use tracing::instrument;
|
||||
|
||||
|
@ -800,7 +800,7 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, 'tcx>, pat:
|
|||
sess.dcx().emit_err(BorrowOfMovedValue {
|
||||
binding_span: pat.span,
|
||||
conflicts_ref,
|
||||
name,
|
||||
name: Ident::new(name, pat.span),
|
||||
ty,
|
||||
suggest_borrowing: Some(pat.span.shrink_to_lo()),
|
||||
has_path: path.is_some(),
|
||||
|
@ -908,7 +908,7 @@ fn check_for_bindings_named_same_as_variants(
|
|||
None
|
||||
},
|
||||
ty_path,
|
||||
name,
|
||||
name: Ident::new(name, pat.span),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue