Merge Implicit and ImplicitMissing.

This commit is contained in:
Camille GILLOT 2021-11-26 23:07:21 +01:00
parent 72dc29c260
commit aa2450f41b
6 changed files with 19 additions and 36 deletions

View file

@ -92,10 +92,9 @@ pub enum LifetimeName {
Param(ParamName),
/// User wrote nothing (e.g., the lifetime in `&u32`).
Implicit,
/// User wrote nothing, but should have provided something.
ImplicitMissing,
///
/// The bool indicates whether the user should have written something.
Implicit(bool),
/// Implicit lifetime in a context like `dyn Foo`. This is
/// distinguished from implicit lifetimes elsewhere because the
@ -125,8 +124,7 @@ impl LifetimeName {
pub fn ident(&self) -> Ident {
match *self {
LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Implicit
| LifetimeName::ImplicitMissing
| LifetimeName::Implicit(_)
| LifetimeName::Error => Ident::empty(),
LifetimeName::Underscore => Ident::with_dummy_span(kw::UnderscoreLifetime),
LifetimeName::Static => Ident::with_dummy_span(kw::StaticLifetime),
@ -137,8 +135,7 @@ impl LifetimeName {
pub fn is_elided(&self) -> bool {
match self {
LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Implicit
| LifetimeName::ImplicitMissing
| LifetimeName::Implicit(_)
| LifetimeName::Underscore => true,
// It might seem surprising that `Fresh(_)` counts as
@ -3303,7 +3300,7 @@ mod size_asserts {
rustc_data_structures::static_assert_size!(super::Expr<'static>, 64);
rustc_data_structures::static_assert_size!(super::Pat<'static>, 88);
rustc_data_structures::static_assert_size!(super::QPath<'static>, 24);
rustc_data_structures::static_assert_size!(super::Ty<'static>, 72);
rustc_data_structures::static_assert_size!(super::Ty<'static>, 80);
rustc_data_structures::static_assert_size!(super::Item<'static>, 184);
rustc_data_structures::static_assert_size!(super::TraitItem<'static>, 128);

View file

@ -545,8 +545,7 @@ pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime
| LifetimeName::Param(ParamName::Error)
| LifetimeName::Static
| LifetimeName::Error
| LifetimeName::Implicit
| LifetimeName::ImplicitMissing
| LifetimeName::Implicit(_)
| LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Underscore => {}
}