Repository: rust-analyzer/rust-analyzer
Pull request #11795 (2022-03-22 21:33:02)

fix: Correctly suggest auto importing traits from aliases
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11506


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 0aa8adbdb5..5351da334a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -171,9 +171,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
 [[package]]
 name = "chalk-derive"
-version = "0.80.0"
+version = "0.79.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0001adf0cf12361e08b65e1898ea138f8f77d8f5177cbf29b6b3b3532252bd6"
+checksum = "0b14364774396379d5c488e73d88e0a6d2b51acd0dac9c8359e2f84c58cf3a16"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -183,9 +183,9 @@ dependencies = [
 
 [[package]]
 name = "chalk-ir"
-version = "0.80.0"
+version = "0.79.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92d8a95548f23618fda86426e4304e563ec2bb7ba0216139f0748d63c107b5f1"
+checksum = "cd571e8931d3075f562a2d460bfe3028a9c7b343876765cce95b6143a76b882e"
 dependencies = [
  "bitflags",
  "chalk-derive",
@@ -194,9 +194,9 @@ dependencies = [
 
 [[package]]
 name = "chalk-recursive"
-version = "0.80.0"
+version = "0.79.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "759a811f4706f02304353db1b8b525fe6ec25648e004bf7e348139c86865240f"
+checksum = "54ceedab35607f4680d02de80f8be005af0ad5c1dcfec56cfd849d33da5fe736"
 dependencies = [
  "chalk-derive",
  "chalk-ir",
@@ -207,9 +207,9 @@ dependencies = [
 
 [[package]]
 name = "chalk-solve"
-version = "0.80.0"
+version = "0.79.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f37f492dacfafe2e21319b80827da2779932909bb392f0cc86b2bd5c07c1b4e1"
+checksum = "9e31bb853cf921365759346db05d833f969e330462432bf38c9c2be1e78a9abd"
 dependencies = [
  "chalk-derive",
  "chalk-ir",
@@ -249,9 +249,9 @@ dependencies = [
 
 [[package]]
 name = "crossbeam-channel"
-version = "0.5.4"
+version = "0.5.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
+checksum = "fdbfe11fe19ff083c48923cf179540e8cd0535903dc35e178a1fdeeb59aef51f"
 dependencies = [
  "cfg-if",
  "crossbeam-utils",
@@ -821,9 +821,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 
 [[package]]
 name = "libc"
-version = "0.2.121"
+version = "0.2.120"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
+checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09"
 
 [[package]]
 name = "libloading"
@@ -880,9 +880,9 @@ dependencies = [
 
 [[package]]
 name = "lsp-types"
-version = "0.92.1"
+version = "0.92.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c79d4897790e8fd2550afa6d6125821edb5716e60e0e285046e070f0f6a06e0e"
+checksum = "e8a69d4142d51b208c9fc3cea68b1a7fcef30354e7aa6ccad07250fd8430fc76"
 dependencies = [
  "bitflags",
  "serde",
@@ -1283,9 +1283,9 @@ dependencies = [
 
 [[package]]
 name = "quote"
-version = "1.0.16"
+version = "1.0.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57"
+checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
 dependencies = [
  "proc-macro2",
 ]
diff --git a/crates/cfg/Cargo.toml b/crates/cfg/Cargo.toml
index 5c510db83b..8f9437d8e7 100644
--- a/crates/cfg/Cargo.toml
+++ b/crates/cfg/Cargo.toml
@@ -17,10 +17,10 @@ tt = { path = "../tt", version = "0.0.0" }
 [dev-dependencies]
 mbe = { path = "../mbe" }
 syntax = { path = "../syntax" }
-expect-test = "1.2.2"
-oorandom = "11.1.3"
+expect-test = "1.2.0-pre.1"
+oorandom = "11"
 # We depend on both individually instead of using `features = ["derive"]` to microoptimize the
 # build graph: if the feature was enabled, syn would be built early on in the graph if `smolstr`
 # supports `arbitrary`. This way, we avoid feature unification.
-arbitrary = "1.1.0"
-derive_arbitrary = "1.1.0"
+arbitrary = "1"
+derive_arbitrary = "1"
diff --git a/crates/flycheck/Cargo.toml b/crates/flycheck/Cargo.toml
index c33d893744..6284ebfc82 100644
--- a/crates/flycheck/Cargo.toml
+++ b/crates/flycheck/Cargo.toml
@@ -10,12 +10,12 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-crossbeam-channel = "0.5.4"
-tracing = "0.1.32"
-cargo_metadata = "0.14.2"
-serde = { version = "1.0.136", features = ["derive"] }
-serde_json = "1.0.79"
-jod-thread = "0.1.2"
+crossbeam-channel = "0.5.0"
+tracing = "0.1"
+cargo_metadata = "0.14"
+serde = { version = "1.0.106", features = ["derive"] }
+serde_json = "1.0.48"
+jod-thread = "0.1.1"
 
 toolchain = { path = "../toolchain", version = "0.0.0" }
 stdx = { path = "../stdx", version = "0.0.0" }
diff --git a/crates/hir/Cargo.toml b/crates/hir/Cargo.toml
index 2b9a52d36f..68cfb5d324 100644
--- a/crates/hir/Cargo.toml
+++ b/crates/hir/Cargo.toml
@@ -11,11 +11,11 @@ doctest = false
 
 [dependencies]
 rustc-hash = "1.1.0"
-either = "1.6.1"
-arrayvec = "0.7.2"
-itertools = "0.10.3"
-smallvec = "1.8.0"
-once_cell = "1.10.0"
+either = "1.5.3"
+arrayvec = "0.7"
+itertools = "0.10.0"
+smallvec = "1.4.0"
+once_cell = "1"
 
 stdx = { path = "../stdx", version = "0.0.0" }
 syntax = { path = "../syntax", version = "0.0.0" }
diff --git a/crates/hir_def/Cargo.toml b/crates/hir_def/Cargo.toml
index 5087e18bc3..8a886f4a96 100644
--- a/crates/hir_def/Cargo.toml
+++ b/crates/hir_def/Cargo.toml
@@ -11,19 +11,19 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-dashmap = { version = "5.2.0", features = ["raw-api"] }
-lock_api = "0.4.6"
-parking_lot = "0.12.0"
-tracing = "0.1.32"
-once_cell = "1.10.0"
+dashmap = { version = "5.0", features = ["raw-api"] }
+lock_api = "0.4"
+parking_lot = "0.12"
+tracing = "0.1"
+once_cell = "1.3.1"
 rustc-hash = "1.1.0"
-either = "1.6.1"
+either = "1.5.3"
 anymap = "0.12.1"
-drop_bomb = "0.1.5"
-fst = { version = "0.4.7", default-features = false }
-itertools = "0.10.3"
-indexmap = "1.8.0"
-smallvec = "1.8.0"
+drop_bomb = "0.1.4"
+fst = { version = "0.4", default-features = false }
+itertools = "0.10.0"
+indexmap = "1.7.0"
+smallvec = "1.4.0"
 arrayvec = "0.7.2"
 la-arena = { version = "0.3.0", path = "../../lib/arena" }
 
@@ -39,4 +39,4 @@ limit = { path = "../limit", version = "0.0.0" }
 
 [dev-dependencies]
 test_utils = { path = "../test_utils" }
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
diff --git a/crates/hir_expand/Cargo.toml b/crates/hir_expand/Cargo.toml
index 9d8772d129..d7b4cbf82e 100644
--- a/crates/hir_expand/Cargo.toml
+++ b/crates/hir_expand/Cargo.toml
@@ -11,12 +11,12 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-tracing = "0.1.32"
-either = "1.6.1"
-rustc-hash = "1.1.0"
+tracing = "0.1"
+either = "1.5.3"
+rustc-hash = "1.0.0"
 la-arena = { version = "0.3.0", path = "../../lib/arena" }
-itertools = "0.10.3"
-hashbrown = { version = "0.12.0", features = [
+itertools = "0.10.0"
+hashbrown = { version = "0.12", features = [
     "inline-more",
 ], default-features = false }
 
@@ -29,4 +29,4 @@ mbe = { path = "../mbe", version = "0.0.0" }
 limit = { path = "../limit", version = "0.0.0" }
 
 [dev-dependencies]
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml
index 699fd86c9d..d2bfca53ad 100644
--- a/crates/hir_ty/Cargo.toml
+++ b/crates/hir_ty/Cargo.toml
@@ -11,18 +11,18 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-itertools = "0.10.3"
-arrayvec = "0.7.2"
-smallvec = "1.8.0"
+itertools = "0.10.0"
+arrayvec = "0.7"
+smallvec = "1.2.0"
 ena = "0.14.0"
-tracing = "0.1.32"
+tracing = "0.1"
 rustc-hash = "1.1.0"
-scoped-tls = "1.0.0"
-chalk-solve = { version = "0.80.0", default-features = false }
-chalk-ir = "0.80.0"
-chalk-recursive = { version = "0.80.0", default-features = false }
+scoped-tls = "1"
+chalk-solve = { version = "0.79", default-features = false }
+chalk-ir = "0.79"
+chalk-recursive = { version = "0.79", default-features = false }
 la-arena = { version = "0.3.0", path = "../../lib/arena" }
-once_cell = "1.10.0"
+once_cell = { version = "1.5.0" }
 typed-arena = "2.0.1"
 
 stdx = { path = "../stdx", version = "0.0.0" }
@@ -35,10 +35,10 @@ limit = { path = "../limit", version = "0.0.0" }
 
 [dev-dependencies]
 test_utils = { path = "../test_utils" }
-expect-test = "1.2.2"
-tracing = "0.1.32"
-tracing-subscriber = { version = "0.3.9", default-features = false, features = [
+expect-test = "1.2.0-pre.1"
+tracing = "0.1"
+tracing-subscriber = { version = "0.3", default-features = false, features = [
     "env-filter",
     "registry",
 ] }
-tracing-tree = "0.2.0"
+tracing-tree = "0.2"
diff --git a/crates/hir_ty/src/chalk_db.rs b/crates/hir_ty/src/chalk_db.rs
index 451245b5d2..1b67e5a86b 100644
--- a/crates/hir_ty/src/chalk_db.rs
+++ b/crates/hir_ty/src/chalk_db.rs
@@ -337,10 +337,6 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
             hir_def::AdtId::UnionId(id) => self.db.union_data(id).name.to_string(),
         }
     }
-    fn adt_size_align(&self, _id: chalk_ir::AdtId<Interner>) -> Arc<rust_ir::AdtSizeAlign> {
-        // FIXME
-        Arc::new(rust_ir::AdtSizeAlign::from_one_zst(false))
-    }
     fn assoc_type_name(&self, assoc_ty_id: chalk_ir::AssocTypeId<Interner>) -> String {
         let id = self.db.associated_ty_data(assoc_ty_id).name;
         self.db.type_alias_data(id).name.to_string()
@@ -484,38 +480,34 @@ pub(crate) fn trait_datum_query(
 
 fn well_known_trait_from_lang_attr(name: &str) -> Option<WellKnownTrait> {
     Some(match name {
-        "clone" => WellKnownTrait::Clone,
-        "coerce_unsized" => WellKnownTrait::CoerceUnsized,
+        "sized" => WellKnownTrait::Sized,
         "copy" => WellKnownTrait::Copy,
-        "discriminant_kind" => WellKnownTrait::DiscriminantKind,
-        "dispatch_from_dyn" => WellKnownTrait::DispatchFromDyn,
+        "clone" => WellKnownTrait::Clone,
         "drop" => WellKnownTrait::Drop,
-        "fn" => WellKnownTrait::Fn,
-        "fn_mut" => WellKnownTrait::FnMut,
         "fn_once" => WellKnownTrait::FnOnce,
-        "generator" => WellKnownTrait::Generator,
-        "sized" => WellKnownTrait::Sized,
-        "unpin" => WellKnownTrait::Unpin,
+        "fn_mut" => WellKnownTrait::FnMut,
+        "fn" => WellKnownTrait::Fn,
         "unsize" => WellKnownTrait::Unsize,
+        "coerce_unsized" => WellKnownTrait::CoerceUnsized,
+        "discriminant_kind" => WellKnownTrait::DiscriminantKind,
         _ => return None,
     })
 }
 
 fn lang_attr_from_well_known_trait(attr: WellKnownTrait) -> &'static str {
     match attr {
-        WellKnownTrait::Clone => "clone",
-        WellKnownTrait::CoerceUnsized => "coerce_unsized",
+        WellKnownTrait::Sized => "sized",
         WellKnownTrait::Copy => "copy",
-        WellKnownTrait::DiscriminantKind => "discriminant_kind",
-        WellKnownTrait::DispatchFromDyn => "dispatch_from_dyn",
+        WellKnownTrait::Clone => "clone",
         WellKnownTrait::Drop => "drop",
-        WellKnownTrait::Fn => "fn",
-        WellKnownTrait::FnMut => "fn_mut",
         WellKnownTrait::FnOnce => "fn_once",
-        WellKnownTrait::Generator => "generator",
-        WellKnownTrait::Sized => "sized",
-        WellKnownTrait::Unpin => "unpin",
+        WellKnownTrait::FnMut => "fn_mut",
+        WellKnownTrait::Fn => "fn",
         WellKnownTrait::Unsize => "unsize",
+        WellKnownTrait::Unpin => "unpin",
+        WellKnownTrait::CoerceUnsized => "coerce_unsized",
+        WellKnownTrait::DiscriminantKind => "discriminant_kind",
+        WellKnownTrait::Generator => "generator",
     }
 }
 
diff --git a/crates/ide/Cargo.toml b/crates/ide/Cargo.toml
index cd11b2801d..1df2942bdc 100644
--- a/crates/ide/Cargo.toml
+++ b/crates/ide/Cargo.toml
@@ -11,15 +11,15 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-crossbeam-channel = "0.5.4"
-either = "1.6.1"
-itertools = "0.10.3"
-tracing = "0.1.32"
+crossbeam-channel = "0.5.0"
+either = "1.5.3"
+itertools = "0.10.0"
+tracing = "0.1"
 rustc-hash = "1.1.0"
-oorandom = "11.1.3"
-pulldown-cmark-to-cmark = "10.0.1"
-pulldown-cmark = { version = "0.9.1", default-features = false }
-url = "2.2.2"
+oorandom = "11.1.2"
+pulldown-cmark-to-cmark = "10.0.0"
+pulldown-cmark = { version = "0.9", default-features = false }
+url = "2.1.1"
 dot = "0.1.4"
 
 stdx = { path = "../stdx", version = "0.0.0" }
@@ -39,4 +39,4 @@ hir = { path = "../hir", version = "0.0.0" }
 
 [dev-dependencies]
 test_utils = { path = "../test_utils" }
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
diff --git a/crates/ide_assists/Cargo.toml b/crates/ide_assists/Cargo.toml
index 4caa9285b4..09242e0aaf 100644
--- a/crates/ide_assists/Cargo.toml
+++ b/crates/ide_assists/Cargo.toml
@@ -12,7 +12,7 @@ doctest = false
 [dependencies]
 cov-mark = "2.0.0-pre.1"
 rustc-hash = "1.1.0"
-itertools = "0.10.3"
+itertools = "0.10.0"
 either = "1.6.1"
 
 stdx = { path = "../stdx", version = "0.0.0" }
@@ -25,4 +25,4 @@ hir = { path = "../hir", version = "0.0.0" }
 [dev-dependencies]
 test_utils = { path = "../test_utils" }
 sourcegen = { path = "../sourcegen" }
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
diff --git a/crates/ide_completion/Cargo.toml b/crates/ide_completion/Cargo.toml
index e088e3815a..5d8cad4389 100644
--- a/crates/ide_completion/Cargo.toml
+++ b/crates/ide_completion/Cargo.toml
@@ -11,11 +11,11 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-itertools = "0.10.3"
+itertools = "0.10.0"
 rustc-hash = "1.1.0"
 either = "1.6.1"
-once_cell = "1.10.0"
-smallvec = "1.8.0"
+once_cell = "1.7"
+smallvec = "1.4"
 
 stdx = { path = "../stdx", version = "0.0.0" }
 syntax = { path = "../syntax", version = "0.0.0" }
@@ -29,6 +29,6 @@ profile = { path = "../profile", version = "0.0.0" }
 hir = { path = "../hir", version = "0.0.0" }
 
 [dev-dependencies]
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
 
 test_utils = { path = "../test_utils" }
diff --git a/crates/ide_db/Cargo.toml b/crates/ide_db/Cargo.toml
index 8c4fe95de1..26b51739cf 100644
--- a/crates/ide_db/Cargo.toml
+++ b/crates/ide_db/Cargo.toml
@@ -11,15 +11,15 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-tracing = "0.1.32"
-rayon = "1.5.1"
-fst = { version = "0.4.7", default-features = false }
+tracing = "0.1"
+rayon = "1.5.0"
+fst = { version = "0.4", default-features = false }
 rustc-hash = "1.1.0"
-once_cell = "1.10.0"
+once_cell = "1.3.1"
 either = "1.6.1"
-itertools = "0.10.3"
-arrayvec = "0.7.2"
-indexmap = "1.8.0"
+itertools = "0.10.0"
+arrayvec = "0.7"
+indexmap = "1.7"
 
 stdx = { path = "../stdx", version = "0.0.0" }
 parser = { path = "../parser", version = "0.0.0" }
@@ -36,4 +36,4 @@ limit = { path = "../limit", version = "0.0.0" }
 test_utils = { path = "../test_utils" }
 sourcegen = { path = "../sourcegen" }
 xshell = "0.2.1"
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
diff --git a/crates/ide_db/src/imports/import_assets.rs b/crates/ide_db/src/imports/import_assets.rs
index 3963d4d79a..d6246c7ad6 100644
--- a/crates/ide_db/src/imports/import_assets.rs
+++ b/crates/ide_db/src/imports/import_assets.rs
@@ -639,6 +639,17 @@ fn path_import_candidate(
                     assoc_item_name: name,
                 })
             }
+            Some(PathResolution::Def(ModuleDef::TypeAlias(alias))) => {
+                let ty = alias.ty(sema.db);
+                if ty.as_adt().is_some() {
+                    ImportCandidate::TraitAssocItem(TraitImportCandidate {
+                        receiver_ty: ty,
+                        assoc_item_name: name,
+                    })
+                } else {
+                    return None;
+                }
+            }
             Some(_) => return None,
         },
         None => ImportCandidate::Path(PathImportCandidate { qualifier: None, name }),
diff --git a/crates/ide_diagnostics/Cargo.toml b/crates/ide_diagnostics/Cargo.toml
index 3d3eba3ba4..ba926c3719 100644
--- a/crates/ide_diagnostics/Cargo.toml
+++ b/crates/ide_diagnostics/Cargo.toml
@@ -11,9 +11,9 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-itertools = "0.10.3"
+itertools = "0.10.0"
 rustc-hash = "1.1.0"
-either = "1.6.1"
+either = "1.5.3"
 
 profile = { path = "../profile", version = "0.0.0" }
 stdx = { path = "../stdx", version = "0.0.0" }
@@ -24,7 +24,7 @@ hir = { path = "../hir", version = "0.0.0" }
 ide_db = { path = "../ide_db", version = "0.0.0" }
 
 [dev-dependencies]
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
 
 test_utils = { path = "../test_utils" }
 sourcegen = { path = "../sourcegen" }
diff --git a/crates/ide_ssr/Cargo.toml b/crates/ide_ssr/Cargo.toml
index 9135857c38..a725f7847c 100644
--- a/crates/ide_ssr/Cargo.toml
+++ b/crates/ide_ssr/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
 [dependencies]
 cov-mark = "2.0.0-pre.1"
 rustc-hash = "1.1.0"
-itertools = "0.10.3"
+itertools = "0.10.0"
 
 text_edit = { path = "../text_edit", version = "0.0.0" }
 parser = { path = "../parser", version = "0.0.0" }
@@ -23,4 +23,4 @@ hir = { path = "../hir", version = "0.0.0" }
 
 [dev-dependencies]
 test_utils = { path = "../test_utils" }
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
diff --git a/crates/mbe/Cargo.toml b/crates/mbe/Cargo.toml
index 1453ec4c69..c29c570bf5 100644
--- a/crates/mbe/Cargo.toml
+++ b/crates/mbe/Cargo.toml
@@ -12,8 +12,8 @@ doctest = false
 [dependencies]
 cov-mark = "2.0.0-pre.1"
 rustc-hash = "1.1.0"
-smallvec = "1.8.0"
-tracing = "0.1.32"
+smallvec = "1.2.0"
+tracing = "0.1"
 
 syntax = { path = "../syntax", version = "0.0.0" }
 parser = { path = "../parser", version = "0.0.0" }
diff --git a/crates/parser/Cargo.toml b/crates/parser/Cargo.toml
index 8105b536b7..0a5f923305 100644
--- a/crates/parser/Cargo.toml
+++ b/crates/parser/Cargo.toml
@@ -10,10 +10,11 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-drop_bomb = "0.1.5"
+drop_bomb = "0.1.4"
 rustc_lexer = { version = "725.0.0", package = "rustc-ap-rustc_lexer" }
 limit = { path = "../limit", version = "0.0.0" }
 
 [dev-dependencies]
-expect-test = "1.2.2"
+expect-test = "1.2"
 sourcegen = { path = "../sourcegen" }
+
diff --git a/crates/proc_macro_api/Cargo.toml b/crates/proc_macro_api/Cargo.toml
index 000c23dab6..fde5b80141 100644
--- a/crates/proc_macro_api/Cargo.toml
+++ b/crates/proc_macro_api/Cargo.toml
@@ -10,18 +10,18 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-object = { version = "0.28.3", default-features = false, features = [
+object = { version = "0.28", default-features = false, features = [
     "std",
     "read_core",
     "elf",
     "macho",
     "pe",
 ] }
-serde = { version = "1.0.136", features = ["derive"] }
-serde_json = { version = "1.0.79", features = ["unbounded_depth"] }
-tracing = "0.1.32"
-memmap2 = "0.5.3"
-snap = "1.0.5"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = { version = "1.0", features = ["unbounded_depth"] }
+tracing = "0.1"
+memmap2 = "0.5"
+snap = "1.0"
 
 paths = { path = "../paths", version = "0.0.0" }
 tt = { path = "../tt", version = "0.0.0" }
diff --git a/crates/proc_macro_srv/Cargo.toml b/crates/proc_macro_srv/Cargo.toml
index 381d241b86..28e759cd87 100644
--- a/crates/proc_macro_srv/Cargo.toml
+++ b/crates/proc_macro_srv/Cargo.toml
@@ -10,15 +10,15 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-object = { version = "0.28.3", default-features = false, features = [
+object = { version = "0.28", default-features = false, features = [
     "std",
     "read_core",
     "elf",
     "macho",
     "pe",
 ] }
-libloading = "0.7.3"
-memmap2 = "0.5.3"
+libloading = "0.7.0"
+memmap2 = "0.5"
 
 tt = { path = "../tt", version = "0.0.0" }
 mbe = { path = "../mbe", version = "0.0.0" }
@@ -26,7 +26,7 @@ paths = { path = "../paths", version = "0.0.0" }
 proc_macro_api = { path = "../proc_macro_api", version = "0.0.0" }
 
 [dev-dependencies]
-expect-test = "1.2.2"
+expect-test = "1.2.0-pre.1"
 
 # used as proc macro test targets
 proc_macro_test = { path = "../proc_macro_test" }
diff --git a/crates/profile/Cargo.toml b/crates/profile/Cargo.toml
index 8324f48de9..51eeea30d2 100644
--- a/crates/profile/Cargo.toml
+++ b/crates/profile/Cargo.toml
@@ -10,18 +10,18 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-once_cell = "1.10.0"
-cfg-if = "1.0.0"
-libc = "0.2.121"
+once_cell = "1.3.1"
+cfg-if = "1"
+libc = "0.2"
 la-arena = { version = "0.3.0", path = "../../lib/arena" }
-countme = { version = "3.0.1", features = ["enable"] }
-jemalloc-ctl = { version = "0.4.2", package = "tikv-jemalloc-ctl", optional = true }
+countme = { version = "3.0", features = ["enable"] }
+jemalloc-ctl = { version = "0.4.1", package = "tikv-jemalloc-ctl", optional = true }
 
 [target.'cfg(target_os = "linux")'.dependencies]
-perf-event = "0.4.7"
+perf-event = "0.4"
 
 [target.'cfg(windows)'.dependencies]
-winapi = { version = "0.3.9", features = ["processthreadsapi", "psapi"] }
+winapi = { version = "0.3.8", features = ["processthreadsapi", "psapi"] }
 
 [features]
 cpu_profiler = []
diff --git a/crates/project_model/Cargo.toml b/crates/project_model/Cargo.toml
index abb21586da..4932e7d012 100644
--- a/crates/project_model/Cargo.toml
+++ b/crates/project_model/Cargo.toml
@@ -10,14 +10,14 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-tracing = "0.1.32"
+tracing = "0.1"
 rustc-hash = "1.1.0"
-cargo_metadata = "0.14.2"
-semver = "1.0.6"
-serde = { version = "1.0.136", features = ["derive"] }
-serde_json = "1.0.79"
-anyhow = "1.0.56"
-expect-test = "1.2.2"
+cargo_metadata = "0.14"
+semver = "1"
+serde = { version = "1.0.106", features = ["derive"] }
+serde_json = "1.0.48"
+anyhow = "1.0.26"
+expect-test = "1.2.0-pre.1"
 la-arena = { version = "0.3.0", path = "../../lib/arena" }
 
 cfg = { path = "../cfg", version = "0.0.0" }
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 87b4203e51..079e56c9fa 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -18,32 +18,32 @@ name = "rust-analyzer"
 path = "src/bin/main.rs"
 
 [dependencies]
-anyhow = "1.0.56"
-crossbeam-channel = "0.5.4"
-dissimilar = "1.0.3"
-itertools = "0.10.3"
-lsp-types = { version = "0.92.1", features = ["proposed"] }
-parking_lot = "0.12.0"
-xflags = "0.2.4"
-oorandom = "11.1.3"
+anyhow = "1.0.26"
+crossbeam-channel = "0.5.0"
+dissimilar = "1.0.2"
+itertools = "0.10.0"
+lsp-types = { version = "0.92", features = ["proposed"] }
+parking_lot = "0.12"
+xflags = "0.2.1"
+oorandom = "11.1.2"
 rustc-hash = "1.1.0"
-serde = { version = "1.0.136", features = ["derive"] }
-serde_json = { version = "1.0.79", features = ["preserve_order"] }
-threadpool = "1.8.1"
-rayon = "1.5.1"
+serde = { version = "1.0.106", features = ["derive"] }
+serde_json = { version = "1.0.48", features = ["preserve_order"] }
+threadpool = "1.7.1"
+rayon = "1.5"
 num_cpus = "1.13.1"
-mimalloc = { version = "0.1.28", default-features = false, optional = true }
-lsp-server = "0.5.2"
-tracing = "0.1.32"
-tracing-subscriber = { version = "0.3.9", default-features = false, features = [
+mimalloc = { version = "0.1.19", default-features = false, optional = true }
+lsp-server = "0.5.1"
+tracing = "0.1"
+tracing-subscriber = { version = "0.3", default-features = false, features = [
     "env-filter",
     "registry",
     "fmt",
     "tracing-log",
 ] }
 tracing-log = "0.1.2"
-tracing-tree = "0.2.0"
-always-assert = "0.1.2"
+tracing-tree = "0.2"
+always-assert = "0.1"
 
 stdx = { path = "../stdx", version = "0.0.0" }
 flycheck = { path = "../flycheck", version = "0.0.0" }
@@ -67,14 +67,14 @@ hir_ty = { path = "../hir_ty", version = "0.0.0" }
 proc_macro_srv = { path = "../proc_macro_srv", version = "0.0.0" }
 
 [target.'cfg(windows)'.dependencies]
-winapi = "0.3.9"
+winapi = "0.3.8"
 
 [target.'cfg(not(target_env = "msvc"))'.dependencies]
-jemallocator = { version = "0.4.3", package = "tikv-jemallocator", optional = true }
+jemallocator = { version = "0.4.1", package = "tikv-jemallocator", optional = true }
 
 [dev-dependencies]
-expect-test = "1.2.2"
-jod-thread = "0.1.2"
+expect-test = "1.2.0-pre.1"
+jod-thread = "0.1.0"
 xshell = "0.2.1"
 
 test_utils = { path = "../test_utils" }
diff --git a/crates/rust-analyzer/src/caps.rs b/crates/rust-analyzer/src/caps.rs
index 8c19f584f0..d83af2a48a 100644
--- a/crates/rust-analyzer/src/caps.rs
+++ b/crates/rust-analyzer/src/caps.rs
@@ -112,7 +112,6 @@ pub fn server_capabilities(config: &Config) -> ServerCapabilities {
             .into(),
         ),
         moniker_provider: None,
-        inlay_hint_provider: None,
         experimental: Some(json!({
             "externalDocs": true,
             "hoverRange": true,
diff --git a/crates/stdx/Cargo.toml b/crates/stdx/Cargo.toml
index d3dfdf7eb6..bfce91b1d3 100644
--- a/crates/stdx/Cargo.toml
+++ b/crates/stdx/Cargo.toml
@@ -10,8 +10,8 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-libc = "0.2.121"
-backtrace = { version = "0.3.64", optional = true }
+libc = "0.2"
+backtrace = { version = "0.3.44", optional = true }
 always-assert = { version = "0.1.2", features = ["log"] }
 # Think twice before adding anything here
 
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index 4a454cb8b7..d8f8290745 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -12,12 +12,12 @@ doctest = false
 
 [dependencies]
 cov-mark = "2.0.0-pre.1"
-itertools = "0.10.3"
-rowan = "0.15.4"
+itertools = "0.10.0"
+rowan = "0.15.0"
 rustc_lexer = { version = "725.0.0", package = "rustc-ap-rustc_lexer" }
 rustc-hash = "1.1.0"
-once_cell = "1.10.0"
-indexmap = "1.8.0"
+once_cell = "1.3.1"
+indexmap = "1.7.0"
 smol_str = "0.1.21"
 
 stdx = { path = "../stdx", version = "0.0.0" }
@@ -26,10 +26,10 @@ parser = { path = "../parser", version = "0.0.0" }
 profile = { path = "../profile", version = "0.0.0" }
 
 [dev-dependencies]
-rayon = "1.5.1"
-expect-test = "1.2.2"
-proc-macro2 = "1.0.36"
-quote = "1.0.16"
+rayon = "1"
+expect-test = "1.2.0-pre.1"
+proc-macro2 = "1.0.8"
+quote = "1.0.2"
 ungrammar = "=1.16.1"
 
 test_utils = { path = "../test_utils" }
diff --git a/crates/text_edit/Cargo.toml b/crates/text_edit/Cargo.toml
index fde19f1363..dae69e265d 100644
--- a/crates/text_edit/Cargo.toml
+++ b/crates/text_edit/Cargo.toml
@@ -10,5 +10,5 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-itertools = "0.10.3"
-text-size = "1.1.0"
+itertools = "0.10.0"
+text-size = "1.0.0"
diff --git a/crates/tt/Cargo.toml b/crates/tt/Cargo.toml
index f97c59ea53..3fb39355fe 100644
--- a/crates/tt/Cargo.toml
+++ b/crates/tt/Cargo.toml
@@ -10,6 +10,6 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-smol_str = "0.1.21"
+smol_str = "0.1"
 
 stdx = { path = "../stdx", version = "0.0.0" }
diff --git a/crates/vfs-notify/Cargo.toml b/crates/vfs-notify/Cargo.toml
index a13a85f92f..10addab1e4 100644
--- a/crates/vfs-notify/Cargo.toml
+++ b/crates/vfs-notify/Cargo.toml
@@ -10,10 +10,10 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-tracing = "0.1.32"
-jod-thread = "0.1.2"
-walkdir = "2.3.2"
-crossbeam-channel = "0.5.4"
+tracing = "0.1"
+jod-thread = "0.1.0"
+walkdir = "2.3.1"
+crossbeam-channel = "0.5.0"
 notify = "=5.0.0-pre.14"
 
 vfs = { path = "../vfs", version = "0.0.0" }
diff --git a/crates/vfs/Cargo.toml b/crates/vfs/Cargo.toml
index a690535bea..24f380e25f 100644
--- a/crates/vfs/Cargo.toml
+++ b/crates/vfs/Cargo.toml
@@ -10,8 +10,8 @@ rust-version = "1.57"
 doctest = false
 
 [dependencies]
-rustc-hash = "1.1.0"
-fst = "0.4.7"
+rustc-hash = "1.0"
+fst = "0.4"
 
 paths = { path = "../paths", version = "0.0.0" }
-indexmap = "1.8.0"
+indexmap = "1.7"
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml
index 417a58556b..de6a102427 100644
--- a/xtask/Cargo.toml
+++ b/xtask/Cargo.toml
@@ -7,9 +7,9 @@ edition = "2021"
 rust-version = "1.57"
 
 [dependencies]
-anyhow = "1.0.56"
-flate2 = "1.0.22"
-write-json = "0.1.2"
+anyhow = "1.0.26"
+flate2 = "1.0"
+write-json = "0.1.0"
 xshell = "0.2.1"
-xflags = "0.2.4"
+xflags = "0.2.1"
 # Avoid adding more dependencies to this crate


Test patch:
diff --git a/crates/ide_completion/src/tests/flyimport.rs b/crates/ide_completion/src/tests/flyimport.rs
index 4a0fcf3442..b47a710006 100644
--- a/crates/ide_completion/src/tests/flyimport.rs
+++ b/crates/ide_completion/src/tests/flyimport.rs
@@ -297,6 +297,47 @@ fn main() {
     );
 }
 
+#[test]
+fn trait_method_from_alias() {
+    let fixture = r#"
+//- /lib.rs crate:dep
+pub mod test_mod {
+    pub trait TestTrait {
+        fn random_method();
+    }
+    pub struct TestStruct {}
+    impl TestTrait for TestStruct {
+        fn random_method() {}
+    }
+    pub type TestAlias = TestStruct;
+}
+
+//- /main.rs crate:main deps:dep
+fn main() {
+    dep::test_mod::TestAlias::ran$0
+}
+"#;
+
+    check(
+        fixture,
+        expect![[r#"
+                fn random_method() (use dep::test_mod::TestTrait) fn()
+            "#]],
+    );
+
+    check_edit(
+        "random_method",
+        fixture,
+        r#"
+use dep::test_mod::TestTrait;
+
+fn main() {
+    dep::test_mod::TestAlias::random_method()$0
+}
+"#,
+    );
+}
+
 #[test]
 fn no_trait_type_fuzzy_completion() {
     check(
diff --git a/crates/proc_macro_test/Cargo.toml b/crates/proc_macro_test/Cargo.toml
index d0ddbd6d59..85c6de390a 100644
--- a/crates/proc_macro_test/Cargo.toml
+++ b/crates/proc_macro_test/Cargo.toml
@@ -12,4 +12,4 @@ doctest = false
 [build-dependencies]
 proc_macro_test_impl = { path = "imp", version = "0.0.0" }
 toolchain = { path = "../toolchain", version = "0.0.0" }
-cargo_metadata = "0.14.2"
+cargo_metadata = "0.14"
diff --git a/crates/test_utils/Cargo.toml b/crates/test_utils/Cargo.toml
index e8a8ef04b4..36293155f2 100644
--- a/crates/test_utils/Cargo.toml
+++ b/crates/test_utils/Cargo.toml
@@ -11,8 +11,8 @@ doctest = false
 
 [dependencies]
 # Avoid adding deps here, this crate is widely used in tests it should compile fast!
-dissimilar = "1.0.3"
-text-size = "1.1.0"
+dissimilar = "1.0.2"
+text-size = "1.0.0"
 rustc-hash = "1.1.0"
 
 stdx = { path = "../stdx", version = "0.0.0" }