1
Fork 0

Fix bad span for explicit lifetime suggestion

Move verbose logic to a function

Minor renaming
This commit is contained in:
Shoyu Vanilla 2024-02-25 21:46:11 +09:00
parent 1388d7a069
commit c270a42fea
11 changed files with 167 additions and 83 deletions

View file

@ -24,7 +24,7 @@ use rustc_errors::{
use rustc_hir as hir;
use rustc_hir::def::{self, CtorKind, CtorOf, DefKind};
use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
use rustc_hir::PrimTy;
use rustc_hir::{MissingLifetimeKind, PrimTy};
use rustc_session::lint;
use rustc_session::Session;
use rustc_span::edit_distance::find_best_match_for_name;
@ -109,18 +109,6 @@ pub(super) struct MissingLifetime {
pub count: usize,
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub(super) enum MissingLifetimeKind {
/// An explicit `'_`.
Underscore,
/// An elided lifetime `&' ty`.
Ampersand,
/// An elided lifetime in brackets with written brackets.
Comma,
/// An elided lifetime with elided brackets.
Brackets,
}
/// Description of the lifetimes appearing in a function parameter.
/// This is used to provide a literal explanation to the elision failure.
#[derive(Clone, Debug)]