Repository: rust-analyzer/rust-analyzer
Pull request #5732 (2020-08-12 21:54:12)

Consider only IdentPats for param name hints
Closes https://github.com/rust-analyzer/rust-analyzer/issues/4960

Avoid displaying any param name hints like 
<img width="590" alt="image" src="https://user-images.githubusercontent.com/2690773/90071461-47a4ad80-dcfe-11ea-9330-fb4f4e2d1b71.png">

Those hints seem to occupy plenty of space for no apparent benefit, with their destructured content not used in the code with the function hints.

I'm not entirely sure if we should show something else than `IdentPat`s, since I don't understand some of the `Pat` variant meanings:
https://github.com/rust-analyzer/rust-analyzer/blob/a1c187eef3ba08076aedb5154929f7eda8d1b424/crates/syntax/src/ast/generated/nodes.rs#L1336-L1352


Patch:
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 2deb009cef..f46fb8fecc 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -25,7 +25,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [ubuntu-latest, windows-latest] #, macos-latest]
+        os: [ubuntu-latest, windows-latest, macos-latest]
 
     steps:
     - name: Checkout repository
@@ -115,7 +115,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [ubuntu-latest, windows-latest]
+        os: [ubuntu-latest, windows-latest, macos-latest]
 
     runs-on: ${{ matrix.os }}
 
diff --git a/Cargo.lock b/Cargo.lock
index 18c979b39e..c95ef002d3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -15,6 +15,15 @@ version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
 
+[[package]]
+name = "aho-corasick"
+version = "0.7.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
+dependencies = [
+ "memchr",
+]
+
 [[package]]
 name = "ansi_term"
 version = "0.12.1"
@@ -112,16 +121,6 @@ version = "1.0.58"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
 
-[[package]]
-name = "cfg"
-version = "0.0.0"
-dependencies = [
- "mbe",
- "rustc-hash",
- "syntax",
- "tt",
-]
-
 [[package]]
 name = "cfg-if"
 version = "0.1.10"
@@ -290,9 +289,9 @@ checksum = "9bda8e21c04aca2ae33ffc2fd8c23134f3cac46db123ba97bd9d3f3b8a4a85e1"
 
 [[package]]
 name = "either"
-version = "1.6.0"
+version = "1.5.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f"
+checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
 
 [[package]]
 name = "ena"
@@ -552,9 +551,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 
 [[package]]
 name = "lazycell"
-version = "1.3.0"
+version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
+checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
 
 [[package]]
 name = "libc"
@@ -646,17 +645,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
 
 [[package]]
-name = "mbe"
-version = "0.0.0"
-dependencies = [
- "log",
- "parser",
- "rustc-hash",
- "smallvec",
- "syntax",
- "test_utils",
- "tt",
-]
+name = "memchr"
+version = "2.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
 
 [[package]]
 name = "memmap"
@@ -909,23 +901,6 @@ dependencies = [
  "unicode-xid",
 ]
 
-[[package]]
-name = "proc_macro_srv"
-version = "0.0.0"
-dependencies = [
- "cargo_metadata",
- "difference",
- "goblin",
- "libloading",
- "mbe",
- "memmap",
- "ra_proc_macro",
- "serde_derive",
- "test_utils",
- "toolchain",
- "tt",
-]
-
 [[package]]
 name = "profile"
 version = "0.0.0"
@@ -965,12 +940,22 @@ dependencies = [
  "text_edit",
 ]
 
+[[package]]
+name = "ra_cfg"
+version = "0.1.0"
+dependencies = [
+ "ra_mbe",
+ "rustc-hash",
+ "syntax",
+ "tt",
+]
+
 [[package]]
 name = "ra_db"
 version = "0.1.0"
 dependencies = [
- "cfg",
  "profile",
+ "ra_cfg",
  "rustc-hash",
  "salsa",
  "stdx",
@@ -1012,7 +997,6 @@ version = "0.1.0"
 dependencies = [
  "anymap",
  "arena",
- "cfg",
  "drop_bomb",
  "either",
  "expect",
@@ -1020,11 +1004,12 @@ dependencies = [
  "indexmap",
  "itertools",
  "log",
- "mbe",
  "once_cell",
  "profile",
+ "ra_cfg",
  "ra_db",
  "ra_hir_expand",
+ "ra_mbe",
  "rustc-hash",
  "smallvec",
  "stdx",
@@ -1040,10 +1025,10 @@ dependencies = [
  "arena",
  "either",
  "log",
- "mbe",
  "parser",
  "profile",
  "ra_db",
+ "ra_mbe",
  "rustc-hash",
  "syntax",
  "test_utils",
@@ -1082,7 +1067,6 @@ dependencies = [
 name = "ra_ide"
 version = "0.1.0"
 dependencies = [
- "cfg",
  "either",
  "expect",
  "indexmap",
@@ -1091,6 +1075,7 @@ dependencies = [
  "oorandom",
  "profile",
  "ra_assists",
+ "ra_cfg",
  "ra_db",
  "ra_fmt",
  "ra_hir",
@@ -1122,6 +1107,19 @@ dependencies = [
  "text_edit",
 ]
 
+[[package]]
+name = "ra_mbe"
+version = "0.1.0"
+dependencies = [
+ "log",
+ "parser",
+ "rustc-hash",
+ "smallvec",
+ "syntax",
+ "test_utils",
+ "tt",
+]
+
 [[package]]
 name = "ra_proc_macro"
 version = "0.1.0"
@@ -1134,6 +1132,23 @@ dependencies = [
  "tt",
 ]
 
+[[package]]
+name = "ra_proc_macro_srv"
+version = "0.1.0"
+dependencies = [
+ "cargo_metadata",
+ "difference",
+ "goblin",
+ "libloading",
+ "memmap",
+ "ra_mbe",
+ "ra_proc_macro",
+ "serde_derive",
+ "test_utils",
+ "toolchain",
+ "tt",
+]
+
 [[package]]
 name = "ra_project_model"
 version = "0.1.0"
@@ -1141,9 +1156,9 @@ dependencies = [
  "anyhow",
  "arena",
  "cargo_metadata",
- "cfg",
  "log",
  "paths",
+ "ra_cfg",
  "ra_db",
  "ra_proc_macro",
  "rustc-hash",
@@ -1204,7 +1219,10 @@ version = "1.3.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
 dependencies = [
+ "aho-corasick",
+ "memchr",
  "regex-syntax",
+ "thread_local",
 ]
 
 [[package]]
@@ -1240,7 +1258,6 @@ name = "rust-analyzer"
 version = "0.1.0"
 dependencies = [
  "anyhow",
- "cfg",
  "crossbeam-channel",
  "env_logger",
  "expect",
@@ -1250,19 +1267,20 @@ dependencies = [
  "log",
  "lsp-server",
  "lsp-types",
- "mbe",
  "mimalloc",
  "oorandom",
  "parking_lot",
  "pico-args",
- "proc_macro_srv",
  "profile",
+ "ra_cfg",
  "ra_db",
  "ra_hir",
  "ra_hir_def",
  "ra_hir_ty",
  "ra_ide",
  "ra_ide_db",
+ "ra_mbe",
+ "ra_proc_macro_srv",
  "ra_project_model",
  "ra_ssr",
  "rayon",
@@ -1396,18 +1414,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
 
 [[package]]
 name = "serde"
-version = "1.0.115"
+version = "1.0.114"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
+checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.115"
+version = "1.0.114"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
+checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1453,9 +1471,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
 
 [[package]]
 name = "smallvec"
-version = "1.4.2"
+version = "1.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
+checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f"
 
 [[package]]
 name = "smol_str"
@@ -1596,9 +1614,9 @@ dependencies = [
 
 [[package]]
 name = "tracing"
-version = "0.1.19"
+version = "0.1.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c"
+checksum = "f0aae59226cf195d8e74d4b34beae1859257efb4e5fed3f147d2dc2c7d372178"
 dependencies = [
  "cfg-if",
  "tracing-attributes",
@@ -1607,9 +1625,9 @@ dependencies = [
 
 [[package]]
 name = "tracing-attributes"
-version = "0.1.10"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fe233f4227389ab7df5b32649239da7ebe0b281824b4e84b342d04d3fd8c25e"
+checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1618,9 +1636,9 @@ dependencies = [
 
 [[package]]
 name = "tracing-core"
-version = "0.1.14"
+version = "0.1.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db63662723c316b43ca36d833707cc93dff82a02ba3d7e354f342682cc8b3545"
+checksum = "d593f98af59ebc017c0648f0117525db358745a8894a8d684e185ba3f45954f9"
 dependencies = [
  "lazy_static",
 ]
@@ -1648,9 +1666,9 @@ dependencies = [
 
 [[package]]
 name = "tracing-subscriber"
-version = "0.2.11"
+version = "0.2.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abd165311cc4d7a555ad11cc77a37756df836182db0d81aac908c8184c584f40"
+checksum = "f7b33f8b2ef2ab0c3778c12646d9c42a24f7772bee4cdafc72199644a9f58fdc"
 dependencies = [
  "ansi_term",
  "chrono",
@@ -1661,7 +1679,6 @@ dependencies = [
  "serde_json",
  "sharded-slab",
  "smallvec",
- "thread_local",
  "tracing-core",
  "tracing-log",
  "tracing-serde",
diff --git a/bors.toml b/bors.toml
index 4c980a24d3..13ce236df5 100644
--- a/bors.toml
+++ b/bors.toml
@@ -1,8 +1,9 @@
 status = [
     "Rust (ubuntu-latest)",
     "Rust (windows-latest)",
-    # "Rust (macos-latest)",
+    "Rust (macos-latest)",
     "TypeScript (ubuntu-latest)",
     "TypeScript (windows-latest)",
+    "TypeScript (macos-latest)",
 ]
 delete_merged_branches = true
diff --git a/crates/cfg/Cargo.toml b/crates/ra_cfg/Cargo.toml
similarity index 73%
rename from crates/cfg/Cargo.toml
rename to crates/ra_cfg/Cargo.toml
index d2ea551d18..cb0d2b9d73 100644
--- a/crates/cfg/Cargo.toml
+++ b/crates/ra_cfg/Cargo.toml
@@ -1,9 +1,9 @@
 [package]
-name = "cfg"
-version = "0.0.0"
-license = "MIT OR Apache-2.0"
-authors = ["rust-analyzer developers"]
 edition = "2018"
+name = "ra_cfg"
+version = "0.1.0"
+authors = ["rust-analyzer developers"]
+license = "MIT OR Apache-2.0"
 
 [lib]
 doctest = false
@@ -11,8 +11,8 @@ doctest = false
 [dependencies]
 rustc-hash = "1.1.0"
 
+syntax = { path = "../syntax" }
 tt = { path = "../tt" }
 
 [dev-dependencies]
-mbe = { path = "../mbe" }
-syntax = { path = "../syntax" }
+mbe = { path = "../ra_mbe", package = "ra_mbe" }
diff --git a/crates/cfg/src/cfg_expr.rs b/crates/ra_cfg/src/cfg_expr.rs
similarity index 91%
rename from crates/cfg/src/cfg_expr.rs
rename to crates/ra_cfg/src/cfg_expr.rs
index 336fe25bc9..940091465c 100644
--- a/crates/cfg/src/cfg_expr.rs
+++ b/crates/ra_cfg/src/cfg_expr.rs
@@ -4,7 +4,7 @@
 
 use std::slice::Iter as SliceIter;
 
-use tt::SmolStr;
+use syntax::SmolStr;
 
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub enum CfgExpr {
@@ -86,15 +86,17 @@ fn next_cfg_expr(it: &mut SliceIter<tt::TokenTree>) -> Option<CfgExpr> {
 mod tests {
     use super::*;
 
-    use mbe::ast_to_token_tree;
+    use mbe::{ast_to_token_tree, TokenMap};
     use syntax::ast::{self, AstNode};
 
+    fn get_token_tree_generated(input: &str) -> (tt::Subtree, TokenMap) {
+        let source_file = ast::SourceFile::parse(input).ok().unwrap();
+        let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap();
+        ast_to_token_tree(&tt).unwrap()
+    }
+
     fn assert_parse_result(input: &str, expected: CfgExpr) {
-        let (tt, _) = {
-            let source_file = ast::SourceFile::parse(input).ok().unwrap();
-            let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap();
-            ast_to_token_tree(&tt).unwrap()
-        };
+        let (tt, _) = get_token_tree_generated(input);
         let cfg = CfgExpr::parse(&tt);
         assert_eq!(cfg, expected);
     }
diff --git a/crates/cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs
similarity index 93%
rename from crates/cfg/src/lib.rs
rename to crates/ra_cfg/src/lib.rs
index a9d50e698a..7e025143bd 100644
--- a/crates/cfg/src/lib.rs
+++ b/crates/ra_cfg/src/lib.rs
@@ -1,9 +1,9 @@
-//! cfg defines conditional compiling options, `cfg` attibute parser and evaluator
+//! ra_cfg defines conditional compiling options, `cfg` attibute parser and evaluator
 
 mod cfg_expr;
 
 use rustc_hash::FxHashSet;
-use tt::SmolStr;
+use syntax::SmolStr;
 
 pub use cfg_expr::CfgExpr;
 
diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml
index ad432f096a..156ea1ee4b 100644
--- a/crates/ra_db/Cargo.toml
+++ b/crates/ra_db/Cargo.toml
@@ -13,7 +13,7 @@ salsa = "0.15.2"
 rustc-hash = "1.1.0"
 
 syntax = { path = "../syntax" }
-cfg = { path = "../cfg" }
+ra_cfg = { path = "../ra_cfg" }
 profile = { path = "../profile" }
 tt = { path = "../tt" }
 test_utils = { path = "../test_utils" }
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs
index 5ff8ead0e5..2aafb99654 100644
--- a/crates/ra_db/src/fixture.rs
+++ b/crates/ra_db/src/fixture.rs
@@ -59,7 +59,7 @@
 //! ```
 use std::{str::FromStr, sync::Arc};
 
-use cfg::CfgOptions;
+use ra_cfg::CfgOptions;
 use rustc_hash::FxHashMap;
 use test_utils::{extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER};
 use vfs::{file_set::FileSet, VfsPath};
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index f3d65cdf02..12a8634997 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -8,7 +8,7 @@
 
 use std::{fmt, iter::FromIterator, ops, str::FromStr, sync::Arc};
 
-use cfg::CfgOptions;
+use ra_cfg::CfgOptions;
 use rustc_hash::{FxHashMap, FxHashSet};
 use syntax::SmolStr;
 use tt::TokenExpander;
diff --git a/crates/ra_hir_def/Cargo.toml b/crates/ra_hir_def/Cargo.toml
index e7d3c4d5be..38129782fe 100644
--- a/crates/ra_hir_def/Cargo.toml
+++ b/crates/ra_hir_def/Cargo.toml
@@ -28,8 +28,8 @@ syntax = { path = "../syntax" }
 profile = { path = "../profile" }
 hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" }
 test_utils = { path = "../test_utils" }
-mbe = { path = "../mbe" }
-cfg = { path = "../cfg" }
+mbe = { path = "../ra_mbe", package = "ra_mbe" }
+ra_cfg = { path = "../ra_cfg" }
 tt = { path = "../tt" }
 
 [dev-dependencies]
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index d69ff2fc79..c83219d771 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -23,7 +23,7 @@ use crate::{
     EnumId, HasModule, LocalEnumVariantId, LocalFieldId, Lookup, ModuleId, StructId, UnionId,
     VariantId,
 };
-use cfg::CfgOptions;
+use ra_cfg::CfgOptions;
 
 /// Note that we use `StructData` for unions as well!
 #[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs
index dea552a605..36dc8b8166 100644
--- a/crates/ra_hir_def/src/attr.rs
+++ b/crates/ra_hir_def/src/attr.rs
@@ -2,10 +2,10 @@
 
 use std::{ops, sync::Arc};
 
-use cfg::{CfgExpr, CfgOptions};
 use either::Either;
 use hir_expand::{hygiene::Hygiene, AstId, InFile};
 use mbe::ast_to_token_tree;
+use ra_cfg::{CfgExpr, CfgOptions};
 use syntax::{
     ast::{self, AstNode, AttrsOwner},
     SmolStr,
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index fe659386a3..7c33966a71 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -6,10 +6,10 @@ pub mod scope;
 use std::{mem, ops::Index, sync::Arc};
 
 use arena::{map::ArenaMap, Arena};
-use cfg::CfgOptions;
 use drop_bomb::DropBomb;
 use either::Either;
 use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId};
+use ra_cfg::CfgOptions;
 use ra_db::CrateId;
 use rustc_hash::FxHashMap;
 use syntax::{ast, AstNode, AstPtr};
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 6a58919360..f7270ec91c 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -3,7 +3,6 @@
 //! `DefCollector::collect` contains the fixed-point iteration loop which
 //! resolves imports and expands macros.
 
-use cfg::CfgOptions;
 use hir_expand::{
     ast_id_map::FileAstId,
     builtin_derive::find_builtin_derive,
@@ -12,6 +11,7 @@ use hir_expand::{
     proc_macro::ProcMacroExpander,
     HirFileId, MacroCallId, MacroDefId, MacroDefKind,
 };
+use ra_cfg::CfgOptions;
 use ra_db::{CrateId, FileId, ProcMacroId};
 use rustc_hash::FxHashMap;
 use syntax::ast;
diff --git a/crates/ra_hir_expand/Cargo.toml b/crates/ra_hir_expand/Cargo.toml
index cbb0ac29b8..153a70bdf5 100644
--- a/crates/ra_hir_expand/Cargo.toml
+++ b/crates/ra_hir_expand/Cargo.toml
@@ -19,5 +19,5 @@ syntax = { path = "../syntax" }
 parser = { path = "../parser" }
 profile = { path = "../profile" }
 tt = { path = "../tt" }
-mbe = { path = "../mbe" }
+mbe = { path = "../ra_mbe", package = "ra_mbe" }
 test_utils = { path = "../test_utils"}
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml
index c60e555455..8e0fa59178 100644
--- a/crates/ra_ide/Cargo.toml
+++ b/crates/ra_ide/Cargo.toml
@@ -25,7 +25,7 @@ syntax = { path = "../syntax" }
 text_edit = { path = "../text_edit" }
 ra_db = { path = "../ra_db" }
 ra_ide_db = { path = "../ra_ide_db" }
-cfg = { path = "../cfg" }
+ra_cfg = { path = "../ra_cfg" }
 ra_fmt = { path = "../ra_fmt" }
 profile = { path = "../profile" }
 test_utils = { path = "../test_utils" }
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 46ddc528e5..81fe274adf 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -156,15 +156,15 @@ fn get_param_name_hints(
         .params(sema.db)
         .into_iter()
         .zip(args)
-        .filter_map(|((param, _ty), arg)| match param? {
-            Either::Left(self_param) => Some((self_param.to_string(), arg)),
-            Either::Right(pat) => {
-                let param_name = match pat {
+        .filter_map(|((param, _ty), arg)| {
+            let param_name = match param? {
+                Either::Left(self_param) => self_param.to_string(),
+                Either::Right(pat) => match pat {
                     ast::Pat::IdentPat(it) => it.name()?.to_string(),
-                    it => it.to_string(),
-                };
-                Some((param_name, arg))
-            }
+                    _ => return None,
+                },
+            };
+            Some((param_name, arg))
         })
         .filter(|(param_name, arg)| should_show_param_name_hint(sema, &callable, &param_name, &arg))
         .map(|(param_name, arg)| InlayHint {
@@ -707,6 +707,8 @@ fn different_order(param: &Param) {}
 fn different_order_mut(param: &mut Param) {}
 fn has_underscore(_param: bool) {}
 fn enum_matches_param_name(completion_kind: CompletionKind) {}
+fn param_destructuring_omitted_1((a, b): (u32, u32)) {}
+fn param_destructuring_omitted_2(TestVarContainer { test_var: _ }: TestVarContainer) {}
 
 fn twiddle(twiddle: bool) {}
 fn doo(_doo: bool) {}
@@ -746,6 +748,10 @@ fn main() {
     let b: f64 = 4.0;
     let _: f64 = a.div_euclid(b);
     let _: f64 = a.abs_sub(b);
+
+    let range: (u32, u32) = (3, 5);
+    param_destructuring_omitted_1(range);
+    param_destructuring_omitted_2(container);
 }"#,
         );
     }
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index 1fdf17800d..20967ba990 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -47,7 +47,7 @@ mod typing;
 
 use std::sync::Arc;
 
-use cfg::CfgOptions;
+use ra_cfg::CfgOptions;
 use ra_db::{
     salsa::{self, ParallelDatabase},
     CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath,
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index a4691f0284..c7e0f4b58f 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -1,7 +1,7 @@
 //! FIXME: write short doc here
 use std::sync::Arc;
 
-use cfg::CfgOptions;
+use ra_cfg::CfgOptions;
 use ra_db::{CrateName, FileSet, SourceRoot, VfsPath};
 use test_utils::{
     extract_annotations, extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER,
diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs
index b78388e6b1..69af0c86ad 100644
--- a/crates/ra_ide/src/parent_module.rs
+++ b/crates/ra_ide/src/parent_module.rs
@@ -63,7 +63,7 @@ pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> {
 
 #[cfg(test)]
 mod tests {
-    use cfg::CfgOptions;
+    use ra_cfg::CfgOptions;
     use ra_db::Env;
     use test_utils::mark;
 
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index fb40762cfb..54cb3b3094 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -1,8 +1,8 @@
 use std::fmt;
 
-use cfg::CfgExpr;
 use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics};
 use itertools::Itertools;
+use ra_cfg::CfgExpr;
 use ra_ide_db::RootDatabase;
 use syntax::{
     ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner},
diff --git a/crates/mbe/Cargo.toml b/crates/ra_mbe/Cargo.toml
similarity index 90%
rename from crates/mbe/Cargo.toml
rename to crates/ra_mbe/Cargo.toml
index 1aba8b7c48..4a4be65ebc 100644
--- a/crates/mbe/Cargo.toml
+++ b/crates/ra_mbe/Cargo.toml
@@ -1,21 +1,20 @@
 [package]
-name = "mbe"
-version = "0.0.0"
-license = "MIT OR Apache-2.0"
-authors = ["rust-analyzer developers"]
 edition = "2018"
+name = "ra_mbe"
+version = "0.1.0"
+authors = ["rust-analyzer developers"]
+license = "MIT OR Apache-2.0"
 
 [lib]
 doctest = false
 
 [dependencies]
-rustc-hash = "1.1.0"
-smallvec = "1.2.0"
-log = "0.4.8"
-
 syntax = { path = "../syntax" }
 parser = { path = "../parser" }
 tt = { path = "../tt" }
+rustc-hash = "1.1.0"
+smallvec = "1.2.0"
+log = "0.4.8"
 
 [dev-dependencies]
 test_utils = { path = "../test_utils" }
diff --git a/crates/mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs
similarity index 100%
rename from crates/mbe/src/lib.rs
rename to crates/ra_mbe/src/lib.rs
diff --git a/crates/mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs
similarity index 100%
rename from crates/mbe/src/mbe_expander.rs
rename to crates/ra_mbe/src/mbe_expander.rs
diff --git a/crates/mbe/src/mbe_expander/matcher.rs b/crates/ra_mbe/src/mbe_expander/matcher.rs
similarity index 100%
rename from crates/mbe/src/mbe_expander/matcher.rs
rename to crates/ra_mbe/src/mbe_expander/matcher.rs
diff --git a/crates/mbe/src/mbe_expander/transcriber.rs b/crates/ra_mbe/src/mbe_expander/transcriber.rs
similarity index 100%
rename from crates/mbe/src/mbe_expander/transcriber.rs
rename to crates/ra_mbe/src/mbe_expander/transcriber.rs
diff --git a/crates/mbe/src/parser.rs b/crates/ra_mbe/src/parser.rs
similarity index 100%
rename from crates/mbe/src/parser.rs
rename to crates/ra_mbe/src/parser.rs
diff --git a/crates/mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs
similarity index 100%
rename from crates/mbe/src/subtree_source.rs
rename to crates/ra_mbe/src/subtree_source.rs
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
similarity index 100%
rename from crates/mbe/src/syntax_bridge.rs
rename to crates/ra_mbe/src/syntax_bridge.rs
diff --git a/crates/mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs
similarity index 100%
rename from crates/mbe/src/tests.rs
rename to crates/ra_mbe/src/tests.rs
diff --git a/crates/mbe/src/tt_iter.rs b/crates/ra_mbe/src/tt_iter.rs
similarity index 100%
rename from crates/mbe/src/tt_iter.rs
rename to crates/ra_mbe/src/tt_iter.rs
diff --git a/crates/proc_macro_srv/Cargo.toml b/crates/ra_proc_macro_srv/Cargo.toml
similarity index 83%
rename from crates/proc_macro_srv/Cargo.toml
rename to crates/ra_proc_macro_srv/Cargo.toml
index 0954ffb66f..1c25e72296 100644
--- a/crates/proc_macro_srv/Cargo.toml
+++ b/crates/ra_proc_macro_srv/Cargo.toml
@@ -1,21 +1,21 @@
 [package]
-name = "proc_macro_srv"
-version = "0.0.0"
-license = "MIT OR Apache-2.0"
-authors = ["rust-analyzer developers"]
 edition = "2018"
+name = "ra_proc_macro_srv"
+version = "0.1.0"
+authors = ["rust-analyzer developers"]
+publish = false
+license = "MIT OR Apache-2.0"
 
 [lib]
 doctest = false
 
 [dependencies]
+tt = { path = "../tt" }
+ra_mbe = { path = "../ra_mbe" }
+ra_proc_macro = { path = "../ra_proc_macro" }
 goblin = "0.2.1"
 libloading = "0.6.0"
 memmap = "0.7"
-
-tt = { path = "../tt" }
-mbe = { path = "../mbe" }
-ra_proc_macro = { path = "../ra_proc_macro" }
 test_utils = { path = "../test_utils" }
 
 [dev-dependencies]
@@ -23,5 +23,4 @@ cargo_metadata = "0.11.1"
 difference = "2.0.0"
 # used as proc macro test target
 serde_derive = "1.0.106"
-
 toolchain = { path = "../toolchain" }
diff --git a/crates/proc_macro_srv/src/cli.rs b/crates/ra_proc_macro_srv/src/cli.rs
similarity index 100%
rename from crates/proc_macro_srv/src/cli.rs
rename to crates/ra_proc_macro_srv/src/cli.rs
diff --git a/crates/proc_macro_srv/src/dylib.rs b/crates/ra_proc_macro_srv/src/dylib.rs
similarity index 100%
rename from crates/proc_macro_srv/src/dylib.rs
rename to crates/ra_proc_macro_srv/src/dylib.rs
diff --git a/crates/proc_macro_srv/src/lib.rs b/crates/ra_proc_macro_srv/src/lib.rs
similarity index 100%
rename from crates/proc_macro_srv/src/lib.rs
rename to crates/ra_proc_macro_srv/src/lib.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/buffer.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/buffer.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/buffer.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/buffer.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/client.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/client.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/client.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/client.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/closure.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/closure.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/closure.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/closure.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/handle.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/handle.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/handle.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/handle.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/mod.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/mod.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/mod.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/mod.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/rpc.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/rpc.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/rpc.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/scoped_cell.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/bridge/server.rs b/crates/ra_proc_macro_srv/src/proc_macro/bridge/server.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/bridge/server.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/bridge/server.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/diagnostic.rs b/crates/ra_proc_macro_srv/src/proc_macro/diagnostic.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/diagnostic.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/diagnostic.rs
diff --git a/crates/proc_macro_srv/src/proc_macro/mod.rs b/crates/ra_proc_macro_srv/src/proc_macro/mod.rs
similarity index 100%
rename from crates/proc_macro_srv/src/proc_macro/mod.rs
rename to crates/ra_proc_macro_srv/src/proc_macro/mod.rs
diff --git a/crates/proc_macro_srv/src/rustc_server.rs b/crates/ra_proc_macro_srv/src/rustc_server.rs
similarity index 99%
rename from crates/proc_macro_srv/src/rustc_server.rs
rename to crates/ra_proc_macro_srv/src/rustc_server.rs
index 7d1695c86a..d534d1337f 100644
--- a/crates/proc_macro_srv/src/rustc_server.rs
+++ b/crates/ra_proc_macro_srv/src/rustc_server.rs
@@ -182,7 +182,7 @@ pub mod token_stream {
 
         fn from_str(src: &str) -> Result<TokenStream, LexError> {
             let (subtree, _token_map) =
-                mbe::parse_to_token_tree(src).ok_or("Failed to parse from mbe")?;
+                ra_mbe::parse_to_token_tree(src).ok_or("Failed to parse from mbe")?;
 
             let tt: tt::TokenTree = subtree.into();
             Ok(tt.into())
diff --git a/crates/proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt b/crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
similarity index 100%
rename from crates/proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
rename to crates/ra_proc_macro_srv/src/tests/fixtures/test_serialize_proc_macro.txt
diff --git a/crates/proc_macro_srv/src/tests/mod.rs b/crates/ra_proc_macro_srv/src/tests/mod.rs
similarity index 100%
rename from crates/proc_macro_srv/src/tests/mod.rs
rename to crates/ra_proc_macro_srv/src/tests/mod.rs
diff --git a/crates/proc_macro_srv/src/tests/utils.rs b/crates/ra_proc_macro_srv/src/tests/utils.rs
similarity index 100%
rename from crates/proc_macro_srv/src/tests/utils.rs
rename to crates/ra_proc_macro_srv/src/tests/utils.rs
diff --git a/crates/ra_project_model/Cargo.toml b/crates/ra_project_model/Cargo.toml
index 52f2d57b3b..171fe86264 100644
--- a/crates/ra_project_model/Cargo.toml
+++ b/crates/ra_project_model/Cargo.toml
@@ -15,7 +15,7 @@ rustc-hash = "1.1.0"
 cargo_metadata = "0.11.1"
 
 arena = { path = "../arena" }
-cfg = { path = "../cfg" }
+ra_cfg = { path = "../ra_cfg" }
 ra_db = { path = "../ra_db" }
 toolchain = { path = "../toolchain" }
 ra_proc_macro =  { path = "../ra_proc_macro" }
diff --git a/crates/ra_project_model/src/cfg_flag.rs b/crates/ra_project_model/src/cfg_flag.rs
index e92962cf67..bd50056c68 100644
--- a/crates/ra_project_model/src/cfg_flag.rs
+++ b/crates/ra_project_model/src/cfg_flag.rs
@@ -3,7 +3,7 @@
 //! rustc main.rs --cfg foo --cfg 'feature="bar"'
 use std::str::FromStr;
 
-use cfg::CfgOptions;
+use ra_cfg::CfgOptions;
 use stdx::split_once;
 
 #[derive(Clone, Eq, PartialEq, Debug)]
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index ee42198f35..46f44910c0 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -12,8 +12,8 @@ use std::{
 };
 
 use anyhow::{bail, Context, Result};
-use cfg::CfgOptions;
 use paths::{AbsPath, AbsPathBuf};
+use ra_cfg::CfgOptions;
 use ra_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId};
 use rustc_hash::{FxHashMap, FxHashSet};
 
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 440b1cd134..86c786e25c 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -42,7 +42,7 @@ syntax = { path = "../syntax" }
 text_edit = { path = "../text_edit" }
 vfs = { path = "../vfs" }
 vfs-notify = { path = "../vfs-notify" }
-cfg = { path = "../cfg" }
+ra_cfg = { path = "../ra_cfg" }
 toolchain = { path = "../toolchain" }
 
 # This should only be used in CLI
@@ -52,7 +52,7 @@ ra_ssr = { path = "../ra_ssr" }
 hir = { path = "../ra_hir", package = "ra_hir" }
 hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
 hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" }
-proc_macro_srv = { path = "../proc_macro_srv" }
+ra_proc_macro_srv = { path = "../ra_proc_macro_srv" }
 
 [target.'cfg(windows)'.dependencies]
 winapi = "0.3.8"
@@ -60,5 +60,5 @@ winapi = "0.3.8"
 [dev-dependencies]
 expect = { path = "../expect" }
 test_utils = { path = "../test_utils" }
-mbe = { path = "../mbe" }
+mbe = { path = "../ra_mbe", package = "ra_mbe" }
 tt = { path = "../tt" }
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index f177f8709a..9622d71c06 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -30,7 +30,7 @@ fn try_main() -> Result<()> {
     let args = args::Args::parse()?;
     match args.command {
         args::Command::RunServer => run_server()?,
-        args::Command::ProcMacro => proc_macro_srv::cli::run()?,
+        args::Command::ProcMacro => ra_proc_macro_srv::cli::run()?,
 
         args::Command::Parse { no_dump } => cli::parse(no_dump)?,
         args::Command::Symbols => cli::symbols()?,
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs
index 9c7a9cce61..7929368c0c 100644
--- a/crates/rust-analyzer/src/cargo_target_spec.rs
+++ b/crates/rust-analyzer/src/cargo_target_spec.rs
@@ -1,6 +1,6 @@
 //! See `CargoTargetSpec`
 
-use cfg::CfgExpr;
+use ra_cfg::CfgExpr;
 use ra_ide::{FileId, RunnableKind, TestId};
 use ra_project_model::{self, TargetKind};
 use vfs::AbsPathBuf;
@@ -177,8 +177,8 @@ fn required_features(cfg_expr: &CfgExpr, features: &mut Vec<String>) {
 mod tests {
     use super::*;
 
-    use cfg::CfgExpr;
     use mbe::ast_to_token_tree;
+    use ra_cfg::CfgExpr;
     use syntax::{
         ast::{self, AstNode},
         SmolStr,
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 611c9a89f5..f74f2c02c8 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -176,7 +176,7 @@ impl GlobalState {
                 Ok(it) => it,
                 Err(err) => {
                     log::error!(
-                        "Failed to run proc_macro_srv from path {}, error: {:?}",
+                        "Failed to run ra_proc_macro_srv from path {}, error: {:?}",
                         path.display(),
                         err
                     );


Test patch:
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index 0188aaa2ec..8c608284a4 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -195,7 +195,7 @@ impl TidyDocs {
             "ra_hir",
             "ra_hir_expand",
             "ra_ide",
-            "mbe",
+            "ra_mbe",
             "parser",
             "profile",
             "ra_project_model",