Repository: rust-analyzer/rust-analyzer
Pull request #6968 (2020-12-20 22:30:53)

Update syn and quote


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 1051c4ec63..fbb79e01fc 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1251,9 +1251,9 @@ dependencies = [
 
 [[package]]
 name = "quote"
-version = "1.0.7"
+version = "1.0.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
+checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
 dependencies = [
  "proc-macro2",
 ]
@@ -1588,9 +1588,9 @@ version = "0.0.0"
 
 [[package]]
 name = "syn"
-version = "1.0.54"
+version = "1.0.55"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44"
+checksum = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a"
 dependencies = [
  "proc-macro2",
  "quote",
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
index 030b9cd0c7..2e56bd7ffc 100644
--- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -1,7 +1,7 @@
 use std::iter;
 
 use either::Either;
-use hir::{AsName, Module, ModuleDef, Name, Variant};
+use hir::{AsName, EnumVariant, Module, ModuleDef, Name};
 use ide_db::helpers::{
     insert_use::{insert_use, ImportScope},
     mod_path_to_ast,
@@ -53,7 +53,7 @@ pub(crate) fn extract_struct_from_enum_variant(
             let variant_hir_name = variant_hir.name(ctx.db());
             let enum_module_def = ModuleDef::from(enum_hir);
             let usages =
-                Definition::ModuleDef(ModuleDef::Variant(variant_hir)).usages(&ctx.sema).all();
+                Definition::ModuleDef(ModuleDef::EnumVariant(variant_hir)).usages(&ctx.sema).all();
 
             let mut visited_modules_set = FxHashSet::default();
             let current_module = enum_hir.module(ctx.db());
@@ -109,7 +109,7 @@ fn extract_field_list_if_applicable(
     }
 }
 
-fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Variant) -> bool {
+fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &EnumVariant) -> bool {
     variant
         .parent_enum(db)
         .module(db)
@@ -119,7 +119,7 @@ fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Va
             // only check type-namespace
             hir::ScopeDef::ModuleDef(def) => matches!(def,
                 ModuleDef::Module(_) | ModuleDef::Adt(_) |
-                ModuleDef::Variant(_) | ModuleDef::Trait(_) |
+                ModuleDef::EnumVariant(_) | ModuleDef::Trait(_) |
                 ModuleDef::TypeAlias(_) | ModuleDef::BuiltinType(_)
             ),
             _ => false,
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs
index cb60a31282..ef12ef0cf1 100644
--- a/crates/assists/src/handlers/fill_match_arms.rs
+++ b/crates/assists/src/handlers/fill_match_arms.rs
@@ -192,7 +192,7 @@ fn resolve_tuple_of_enum_def(
         .collect()
 }
 
-fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::Variant) -> Option<ast::Pat> {
+fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::EnumVariant) -> Option<ast::Pat> {
     let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?);
 
     // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though
diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs
index 8558a8ff01..c867207877 100644
--- a/crates/assists/src/handlers/fix_visibility.rs
+++ b/crates/assists/src/handlers/fix_visibility.rs
@@ -201,7 +201,7 @@ fn target_data_for_def(
             (vis_offset(syntax), in_file_source.value.visibility(), syntax.text_range(), file_id)
         }
         // Enum variants can't be private, we can't modify builtin types
-        hir::ModuleDef::Variant(_) | hir::ModuleDef::BuiltinType(_) => return None,
+        hir::ModuleDef::EnumVariant(_) | hir::ModuleDef::BuiltinType(_) => return None,
     };
 
     Some((offset, current_visibility, target, target_file, target_name))
diff --git a/crates/completion/src/completions.rs b/crates/completion/src/completions.rs
index 1ef6b5f48f..9b7d6c5809 100644
--- a/crates/completion/src/completions.rs
+++ b/crates/completion/src/completions.rs
@@ -19,7 +19,7 @@ use hir::{ModPath, ScopeDef, Type};
 use crate::{
     item::Builder,
     render::{
-        const_::render_const, enum_variant::render_variant, function::render_fn,
+        const_::render_const, enum_variant::render_enum_variant, function::render_fn,
         macro_::render_macro, render_field, render_resolution, render_tuple_field,
         type_alias::render_type_alias, RenderContext,
     },
@@ -120,20 +120,20 @@ impl Completions {
     pub(crate) fn add_qualified_enum_variant(
         &mut self,
         ctx: &CompletionContext,
-        variant: hir::Variant,
+        variant: hir::EnumVariant,
         path: ModPath,
     ) {
-        let item = render_variant(RenderContext::new(ctx), None, None, variant, Some(path));
+        let item = render_enum_variant(RenderContext::new(ctx), None, None, variant, Some(path));
         self.add(item);
     }
 
     pub(crate) fn add_enum_variant(
         &mut self,
         ctx: &CompletionContext,
-        variant: hir::Variant,
+        variant: hir::EnumVariant,
         local_name: Option<String>,
     ) {
-        let item = render_variant(RenderContext::new(ctx), None, local_name, variant, None);
+        let item = render_enum_variant(RenderContext::new(ctx), None, local_name, variant, None);
         self.add(item);
     }
 }
diff --git a/crates/completion/src/completions/pattern.rs b/crates/completion/src/completions/pattern.rs
index 4d56731ec6..0c98e4412e 100644
--- a/crates/completion/src/completions/pattern.rs
+++ b/crates/completion/src/completions/pattern.rs
@@ -23,7 +23,7 @@ pub(crate) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) {
                         def,
                         hir::ModuleDef::Adt(hir::Adt::Enum(..))
                             | hir::ModuleDef::Adt(hir::Adt::Struct(..))
-                            | hir::ModuleDef::Variant(..)
+                            | hir::ModuleDef::EnumVariant(..)
                             | hir::ModuleDef::Const(..)
                             | hir::ModuleDef::Module(..)
                     )
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs
index 1092a48256..b940388df2 100644
--- a/crates/completion/src/render.rs
+++ b/crates/completion/src/render.rs
@@ -19,7 +19,7 @@ use crate::{
     CompletionKind, CompletionScore,
 };
 
-use crate::render::{enum_variant::render_variant, function::render_fn, macro_::render_macro};
+use crate::render::{enum_variant::render_enum_variant, function::render_fn, macro_::render_macro};
 
 pub(crate) fn render_field<'a>(
     ctx: RenderContext<'a>,
@@ -159,8 +159,9 @@ impl<'a> Render<'a> {
                 let item = render_fn(self.ctx, import_to_add, Some(local_name), *func);
                 return Some(item);
             }
-            ScopeDef::ModuleDef(Variant(var)) => {
-                let item = render_variant(self.ctx, import_to_add, Some(local_name), *var, None);
+            ScopeDef::ModuleDef(EnumVariant(var)) => {
+                let item =
+                    render_enum_variant(self.ctx, import_to_add, Some(local_name), *var, None);
                 return Some(item);
             }
             ScopeDef::MacroDef(mac) => {
@@ -256,7 +257,7 @@ impl<'a> Render<'a> {
         match resolution {
             ScopeDef::ModuleDef(Module(it)) => it.docs(self.ctx.db()),
             ScopeDef::ModuleDef(Adt(it)) => it.docs(self.ctx.db()),
-            ScopeDef::ModuleDef(Variant(it)) => it.docs(self.ctx.db()),
+            ScopeDef::ModuleDef(EnumVariant(it)) => it.docs(self.ctx.db()),
             ScopeDef::ModuleDef(Const(it)) => it.docs(self.ctx.db()),
             ScopeDef::ModuleDef(Static(it)) => it.docs(self.ctx.db()),
             ScopeDef::ModuleDef(Trait(it)) => it.docs(self.ctx.db()),
diff --git a/crates/completion/src/render/enum_variant.rs b/crates/completion/src/render/enum_variant.rs
index 7176fd9b3d..8e0fea6c0f 100644
--- a/crates/completion/src/render/enum_variant.rs
+++ b/crates/completion/src/render/enum_variant.rs
@@ -9,35 +9,35 @@ use crate::{
     render::{builder_ext::Params, RenderContext},
 };
 
-pub(crate) fn render_variant<'a>(
+pub(crate) fn render_enum_variant<'a>(
     ctx: RenderContext<'a>,
     import_to_add: Option<ImportEdit>,
     local_name: Option<String>,
-    variant: hir::Variant,
+    variant: hir::EnumVariant,
     path: Option<ModPath>,
 ) -> CompletionItem {
     let _p = profile::span("render_enum_variant");
-    EnumRender::new(ctx, local_name, variant, path).render(import_to_add)
+    EnumVariantRender::new(ctx, local_name, variant, path).render(import_to_add)
 }
 
 #[derive(Debug)]
-struct EnumRender<'a> {
+struct EnumVariantRender<'a> {
     ctx: RenderContext<'a>,
     name: String,
-    variant: hir::Variant,
+    variant: hir::EnumVariant,
     path: Option<ModPath>,
     qualified_name: String,
     short_qualified_name: String,
     variant_kind: StructKind,
 }
 
-impl<'a> EnumRender<'a> {
+impl<'a> EnumVariantRender<'a> {
     fn new(
         ctx: RenderContext<'a>,
         local_name: Option<String>,
-        variant: hir::Variant,
+        variant: hir::EnumVariant,
         path: Option<ModPath>,
-    ) -> EnumRender<'a> {
+    ) -> EnumVariantRender<'a> {
         let name = local_name.unwrap_or_else(|| variant.name(ctx.db()).to_string());
         let variant_kind = variant.kind(ctx.db());
 
@@ -51,7 +51,15 @@ impl<'a> EnumRender<'a> {
             None => (name.to_string(), name.to_string()),
         };
 
-        EnumRender { ctx, name, variant, path, qualified_name, short_qualified_name, variant_kind }
+        EnumVariantRender {
+            ctx,
+            name,
+            variant,
+            path,
+            qualified_name,
+            short_qualified_name,
+            variant_kind,
+        }
     }
 
     fn render(self, import_to_add: Option<ImportEdit>) -> CompletionItem {
diff --git a/crates/hir/src/attrs.rs b/crates/hir/src/attrs.rs
index d32ce37edb..1f2ee25800 100644
--- a/crates/hir/src/attrs.rs
+++ b/crates/hir/src/attrs.rs
@@ -10,8 +10,8 @@ use hir_ty::db::HirDatabase;
 use syntax::ast;
 
 use crate::{
-    Adt, Const, Enum, Field, Function, MacroDef, Module, ModuleDef, Static, Struct, Trait,
-    TypeAlias, Union, Variant,
+    Adt, Const, Enum, EnumVariant, Field, Function, MacroDef, Module, ModuleDef, Static, Struct,
+    Trait, TypeAlias, Union,
 };
 
 pub trait HasAttrs {
@@ -53,7 +53,7 @@ macro_rules! impl_has_attrs {
 
 impl_has_attrs![
     (Field, FieldId),
-    (Variant, EnumVariantId),
+    (EnumVariant, EnumVariantId),
     (Static, StaticId),
     (Const, ConstId),
     (Trait, TraitId),
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 73ca6ba9f4..3248f6d201 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -161,7 +161,7 @@ pub enum ModuleDef {
     Function(Function),
     Adt(Adt),
     // Can't be directly declared, but can be imported.
-    Variant(Variant),
+    EnumVariant(EnumVariant),
     Const(Const),
     Static(Static),
     Trait(Trait),
@@ -172,7 +172,7 @@ impl_from!(
     Module,
     Function,
     Adt(Struct, Enum, Union),
-    Variant,
+    EnumVariant,
     Const,
     Static,
     Trait,
@@ -186,7 +186,7 @@ impl From<VariantDef> for ModuleDef {
         match var {
             VariantDef::Struct(t) => Adt::from(t).into(),
             VariantDef::Union(t) => Adt::from(t).into(),
-            VariantDef::Variant(t) => t.into(),
+            VariantDef::EnumVariant(t) => t.into(),
         }
     }
 }
@@ -197,7 +197,7 @@ impl ModuleDef {
             ModuleDef::Module(it) => it.parent(db),
             ModuleDef::Function(it) => Some(it.module(db)),
             ModuleDef::Adt(it) => Some(it.module(db)),
-            ModuleDef::Variant(it) => Some(it.module(db)),
+            ModuleDef::EnumVariant(it) => Some(it.module(db)),
             ModuleDef::Const(it) => Some(it.module(db)),
             ModuleDef::Static(it) => Some(it.module(db)),
             ModuleDef::Trait(it) => Some(it.module(db)),
@@ -221,7 +221,7 @@ impl ModuleDef {
             ModuleDef::Module(it) => it.parent(db)?,
             ModuleDef::Function(it) => return Some(it.visibility(db)),
             ModuleDef::Adt(it) => it.module(db),
-            ModuleDef::Variant(it) => {
+            ModuleDef::EnumVariant(it) => {
                 let parent = it.parent_enum(db);
                 let module = it.module(db);
                 return module.visibility_of(db, &ModuleDef::Adt(Adt::Enum(parent)));
@@ -241,7 +241,7 @@ impl ModuleDef {
             ModuleDef::Adt(it) => Some(it.name(db)),
             ModuleDef::Trait(it) => Some(it.name(db)),
             ModuleDef::Function(it) => Some(it.name(db)),
-            ModuleDef::Variant(it) => Some(it.name(db)),
+            ModuleDef::EnumVariant(it) => Some(it.name(db)),
             ModuleDef::TypeAlias(it) => Some(it.name(db)),
             ModuleDef::Module(it) => it.name(db),
             ModuleDef::Const(it) => it.name(db),
@@ -455,7 +455,7 @@ impl Field {
         let generic_def_id: GenericDefId = match self.parent {
             VariantDef::Struct(it) => it.id.into(),
             VariantDef::Union(it) => it.id.into(),
-            VariantDef::Variant(it) => it.parent.id.into(),
+            VariantDef::EnumVariant(it) => it.parent.id.into(),
         };
         let substs = Substs::type_params(db, generic_def_id);
         let ty = db.field_types(var_id)[self.id].clone().subst(&substs);
@@ -566,8 +566,12 @@ impl Enum {
         db.enum_data(self.id).name.clone()
     }
 
-    pub fn variants(self, db: &dyn HirDatabase) -> Vec<Variant> {
-        db.enum_data(self.id).variants.iter().map(|(id, _)| Variant { parent: self, id }).collect()
+    pub fn variants(self, db: &dyn HirDatabase) -> Vec<EnumVariant> {
+        db.enum_data(self.id)
+            .variants
+            .iter()
+            .map(|(id, _)| EnumVariant { parent: self, id })
+            .collect()
     }
 
     pub fn ty(self, db: &dyn HirDatabase) -> Type {
@@ -576,12 +580,12 @@ impl Enum {
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub struct Variant {
+pub struct EnumVariant {
     pub(crate) parent: Enum,
     pub(crate) id: LocalEnumVariantId,
 }
 
-impl Variant {
+impl EnumVariant {
     pub fn module(self, db: &dyn HirDatabase) -> Module {
         self.parent.module(db)
     }
@@ -658,16 +662,16 @@ impl Adt {
 pub enum VariantDef {
     Struct(Struct),
     Union(Union),
-    Variant(Variant),
+    EnumVariant(EnumVariant),
 }
-impl_from!(Struct, Union, Variant for VariantDef);
+impl_from!(Struct, Union, EnumVariant for VariantDef);
 
 impl VariantDef {
     pub fn fields(self, db: &dyn HirDatabase) -> Vec<Field> {
         match self {
             VariantDef::Struct(it) => it.fields(db),
             VariantDef::Union(it) => it.fields(db),
-            VariantDef::Variant(it) => it.fields(db),
+            VariantDef::EnumVariant(it) => it.fields(db),
         }
     }
 
@@ -675,7 +679,7 @@ impl VariantDef {
         match self {
             VariantDef::Struct(it) => it.module(db),
             VariantDef::Union(it) => it.module(db),
-            VariantDef::Variant(it) => it.module(db),
+            VariantDef::EnumVariant(it) => it.module(db),
         }
     }
 
@@ -683,7 +687,7 @@ impl VariantDef {
         match self {
             VariantDef::Struct(s) => s.name(db),
             VariantDef::Union(u) => u.name(db),
-            VariantDef::Variant(e) => e.name(db),
+            VariantDef::EnumVariant(e) => e.name(db),
         }
     }
 
@@ -691,7 +695,7 @@ impl VariantDef {
         match self {
             VariantDef::Struct(it) => it.variant_data(db),
             VariantDef::Union(it) => it.variant_data(db),
-            VariantDef::Variant(it) => it.variant_data(db),
+            VariantDef::EnumVariant(it) => it.variant_data(db),
         }
     }
 }
@@ -1091,7 +1095,7 @@ pub enum GenericDef {
     Impl(Impl),
     // enum variants cannot have generics themselves, but their parent enums
     // can, and this makes some code easier to write
-    Variant(Variant),
+    EnumVariant(EnumVariant),
     // consts can have type parameters from their parents (i.e. associated consts of traits)
     Const(Const),
 }
@@ -1101,7 +1105,7 @@ impl_from!(
     Trait,
     TypeAlias,
     Impl,
-    Variant,
+    EnumVariant,
     Const
     for GenericDef
 );
@@ -1268,6 +1272,7 @@ impl LifetimeParam {
     }
 }
 
+// FIXME: rename from `ImplDef` to `Impl`
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub struct Impl {
     pub(crate) id: ImplId,
@@ -1842,7 +1847,7 @@ pub struct Callable {
 pub enum CallableKind {
     Function(Function),
     TupleStruct(Struct),
-    TupleEnumVariant(Variant),
+    TupleEnumVariant(EnumVariant),
     Closure,
 }
 
diff --git a/crates/hir/src/from_id.rs b/crates/hir/src/from_id.rs
index 8e0c571b85..8d0f84508d 100644
--- a/crates/hir/src/from_id.rs
+++ b/crates/hir/src/from_id.rs
@@ -9,7 +9,8 @@ use hir_def::{
 };
 
 use crate::{
-    Adt, AssocItem, DefWithBody, Field, GenericDef, Local, MacroDef, ModuleDef, Variant, VariantDef,
+    Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local, MacroDef, ModuleDef,
+    VariantDef,
 };
 
 macro_rules! from_id {
@@ -64,14 +65,14 @@ impl From<Adt> for AdtId {
     }
 }
 
-impl From<EnumVariantId> for Variant {
+impl From<EnumVariantId> for EnumVariant {
     fn from(id: EnumVariantId) -> Self {
-        Variant { parent: id.parent.into(), id: id.local_id }
+        EnumVariant { parent: id.parent.into(), id: id.local_id }
     }
 }
 
-impl From<Variant> for EnumVariantId {
-    fn from(def: Variant) -> Self {
+impl From<EnumVariant> for EnumVariantId {
+    fn from(def: EnumVariant) -> Self {
         EnumVariantId { parent: def.parent.id, local_id: def.id }
     }
 }
@@ -82,7 +83,7 @@ impl From<ModuleDefId> for ModuleDef {
             ModuleDefId::ModuleId(it) => ModuleDef::Module(it.into()),
             ModuleDefId::FunctionId(it) => ModuleDef::Function(it.into()),
             ModuleDefId::AdtId(it) => ModuleDef::Adt(it.into()),
-            ModuleDefId::EnumVariantId(it) => ModuleDef::Variant(it.into()),
+            ModuleDefId::EnumVariantId(it) => ModuleDef::EnumVariant(it.into()),
             ModuleDefId::ConstId(it) => ModuleDef::Const(it.into()),
             ModuleDefId::StaticId(it) => ModuleDef::Static(it.into()),
             ModuleDefId::TraitId(it) => ModuleDef::Trait(it.into()),
@@ -98,7 +99,7 @@ impl From<ModuleDef> for ModuleDefId {
             ModuleDef::Module(it) => ModuleDefId::ModuleId(it.into()),
             ModuleDef::Function(it) => ModuleDefId::FunctionId(it.into()),
             ModuleDef::Adt(it) => ModuleDefId::AdtId(it.into()),
-            ModuleDef::Variant(it) => ModuleDefId::EnumVariantId(it.into()),
+            ModuleDef::EnumVariant(it) => ModuleDefId::EnumVariantId(it.into()),
             ModuleDef::Const(it) => ModuleDefId::ConstId(it.into()),
             ModuleDef::Static(it) => ModuleDefId::StaticId(it.into()),
             ModuleDef::Trait(it) => ModuleDefId::TraitId(it.into()),
@@ -146,7 +147,7 @@ impl From<GenericDef> for GenericDefId {
             GenericDef::Trait(it) => GenericDefId::TraitId(it.id),
             GenericDef::TypeAlias(it) => GenericDefId::TypeAliasId(it.id),
             GenericDef::Impl(it) => GenericDefId::ImplId(it.id),
-            GenericDef::Variant(it) => {
+            GenericDef::EnumVariant(it) => {
                 GenericDefId::EnumVariantId(EnumVariantId { parent: it.parent.id, local_id: it.id })
             }
             GenericDef::Const(it) => GenericDefId::ConstId(it.id),
@@ -163,7 +164,7 @@ impl From<GenericDefId> for GenericDef {
             GenericDefId::TypeAliasId(it) => GenericDef::TypeAlias(it.into()),
             GenericDefId::ImplId(it) => GenericDef::Impl(it.into()),
             GenericDefId::EnumVariantId(it) => {
-                GenericDef::Variant(Variant { parent: it.parent.into(), id: it.local_id })
+                GenericDef::EnumVariant(EnumVariant { parent: it.parent.into(), id: it.local_id })
             }
             GenericDefId::ConstId(it) => GenericDef::Const(it.into()),
         }
@@ -184,7 +185,7 @@ impl From<VariantId> for VariantDef {
     fn from(def: VariantId) -> Self {
         match def {
             VariantId::StructId(it) => VariantDef::Struct(it.into()),
-            VariantId::EnumVariantId(it) => VariantDef::Variant(it.into()),
+            VariantId::EnumVariantId(it) => VariantDef::EnumVariant(it.into()),
             VariantId::UnionId(it) => VariantDef::Union(it.into()),
         }
     }
@@ -194,7 +195,7 @@ impl From<VariantDef> for VariantId {
     fn from(def: VariantDef) -> Self {
         match def {
             VariantDef::Struct(it) => VariantId::StructId(it.id),
-            VariantDef::Variant(it) => VariantId::EnumVariantId(it.into()),
+            VariantDef::EnumVariant(it) => VariantId::EnumVariantId(it.into()),
             VariantDef::Union(it) => VariantId::UnionId(it.id),
         }
     }
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 0dc07c33e2..c5b81b2524 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -10,8 +10,8 @@ use hir_expand::InFile;
 use syntax::ast;
 
 use crate::{
-    db::HirDatabase, Const, Enum, Field, FieldSource, Function, Impl, LifetimeParam, MacroDef,
-    Module, Static, Struct, Trait, TypeAlias, TypeParam, Union, Variant,
+    db::HirDatabase, Const, Enum, EnumVariant, Field, FieldSource, Function, Impl, LifetimeParam,
+    MacroDef, Module, Static, Struct, Trait, TypeAlias, TypeParam, Union,
 };
 
 pub trait HasSource {
@@ -73,7 +73,7 @@ impl HasSource for Enum {
         self.id.lookup(db.upcast()).source(db.upcast())
     }
 }
-impl HasSource for Variant {
+impl HasSource for EnumVariant {
     type Ast = ast::Variant;
     fn source(self, db: &dyn HirDatabase) -> InFile<ast::Variant> {
         self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone())
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index bdd270c58d..3f4f8d8e4a 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -34,9 +34,9 @@ pub use crate::{
     attrs::{HasAttrs, Namespace},
     code_model::{
         Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const,
-        Crate, CrateDependency, DefWithBody, Enum, Field, FieldSource, Function, GenericDef,
-        HasVisibility, Impl, LifetimeParam, Local, MacroDef, Module, ModuleDef, ScopeDef, Static,
-        Struct, Trait, Type, TypeAlias, TypeParam, Union, Variant, VariantDef,
+        Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function,
+        GenericDef, HasVisibility, Impl, LifetimeParam, Local, MacroDef, Module, ModuleDef,
+        ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
     },
     has_source::HasSource,
     semantics::{PathResolution, Semantics, SemanticsScope},
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 25ebf73d88..83ec91f587 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -51,7 +51,7 @@ impl PathResolution {
                 Some(TypeNs::BuiltinType(*builtin))
             }
             PathResolution::Def(ModuleDef::Const(_))
-            | PathResolution::Def(ModuleDef::Variant(_))
+            | PathResolution::Def(ModuleDef::EnumVariant(_))
             | PathResolution::Def(ModuleDef::Function(_))
             | PathResolution::Def(ModuleDef::Module(_))
             | PathResolution::Def(ModuleDef::Static(_))
@@ -715,7 +715,7 @@ to_def_impls![
     (crate::Function, ast::Fn, fn_to_def),
     (crate::Field, ast::RecordField, record_field_to_def),
     (crate::Field, ast::TupleField, tuple_field_to_def),
-    (crate::Variant, ast::Variant, enum_variant_to_def),
+    (crate::EnumVariant, ast::Variant, enum_variant_to_def),
     (crate::TypeParam, ast::TypeParam, type_param_to_def),
     (crate::LifetimeParam, ast::LifetimeParam, lifetime_param_to_def),
     (crate::MacroDef, ast::MacroRules, macro_rules_to_def),
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index bddc49c05a..bf0c959fee 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -28,8 +28,8 @@ use syntax::{
 };
 
 use crate::{
-    db::HirDatabase, semantics::PathResolution, Adt, Const, Field, Function, Local, MacroDef,
-    ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Variant,
+    db::HirDatabase, semantics::PathResolution, Adt, Const, EnumVariant, Field, Function, Local,
+    MacroDef, ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam,
 };
 use base_db::CrateId;
 
@@ -230,7 +230,7 @@ impl SourceAnalyzer {
             if let Some(VariantId::EnumVariantId(variant)) =
                 self.infer.as_ref()?.variant_resolution_for_expr(expr_id)
             {
-                return Some(PathResolution::Def(ModuleDef::Variant(variant.into())));
+                return Some(PathResolution::Def(ModuleDef::EnumVariant(variant.into())));
             }
         }
 
@@ -242,7 +242,7 @@ impl SourceAnalyzer {
             if let Some(VariantId::EnumVariantId(variant)) =
                 self.infer.as_ref()?.variant_resolution_for_pat(pat_id)
             {
-                return Some(PathResolution::Def(ModuleDef::Variant(variant.into())));
+                return Some(PathResolution::Def(ModuleDef::EnumVariant(variant.into())));
             }
         }
 
@@ -251,7 +251,7 @@ impl SourceAnalyzer {
             if let Some(VariantId::EnumVariantId(variant)) =
                 self.infer.as_ref()?.variant_resolution_for_expr(expr_id)
             {
-                return Some(PathResolution::Def(ModuleDef::Variant(variant.into())));
+                return Some(PathResolution::Def(ModuleDef::EnumVariant(variant.into())));
             }
         }
 
@@ -260,7 +260,7 @@ impl SourceAnalyzer {
             if let Some(VariantId::EnumVariantId(variant)) =
                 self.infer.as_ref()?.variant_resolution_for_pat(pat_id)
             {
-                return Some(PathResolution::Def(ModuleDef::Variant(variant.into())));
+                return Some(PathResolution::Def(ModuleDef::EnumVariant(variant.into())));
             }
         }
 
@@ -459,7 +459,7 @@ pub(crate) fn resolve_hir_path(
             TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => {
                 PathResolution::Def(Adt::from(it).into())
             }
-            TypeNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()),
+            TypeNs::EnumVariantId(it) => PathResolution::Def(EnumVariant::from(it).into()),
             TypeNs::TypeAliasId(it) => PathResolution::Def(TypeAlias::from(it).into()),
             TypeNs::BuiltinType(it) => PathResolution::Def(it.into()),
             TypeNs::TraitId(it) => PathResolution::Def(Trait::from(it).into()),
@@ -477,7 +477,7 @@ pub(crate) fn resolve_hir_path(
                 ValueNs::ConstId(it) => PathResolution::Def(Const::from(it).into()),
                 ValueNs::StaticId(it) => PathResolution::Def(Static::from(it).into()),
                 ValueNs::StructId(it) => PathResolution::Def(Struct::from(it).into()),
-                ValueNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()),
+                ValueNs::EnumVariantId(it) => PathResolution::Def(EnumVariant::from(it).into()),
                 ValueNs::ImplSelf(impl_id) => PathResolution::SelfType(impl_id.into()),
             };
             Some(res)
@@ -526,7 +526,7 @@ fn resolve_hir_path_qualifier(
         TypeNs::SelfType(it) => PathResolution::SelfType(it.into()),
         TypeNs::GenericParam(id) => PathResolution::TypeParam(TypeParam { id }),
         TypeNs::AdtSelfType(it) | TypeNs::AdtId(it) => PathResolution::Def(Adt::from(it).into()),
-        TypeNs::EnumVariantId(it) => PathResolution::Def(Variant::from(it).into()),
+        TypeNs::EnumVariantId(it) => PathResolution::Def(EnumVariant::from(it).into()),
         TypeNs::TypeAliasId(it) => PathResolution::Def(TypeAlias::from(it).into()),
         TypeNs::BuiltinType(it) => PathResolution::Def(it.into()),
         TypeNs::TraitId(it) => PathResolution::Def(Trait::from(it).into()),
diff --git a/crates/hir_def/src/generics.rs b/crates/hir_def/src/generics.rs
index bb8fca009a..41134d23b3 100644
--- a/crates/hir_def/src/generics.rs
+++ b/crates/hir_def/src/generics.rs
@@ -62,7 +62,6 @@ pub struct GenericParams {
 pub enum WherePredicate {
     TypeBound { target: WherePredicateTypeTarget, bound: TypeBound },
     Lifetime { target: LifetimeRef, bound: LifetimeRef },
-    ForLifetime { lifetimes: Box<[Name]>, target: WherePredicateTypeTarget, bound: TypeBound },
 }
 
 #[derive(Clone, PartialEq, Eq, Debug)]
@@ -70,6 +69,7 @@ pub enum WherePredicateTypeTarget {
     TypeRef(TypeRef),
     /// For desugared where predicates that can directly refer to a type param.
     TypeParam(LocalTypeParamId),
+    // FIXME: ForLifetime(Vec<LifetimeParamId>, TypeRef)
 }
 
 #[derive(Default)]
@@ -234,7 +234,7 @@ impl GenericParams {
         for bound in
             node.type_bound_list().iter().flat_map(|type_bound_list| type_bound_list.bounds())
         {
-            self.add_where_predicate_from_bound(lower_ctx, bound, None, target.clone());
+            self.add_where_predicate_from_bound(lower_ctx, bound, target.clone());
         }
     }
 
@@ -279,25 +279,8 @@ impl GenericParams {
             } else {
                 continue;
             };
-
-            let lifetimes: Option<Box<_>> = pred.generic_param_list().map(|param_list| {
-                // Higher-Ranked Trait Bounds
-                param_list
-                    .lifetime_params()
-                    .map(|lifetime_param| {
-                        lifetime_param
-                            .lifetime()
-                            .map_or_else(Name::missing, |lt| Name::new_lifetime(&lt))
-                    })
-                    .collect()
-            });
             for bound in pred.type_bound_list().iter().flat_map(|l| l.bounds()) {
-                self.add_where_predicate_from_bound(
-                    lower_ctx,
-                    bound,
-                    lifetimes.as_ref(),
-                    target.clone(),
-                );
+                self.add_where_predicate_from_bound(lower_ctx, bound, target.clone());
             }
         }
     }
@@ -306,7 +289,6 @@ impl GenericParams {
         &mut self,
         lower_ctx: &LowerCtx,
         bound: ast::TypeBound,
-        hrtb_lifetimes: Option<&Box<[Name]>>,
         target: Either<TypeRef, LifetimeRef>,
     ) {
         if bound.question_mark_token().is_some() {
@@ -315,16 +297,9 @@ impl GenericParams {
         }
         let bound = TypeBound::from_ast(lower_ctx, bound);
         let predicate = match (target, bound) {
-            (Either::Left(type_ref), bound) => match hrtb_lifetimes {
-                Some(hrtb_lifetimes) => WherePredicate::ForLifetime {
-                    lifetimes: hrtb_lifetimes.clone(),
-                    target: WherePredicateTypeTarget::TypeRef(type_ref),
-                    bound,
-                },
-                None => WherePredicate::TypeBound {
-                    target: WherePredicateTypeTarget::TypeRef(type_ref),
-                    bound,
-                },
+            (Either::Left(type_ref), bound) => WherePredicate::TypeBound {
+                target: WherePredicateTypeTarget::TypeRef(type_ref),
+                bound,
             },
             (Either::Right(lifetime), TypeBound::Lifetime(bound)) => {
                 WherePredicate::Lifetime { target: lifetime, bound }
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 8da56cd11c..8392cb7706 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -675,8 +675,7 @@ impl GenericPredicate {
         where_predicate: &'a WherePredicate,
     ) -> impl Iterator<Item = GenericPredicate> + 'a {
         match where_predicate {
-            WherePredicate::ForLifetime { target, bound, .. }
-            | WherePredicate::TypeBound { target, bound } => {
+            WherePredicate::TypeBound { target, bound } => {
                 let self_ty = match target {
                     WherePredicateTypeTarget::TypeRef(type_ref) => Ty::from_hir(ctx, type_ref),
                     WherePredicateTypeTarget::TypeParam(param_id) => {
@@ -889,13 +888,14 @@ pub(crate) fn generic_predicates_for_param_query(
         .where_predicates_in_scope()
         // we have to filter out all other predicates *first*, before attempting to lower them
         .filter(|pred| match pred {
-            WherePredicate::ForLifetime { target, .. }
-            | WherePredicate::TypeBound { target, .. } => match target {
-                WherePredicateTypeTarget::TypeRef(type_ref) => {
-                    Ty::from_hir_only_param(&ctx, type_ref) == Some(param_id)
-                }
-                WherePredicateTypeTarget::TypeParam(local_id) => *local_id == param_id.local_id,
-            },
+            WherePredicate::TypeBound {
+                target: WherePredicateTypeTarget::TypeRef(type_ref),
+                ..
+            } => Ty::from_hir_only_param(&ctx, type_ref) == Some(param_id),
+            WherePredicate::TypeBound {
+                target: WherePredicateTypeTarget::TypeParam(local_id),
+                ..
+            } => *local_id == param_id.local_id,
             WherePredicate::Lifetime { .. } => false,
         })
         .flat_map(|pred| {
diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs
index 65b79df0d5..af880c0658 100644
--- a/crates/hir_ty/src/utils.rs
+++ b/crates/hir_ty/src/utils.rs
@@ -5,9 +5,7 @@ use std::sync::Arc;
 use hir_def::{
     adt::VariantData,
     db::DefDatabase,
-    generics::{
-        GenericParams, TypeParamData, TypeParamProvenance, WherePredicate, WherePredicateTypeTarget,
-    },
+    generics::{GenericParams, TypeParamData, TypeParamProvenance, WherePredicateTypeTarget},
     path::Path,
     resolver::{HasResolver, TypeNs},
     type_ref::TypeRef,
@@ -29,8 +27,7 @@ fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
         .where_predicates
         .iter()
         .filter_map(|pred| match pred {
-            WherePredicate::ForLifetime { target, bound, .. }
-            | WherePredicate::TypeBound { target, bound } => match target {
+            hir_def::generics::WherePredicate::TypeBound { target, bound } => match target {
                 WherePredicateTypeTarget::TypeRef(TypeRef::Path(p))
                     if p == &Path::from(name![Self]) =>
                 {
@@ -41,7 +38,7 @@ fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> {
                 }
                 _ => None,
             },
-            WherePredicate::Lifetime { .. } => None,
+            hir_def::generics::WherePredicate::Lifetime { .. } => None,
         })
         .filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path.mod_path()) {
             Some(TypeNs::TraitId(t)) => Some(t),
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index e8b8966238..13240672f0 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -166,7 +166,7 @@ fn missing_record_expr_field_fix(
             def_file_id = source.file_id;
             source.value.record_field_list()?
         }
-        VariantDef::Variant(e) => {
+        VariantDef::EnumVariant(e) => {
             module = e.module(sema.db);
             let source = e.source(sema.db);
             def_file_id = source.file_id;
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index cd8ec54fa7..7d0514105b 100644
--- a/crates/ide/src/display/navigation_target.rs
+++ b/crates/ide/src/display/navigation_target.rs
@@ -233,7 +233,7 @@ impl TryToNav for hir::ModuleDef {
             hir::ModuleDef::Module(it) => it.to_nav(db),
             hir::ModuleDef::Function(it) => it.to_nav(db),
             hir::ModuleDef::Adt(it) => it.to_nav(db),
-            hir::ModuleDef::Variant(it) => it.to_nav(db),
+            hir::ModuleDef::EnumVariant(it) => it.to_nav(db),
             hir::ModuleDef::Const(it) => it.to_nav(db),
             hir::ModuleDef::Static(it) => it.to_nav(db),
             hir::ModuleDef::Trait(it) => it.to_nav(db),
@@ -262,7 +262,7 @@ impl ToNavFromAst for hir::Struct {
 impl ToNavFromAst for hir::Enum {
     const KIND: SymbolKind = SymbolKind::Enum;
 }
-impl ToNavFromAst for hir::Variant {
+impl ToNavFromAst for hir::EnumVariant {
     const KIND: SymbolKind = SymbolKind::Variant;
 }
 impl ToNavFromAst for hir::Union {
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index b61ea0b3e4..79c081cac2 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -181,7 +181,7 @@ fn rewrite_intra_doc_link(
             ModuleDef::Module(it) => it.resolve_doc_path(db, link, ns),
             ModuleDef::Function(it) => it.resolve_doc_path(db, link, ns),
             ModuleDef::Adt(it) => it.resolve_doc_path(db, link, ns),
-            ModuleDef::Variant(it) => it.resolve_doc_path(db, link, ns),
+            ModuleDef::EnumVariant(it) => it.resolve_doc_path(db, link, ns),
             ModuleDef::Const(it) => it.resolve_doc_path(db, link, ns),
             ModuleDef::Static(it) => it.resolve_doc_path(db, link, ns),
             ModuleDef::Trait(it) => it.resolve_doc_path(db, link, ns),
@@ -390,7 +390,7 @@ fn get_symbol_filename(db: &dyn HirDatabase, definition: &ModuleDef) -> Option<S
         ModuleDef::TypeAlias(t) => format!("type.{}.html", t.name(db)),
         ModuleDef::BuiltinType(t) => format!("primitive.{}.html", t.as_name()),
         ModuleDef::Function(f) => format!("fn.{}.html", f.name(db)),
-        ModuleDef::Variant(ev) => {
+        ModuleDef::EnumVariant(ev) => {
             format!("enum.{}.html#variant.{}", ev.parent_enum(db).name(db), ev.name(db))
         }
         ModuleDef::Const(c) => format!("const.{}.html", c.name(db)?),
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs
index 431da5d9c7..7a12e99652 100644
--- a/crates/ide/src/goto_definition.rs
+++ b/crates/ide/src/goto_definition.rs
@@ -1077,32 +1077,4 @@ fn foo<'foobar>(_: &'foobar ()) {
 }"#,
         )
     }
-
-    #[test]
-    #[ignore] // requires the HIR to somehow track these hrtb lifetimes
-    fn goto_lifetime_hrtb() {
-        check(
-            r#"trait Foo<T> {}
-fn foo<T>() where for<'a> T: Foo<&'a<|> (u8, u16)>, {}
-                    //^^
-"#,
-        );
-        check(
-            r#"trait Foo<T> {}
-fn foo<T>() where for<'a<|>> T: Foo<&'a (u8, u16)>, {}
-                    //^^
-"#,
-        );
-    }
-
-    #[test]
-    #[ignore] // requires ForTypes to be implemented
-    fn goto_lifetime_hrtb_for_type() {
-        check(
-            r#"trait Foo<T> {}
-fn foo<T>() where T: for<'a> Foo<&'a<|> (u8, u16)>, {}
-                       //^^
-"#,
-        );
-    }
 }
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 52f993cc92..b06fa5f155 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -297,7 +297,7 @@ fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option<String>
                 AssocItemContainer::Trait(t) => Some(t.name(db)),
                 AssocItemContainer::Impl(i) => i.target_ty(db).as_adt().map(|adt| adt.name(db)),
             },
-            ModuleDef::Variant(e) => Some(e.parent_enum(db).name(db)),
+            ModuleDef::EnumVariant(e) => Some(e.parent_enum(db).name(db)),
             _ => None,
         },
         _ => None,
@@ -355,7 +355,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
             ModuleDef::Adt(Adt::Struct(it)) => from_def_source(db, it, mod_path),
             ModuleDef::Adt(Adt::Union(it)) => from_def_source(db, it, mod_path),
             ModuleDef::Adt(Adt::Enum(it)) => from_def_source(db, it, mod_path),
-            ModuleDef::Variant(it) => from_def_source(db, it, mod_path),
+            ModuleDef::EnumVariant(it) => from_def_source(db, it, mod_path),
             ModuleDef::Const(it) => from_def_source(db, it, mod_path),
             ModuleDef::Static(it) => from_def_source(db, it, mod_path),
             ModuleDef::Trait(it) => from_def_source(db, it, mod_path),
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs
index cd721b7ebc..56e9238414 100644
--- a/crates/ide/src/references/rename.rs
+++ b/crates/ide/src/references/rename.rs
@@ -1488,39 +1488,4 @@ impl<'yeeee> Foo<'yeeee> for &'yeeee () {
 "#,
         )
     }
-
-    #[test]
-    fn test_rename_bind_pat() {
-        check(
-            "new_name",
-            r#"
-fn main() {
-    enum CustomOption<T> {
-        None,
-        Some(T),
-    }
-
-    let test_variable = CustomOption::Some(22);
-
-    match test_variable {
-        CustomOption::Some(foo<|>) if foo == 11 => {}
-        _ => (),
-    }
-}"#,
-            r#"
-fn main() {
-    enum CustomOption<T> {
-        None,
-        Some(T),
-    }
-
-    let test_variable = CustomOption::Some(22);
-
-    match test_variable {
-        CustomOption::Some(new_name) if new_name == 11 => {}
-        _ => (),
-    }
-}"#,
-        );
-    }
 }
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs
index 2f2b99130e..ff386be804 100644
--- a/crates/ide/src/runnables.rs
+++ b/crates/ide/src/runnables.rs
@@ -167,7 +167,7 @@ fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Op
         hir::ModuleDef::Module(it) => it.attrs(sema.db),
         hir::ModuleDef::Function(it) => it.attrs(sema.db),
         hir::ModuleDef::Adt(it) => it.attrs(sema.db),
-        hir::ModuleDef::Variant(it) => it.attrs(sema.db),
+        hir::ModuleDef::EnumVariant(it) => it.attrs(sema.db),
         hir::ModuleDef::Const(it) => it.attrs(sema.db),
         hir::ModuleDef::Static(it) => it.attrs(sema.db),
         hir::ModuleDef::Trait(it) => it.attrs(sema.db),
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs
index 00c717c7c7..67ad7c63dd 100644
--- a/crates/ide/src/syntax_highlighting.rs
+++ b/crates/ide/src/syntax_highlighting.rs
@@ -781,7 +781,7 @@ fn highlight_def(db: &RootDatabase, def: Definition) -> Highlight {
             hir::ModuleDef::Adt(hir::Adt::Struct(_)) => HighlightTag::Symbol(SymbolKind::Struct),
             hir::ModuleDef::Adt(hir::Adt::Enum(_)) => HighlightTag::Symbol(SymbolKind::Enum),
             hir::ModuleDef::Adt(hir::Adt::Union(_)) => HighlightTag::Symbol(SymbolKind::Union),
-            hir::ModuleDef::Variant(_) => HighlightTag::Symbol(SymbolKind::Variant),
+            hir::ModuleDef::EnumVariant(_) => HighlightTag::Symbol(SymbolKind::Variant),
             hir::ModuleDef::Const(konst) => {
                 let mut h = Highlight::new(HighlightTag::Symbol(SymbolKind::Const));
                 if konst.as_assoc_item(db).is_some() {
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs
index 9d7dce1d47..bd2afc8876 100644
--- a/crates/ide_db/src/defs.rs
+++ b/crates/ide_db/src/defs.rs
@@ -66,7 +66,7 @@ impl Definition {
                     hir::Adt::Union(it) => it.name(db),
                     hir::Adt::Enum(it) => it.name(db),
                 },
-                hir::ModuleDef::Variant(it) => it.name(db),
+                hir::ModuleDef::EnumVariant(it) => it.name(db),
                 hir::ModuleDef::Const(it) => it.name(db)?,
                 hir::ModuleDef::Static(it) => it.name(db)?,
                 hir::ModuleDef::Trait(it) => it.name(db),
@@ -207,7 +207,7 @@ impl NameClass {
                     Some(NameClass::Definition(Definition::ModuleDef(def.into())))
                 },
                 ast::Variant(it) => {
-                    let def: hir::Variant = sema.to_def(&it)?;
+                    let def: hir::EnumVariant = sema.to_def(&it)?;
                     Some(NameClass::Definition(Definition::ModuleDef(def.into())))
                 },
                 ast::Fn(it) => {
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index ff10f71c35..525c8a41fe 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -141,7 +141,7 @@ impl Definition {
                 hir::GenericDef::Trait(it) => it.source(db).value.syntax().text_range(),
                 hir::GenericDef::TypeAlias(it) => it.source(db).value.syntax().text_range(),
                 hir::GenericDef::Impl(it) => it.source(db).value.syntax().text_range(),
-                hir::GenericDef::Variant(it) => it.source(db).value.syntax().text_range(),
+                hir::GenericDef::EnumVariant(it) => it.source(db).value.syntax().text_range(),
                 hir::GenericDef::Const(it) => it.source(db).value.syntax().text_range(),
             };
             let mut res = FxHashMap::default();
diff --git a/crates/mbe/src/mbe_expander/transcriber.rs b/crates/mbe/src/mbe_expander/transcriber.rs
index 57592dc929..616119ba9c 100644
--- a/crates/mbe/src/mbe_expander/transcriber.rs
+++ b/crates/mbe/src/mbe_expander/transcriber.rs
@@ -97,7 +97,7 @@ fn expand_subtree(
                 err = err.or(e);
                 arena.push(tt.into());
             }
-            Op::Var { name, .. } => {
+            Op::Var { name, kind: _ } => {
                 let ExpandResult { value: fragment, err: e } = expand_var(ctx, name);
                 err = err.or(e);
                 push_fragment(arena, fragment);
diff --git a/crates/mbe/src/parser.rs b/crates/mbe/src/parser.rs
index c3fdd40404..6b46a1673c 100644
--- a/crates/mbe/src/parser.rs
+++ b/crates/mbe/src/parser.rs
@@ -101,9 +101,7 @@ fn next_op<'a>(
                     Op::Repeat { subtree, separator, kind }
                 }
                 tt::TokenTree::Leaf(leaf) => match leaf {
-                    tt::Leaf::Punct(_) => {
-                        return Err(ExpandError::UnexpectedToken);
-                    }
+                    tt::Leaf::Punct(..) => return Err(ExpandError::UnexpectedToken),
                     tt::Leaf::Ident(ident) => {
                         let name = &ident.text;
                         let kind = eat_fragment_kind(src, mode)?;
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index 2bec7fd495..265c0d63d8 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -313,7 +313,7 @@ trait TokenConvertor {
             return;
         }
 
-        result.push(if k.is_punct() && k != UNDERSCORE {
+        result.push(if k.is_punct() {
             assert_eq!(range.len(), TextSize::of('.'));
             let delim = match k {
                 T!['('] => Some((tt::DelimiterKind::Parenthesis, T![')'])),
@@ -378,7 +378,6 @@ trait TokenConvertor {
             let leaf: tt::Leaf = match k {
                 T![true] | T![false] => make_leaf!(Ident),
                 IDENT => make_leaf!(Ident),
-                UNDERSCORE => make_leaf!(Ident),
                 k if k.is_keyword() => make_leaf!(Ident),
                 k if k.is_literal() => make_leaf!(Literal),
                 LIFETIME_IDENT => {
diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs
index f08c8bab74..1a078f6b4c 100644
--- a/crates/parser/src/grammar.rs
+++ b/crates/parser/src/grammar.rs
@@ -55,7 +55,7 @@ pub(crate) mod fragments {
     use super::*;
 
     pub(crate) use super::{
-        expressions::block_expr, paths::type_path as path, patterns::pattern_single, types::type_,
+        expressions::block_expr, paths::type_path as path, patterns::pattern, types::type_,
     };
 
     pub(crate) fn expr(p: &mut Parser) {
diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs
index 811e740f98..ab8e4c70e8 100644
--- a/crates/parser/src/lib.rs
+++ b/crates/parser/src/lib.rs
@@ -112,7 +112,7 @@ pub fn parse_fragment(
         FragmentKind::Path => grammar::fragments::path,
         FragmentKind::Expr => grammar::fragments::expr,
         FragmentKind::Type => grammar::fragments::type_,
-        FragmentKind::Pattern => grammar::fragments::pattern_single,
+        FragmentKind::Pattern => grammar::fragments::pattern,
         FragmentKind::Item => grammar::fragments::item,
         FragmentKind::Block => grammar::fragments::block_expr,
         FragmentKind::Visibility => grammar::fragments::opt_visibility,
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc
index 40f10972f4..1ec6e81bb1 100644
--- a/docs/user/manual.adoc
+++ b/docs/user/manual.adoc
@@ -46,8 +46,8 @@ You can install the latest release of the plugin from
 https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer[the marketplace].
 
 Note that the plugin may cause conflicts with the
-https://marketplace.visualstudio.com/items?itemName=rust-lang.rust[official Rust plugin].
-It is recommended to disable the Rust plugin when using the rust-analyzer extension.
+https://marketplace.visualstudio.com/items?itemName=rust-lang.rust[official Rust plugin]. It is
+recommended to disable the Rust plugin when using the rust-analyzer extension.
 
 By default, the plugin will prompt you to download the matching version of the server as well:
 
@@ -74,21 +74,18 @@ Note that we only support two most recent versions of VS Code.
 
 ==== Updates
 
-The extension will be updated automatically as new versions become available.
-It will ask your permission to download the matching language server version binary if needed.
+The extension will be updated automatically as new versions become available. It will ask your permission to download the matching language server version binary if needed.
 
 ===== Nightly
 
-We ship nightly releases for VS Code.
-To help us out with testing the newest code and follow the bleeding edge of our `master`, please use the following config:
+We ship nightly releases for VS Code. To help us out with testing the newest code and follow the bleeding edge of our `master`, please use the following config:
 
 [source,json]
 ----
 { "rust-analyzer.updates.channel": "nightly" }
 ----
 
-You will be prompted to install the `nightly` extension version.
-Just click `Download now` and from that moment you will get automatic updates every 24 hours.
+You will be prompted to install the `nightly` extension version. Just click `Download now` and from that moment you will get automatic updates every 24 hours.
 
 If you don't want to be asked for `Download now` every day when the new nightly version is released add the following to your `settings.json`:
 [source,json]
@@ -163,8 +160,7 @@ $ chmod +x ~/.local/bin/rust-analyzer
 
 Ensure `~/.local/bin` is listed in the `$PATH` variable.
 
-Alternatively, you can install it from source using the command below.
-You'll need the latest stable version of the Rust toolchain.
+Alternatively, you can install it from source using the following command:
 
 [source,bash]
 ----
@@ -202,8 +198,7 @@ Emacs support is maintained as part of the https://github.com/emacs-lsp/lsp-mode
 
 === Vim/NeoVim
 
-Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
-Not needed if the extension can install/update it on its own, coc-rust-analyzer is one example.
+Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. Not needed if the extension can install/update it on its own, coc-rust-analyzer is one example.
 
 The are several LSP client implementations for vim or neovim:
 
@@ -275,16 +270,14 @@ Once `neovim/nvim-lspconfig` is installed, use `+lua require'nvim_lsp'.rust_anal
 
 Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
 
-You also need the `LSP` package.
-To install it:
+You also need the `LSP` package. To install it:
 
 1. If you've never installed a Sublime Text package, install Package Control:
    * Open the command palette (Win/Linux: `ctrl+shift+p`, Mac: `cmd+shift+p`)
    * Type `Install Package Control`, press enter
 2. In the command palette, run `Package control: Install package`, and in the list that pops up, type `LSP` and press enter.
 
-Finally, with your Rust project open, in the command palette, run `LSP: Enable Language Server In Project` or `LSP: Enable Language Server Globally`, then select `rust-analyzer` in the list that pops up to enable the rust-analyzer LSP.
-The latter means that rust-analyzer is enabled by default in Rust projects.
+Finally, with your Rust project open, in the command palette, run `LSP: Enable Language Server In Project` or `LSP: Enable Language Server Globally`, then select `rust-analyzer` in the list that pops up to enable the rust-analyzer LSP. The latter means that rust-analyzer is enabled by default in Rust projects.
 
 If it worked, you should see "rust-analyzer, Line X, Column Y" on the left side of the bottom bar, and after waiting a bit, functionality like tooltips on hovering over variables should become available.
 
@@ -292,8 +285,7 @@ If you get an error saying `No such file or directory: 'rust-analyzer'`, see the
 
 === GNOME Builder
 
-GNOME Builder 3.37.1 and newer has native `rust-analyzer` support.
-If the LSP binary is not available, GNOME Builder can install it when opening a Rust file.
+GNOME Builder 3.37.1 and newer has native `rust-analyzer` support. If the LSP binary is not available, GNOME Builder can install it when opening a Rust file.
 
 == Configuration
 
@@ -421,8 +413,8 @@ include::./generated_diagnostic.adoc[]
 
 ==== Color configurations
 
-It is possible to change the foreground/background color of inlay hints.
-Just add this to your `settings.json`:
+It is possible to change the foreground/background color of inlay hints. Just add this to your
+`settings.json`:
 
 [source,jsonc]
 ----
@@ -444,8 +436,7 @@ Just add this to your `settings.json`:
 
 ==== Semantic style customizations
 
-You can customize the look of different semantic elements in the source code.
-For example, mutable bindings are underlined by default and you can override this behavior by adding the following section to your `settings.json`:
+You can customize the look of different semantic elements in the source code. For example, mutable bindings are underlined by default and you can override this behavior by adding the following section to your `settings.json`:
 
 [source,jsonc]
 ----
@@ -461,9 +452,7 @@ For example, mutable bindings are underlined by default and you can override thi
 ----
 
 ==== Special `when` clause context for keybindings.
-You may use `inRustProject` context to configure keybindings for rust projects only.
-For example:
-
+You may use `inRustProject` context to configure keybindings for rust projects only. For example:
 [source,json]
 ----
 {
@@ -502,8 +491,7 @@ Or it is possible to specify vars more granularly:
 ]
 ```
 
-You can use any valid regular expression as a mask.
-Also note that a full runnable name is something like *run bin_or_example_name*, *test some::mod::test_name* or *test-mod some::mod*, so it is possible to distinguish binaries, single tests, and test modules with this masks: `"^run"`, `"^test "` (the trailing space matters!), and `"^test-mod"` respectively.
+You can use any valid RegExp as a mask. Also note that a full runnable name is something like *run bin_or_example_name*, *test some::mod::test_name* or *test-mod some::mod*, so it is possible to distinguish binaries, single tests, and test modules with this masks: `"^run"`, `"^test "` (the trailing space matters!), and `"^test-mod"` respectively.
 
 ==== Compiler feedback from external commands
 


Test patch:
diff --git a/crates/mbe/src/tests.rs b/crates/mbe/src/tests.rs
index 451fa1456a..dff6e98c2d 100644
--- a/crates/mbe/src/tests.rs
+++ b/crates/mbe/src/tests.rs
@@ -991,30 +991,6 @@ fn test_tt_composite2() {
     );
 }
 
-#[test]
-fn test_underscore() {
-    parse_macro(
-        r#"
-            macro_rules! foo {
-                 ($_:tt) => { 0 }
-            }
-    "#,
-    )
-    .assert_expand_items(r#"foo! { => }"#, r#"0"#);
-}
-
-#[test]
-fn test_vertical_bar_with_pat() {
-    parse_macro(
-        r#"
-            macro_rules! foo {
-                 (| $pat:pat | ) => { 0 }
-            }
-    "#,
-    )
-    .assert_expand_items(r#"foo! { | x | }"#, r#"0"#);
-}
-
 #[test]
 fn test_lifetime() {
     parse_macro(