Repository: rust-analyzer/rust-analyzer
Pull request #5748 (2020-08-13 15:03:41)

Rename ra_ssr -> ssr

bors r+
🤖


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 702bd5191d..4d8b748392 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -463,6 +463,24 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "hir"
+version = "0.0.0"
+dependencies = [
+ "arrayvec",
+ "base_db",
+ "either",
+ "hir_def",
+ "hir_expand",
+ "hir_ty",
+ "itertools",
+ "log",
+ "profile",
+ "rustc-hash",
+ "stdx",
+ "syntax",
+]
+
 [[package]]
 name = "hir_def"
 version = "0.0.0"
@@ -507,6 +525,34 @@ dependencies = [
  "tt",
 ]
 
+[[package]]
+name = "hir_ty"
+version = "0.0.0"
+dependencies = [
+ "arena",
+ "arrayvec",
+ "base_db",
+ "chalk-ir",
+ "chalk-recursive",
+ "chalk-solve",
+ "ena",
+ "expect",
+ "hir_def",
+ "hir_expand",
+ "itertools",
+ "log",
+ "profile",
+ "rustc-hash",
+ "scoped-tls",
+ "smallvec",
+ "stdx",
+ "syntax",
+ "test_utils",
+ "tracing",
+ "tracing-subscriber",
+ "tracing-tree",
+]
+
 [[package]]
 name = "home"
 version = "0.5.3"
@@ -516,6 +562,25 @@ dependencies = [
  "winapi 0.3.9",
 ]
 
+[[package]]
+name = "ide_db"
+version = "0.0.0"
+dependencies = [
+ "base_db",
+ "either",
+ "fst",
+ "hir",
+ "log",
+ "once_cell",
+ "profile",
+ "rayon",
+ "rustc-hash",
+ "stdx",
+ "syntax",
+ "test_utils",
+ "text_edit",
+]
+
 [[package]]
 name = "idna"
 version = "0.2.0"
@@ -1043,10 +1108,10 @@ version = "0.1.0"
 dependencies = [
  "base_db",
  "either",
+ "hir",
+ "ide_db",
  "itertools",
  "profile",
- "ra_hir",
- "ra_ide_db",
  "rustc-hash",
  "stdx",
  "syntax",
@@ -1054,52 +1119,6 @@ dependencies = [
  "text_edit",
 ]
 
-[[package]]
-name = "ra_hir"
-version = "0.1.0"
-dependencies = [
- "arrayvec",
- "base_db",
- "either",
- "hir_def",
- "hir_expand",
- "itertools",
- "log",
- "profile",
- "ra_hir_ty",
- "rustc-hash",
- "stdx",
- "syntax",
-]
-
-[[package]]
-name = "ra_hir_ty"
-version = "0.1.0"
-dependencies = [
- "arena",
- "arrayvec",
- "base_db",
- "chalk-ir",
- "chalk-recursive",
- "chalk-solve",
- "ena",
- "expect",
- "hir_def",
- "hir_expand",
- "itertools",
- "log",
- "profile",
- "rustc-hash",
- "scoped-tls",
- "smallvec",
- "stdx",
- "syntax",
- "test_utils",
- "tracing",
- "tracing-subscriber",
- "tracing-tree",
-]
-
 [[package]]
 name = "ra_ide"
 version = "0.1.0"
@@ -1108,55 +1127,22 @@ dependencies = [
  "cfg",
  "either",
  "expect",
+ "hir",
+ "ide_db",
  "indexmap",
  "itertools",
  "log",
  "oorandom",
  "profile",
  "ra_assists",
- "ra_hir",
- "ra_ide_db",
- "ra_ssr",
  "rustc-hash",
+ "ssr",
  "stdx",
  "syntax",
  "test_utils",
  "text_edit",
 ]
 
-[[package]]
-name = "ra_ide_db"
-version = "0.1.0"
-dependencies = [
- "base_db",
- "either",
- "fst",
- "log",
- "once_cell",
- "profile",
- "ra_hir",
- "rayon",
- "rustc-hash",
- "stdx",
- "syntax",
- "test_utils",
- "text_edit",
-]
-
-[[package]]
-name = "ra_ssr"
-version = "0.1.0"
-dependencies = [
- "base_db",
- "expect",
- "ra_hir",
- "ra_ide_db",
- "rustc-hash",
- "syntax",
- "test_utils",
- "text_edit",
-]
-
 [[package]]
 name = "rayon"
 version = "1.3.1"
@@ -1236,7 +1222,10 @@ dependencies = [
  "env_logger",
  "expect",
  "flycheck",
+ "hir",
  "hir_def",
+ "hir_ty",
+ "ide_db",
  "itertools",
  "jod-thread",
  "log",
@@ -1250,15 +1239,12 @@ dependencies = [
  "proc_macro_srv",
  "profile",
  "project_model",
- "ra_hir",
- "ra_hir_ty",
  "ra_ide",
- "ra_ide_db",
- "ra_ssr",
  "rayon",
  "rustc-hash",
  "serde",
  "serde_json",
+ "ssr",
  "stdx",
  "syntax",
  "test_utils",
@@ -1456,6 +1442,20 @@ dependencies = [
  "serde",
 ]
 
+[[package]]
+name = "ssr"
+version = "0.1.0"
+dependencies = [
+ "base_db",
+ "expect",
+ "hir",
+ "ide_db",
+ "rustc-hash",
+ "syntax",
+ "test_utils",
+ "text_edit",
+]
+
 [[package]]
 name = "stdx"
 version = "0.1.0"
diff --git a/crates/ra_hir/Cargo.toml b/crates/hir/Cargo.toml
similarity index 82%
rename from crates/ra_hir/Cargo.toml
rename to crates/hir/Cargo.toml
index edca5dc6f8..dbb2986b60 100644
--- a/crates/ra_hir/Cargo.toml
+++ b/crates/hir/Cargo.toml
@@ -1,9 +1,9 @@
 [package]
-edition = "2018"
-name = "ra_hir"
-version = "0.1.0"
-authors = ["rust-analyzer developers"]
+name = "hir"
+version = "0.0.0"
 license = "MIT OR Apache-2.0"
+authors = ["rust-analyzer developers"]
+edition = "2018"
 
 [lib]
 doctest = false
@@ -13,7 +13,6 @@ log = "0.4.8"
 rustc-hash = "1.1.0"
 either = "1.5.3"
 arrayvec = "0.5.1"
-
 itertools = "0.9.0"
 
 stdx = { path = "../stdx" }
@@ -22,4 +21,4 @@ base_db = { path = "../base_db" }
 profile = { path = "../profile" }
 hir_expand = { path = "../hir_expand" }
 hir_def = { path = "../hir_def" }
-hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" }
+hir_ty = { path = "../hir_ty" }
diff --git a/crates/ra_hir/src/code_model.rs b/crates/hir/src/code_model.rs
similarity index 100%
rename from crates/ra_hir/src/code_model.rs
rename to crates/hir/src/code_model.rs
diff --git a/crates/ra_hir/src/db.rs b/crates/hir/src/db.rs
similarity index 100%
rename from crates/ra_hir/src/db.rs
rename to crates/hir/src/db.rs
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
similarity index 100%
rename from crates/ra_hir/src/diagnostics.rs
rename to crates/hir/src/diagnostics.rs
diff --git a/crates/ra_hir/src/from_id.rs b/crates/hir/src/from_id.rs
similarity index 100%
rename from crates/ra_hir/src/from_id.rs
rename to crates/hir/src/from_id.rs
diff --git a/crates/ra_hir/src/has_source.rs b/crates/hir/src/has_source.rs
similarity index 100%
rename from crates/ra_hir/src/has_source.rs
rename to crates/hir/src/has_source.rs
diff --git a/crates/ra_hir/src/lib.rs b/crates/hir/src/lib.rs
similarity index 92%
rename from crates/ra_hir/src/lib.rs
rename to crates/hir/src/lib.rs
index 34b02c5365..24a0f6b4b1 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -9,11 +9,11 @@
 //! It is written in "OO" style. Each type is self contained (as in, it knows it's
 //! parents and full context). It should be "clean code".
 //!
-//! `ra_hir_*` crates are the implementation of the compiler logic.
+//! `hir_*` crates are the implementation of the compiler logic.
 //! They are written in "ECS" style, with relatively little abstractions.
 //! Many types are not self-contained, and explicitly use local indexes, arenas, etc.
 //!
-//! `ra_hir` is what insulates the "we don't know how to actually write an incremental compiler"
+//! `hir` is what insulates the "we don't know how to actually write an incremental compiler"
 //! from the ide with completions, hovers, etc. It is a (soft, internal) boundary:
 //! https://www.tedinski.com/2018/02/06/system-boundaries.html.
 
diff --git a/crates/ra_hir/src/semantics.rs b/crates/hir/src/semantics.rs
similarity index 100%
rename from crates/ra_hir/src/semantics.rs
rename to crates/hir/src/semantics.rs
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs
similarity index 100%
rename from crates/ra_hir/src/semantics/source_to_def.rs
rename to crates/hir/src/semantics/source_to_def.rs
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
similarity index 100%
rename from crates/ra_hir/src/source_analyzer.rs
rename to crates/hir/src/source_analyzer.rs
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml
similarity index 95%
rename from crates/ra_hir_ty/Cargo.toml
rename to crates/hir_ty/Cargo.toml
index d430b08ca7..83b5013a90 100644
--- a/crates/ra_hir_ty/Cargo.toml
+++ b/crates/hir_ty/Cargo.toml
@@ -1,9 +1,9 @@
 [package]
-edition = "2018"
-name = "ra_hir_ty"
-version = "0.1.0"
-authors = ["rust-analyzer developers"]
+name = "hir_ty"
+version = "0.0.0"
 license = "MIT OR Apache-2.0"
+authors = ["rust-analyzer developers"]
+edition = "2018"
 
 [lib]
 doctest = false
@@ -15,9 +15,12 @@ smallvec = "1.2.0"
 ena = "0.14.0"
 log = "0.4.8"
 rustc-hash = "1.1.0"
+scoped-tls = "1"
+chalk-solve = { version = "0.21.0" }
+chalk-ir = { version = "0.21.0" }
+chalk-recursive = { version = "0.21.0" }
 
 stdx = { path = "../stdx" }
-
 hir_def = { path = "../hir_def" }
 hir_expand = { path = "../hir_expand" }
 arena = { path = "../arena" }
@@ -26,15 +29,9 @@ profile = { path = "../profile" }
 syntax = { path = "../syntax" }
 test_utils = { path = "../test_utils" }
 
-scoped-tls = "1"
-
-chalk-solve = { version = "0.21.0" }
-chalk-ir = { version = "0.21.0" }
-chalk-recursive = { version = "0.21.0" }
-
 [dev-dependencies]
-expect = { path = "../expect" }
-
 tracing = "0.1"
 tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry"] }
 tracing-tree = { version = "0.1.4" }
+
+expect = { path = "../expect" }
diff --git a/crates/ra_hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/coercion.rs
rename to crates/hir_ty/src/tests/coercion.rs
diff --git a/crates/ra_hir_ty/src/tests/display_source_code.rs b/crates/hir_ty/src/tests/display_source_code.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/display_source_code.rs
rename to crates/hir_ty/src/tests/display_source_code.rs
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/macros.rs
rename to crates/hir_ty/src/tests/macros.rs
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/method_resolution.rs
rename to crates/hir_ty/src/tests/method_resolution.rs
diff --git a/crates/ra_hir_ty/src/tests/never_type.rs b/crates/hir_ty/src/tests/never_type.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/never_type.rs
rename to crates/hir_ty/src/tests/never_type.rs
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/patterns.rs
rename to crates/hir_ty/src/tests/patterns.rs
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/regression.rs
rename to crates/hir_ty/src/tests/regression.rs
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/simple.rs
rename to crates/hir_ty/src/tests/simple.rs
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs
similarity index 100%
rename from crates/ra_hir_ty/src/tests/traits.rs
rename to crates/hir_ty/src/tests/traits.rs
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/hir_ty/src/traits.rs
similarity index 100%
rename from crates/ra_hir_ty/src/traits.rs
rename to crates/hir_ty/src/traits.rs
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs
similarity index 100%
rename from crates/ra_hir_ty/src/traits/chalk.rs
rename to crates/hir_ty/src/traits/chalk.rs
diff --git a/crates/ra_hir_ty/src/traits/chalk/interner.rs b/crates/hir_ty/src/traits/chalk/interner.rs
similarity index 100%
rename from crates/ra_hir_ty/src/traits/chalk/interner.rs
rename to crates/hir_ty/src/traits/chalk/interner.rs
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs
similarity index 100%
rename from crates/ra_hir_ty/src/traits/chalk/mapping.rs
rename to crates/hir_ty/src/traits/chalk/mapping.rs
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/hir_ty/src/traits/chalk/tls.rs
similarity index 100%
rename from crates/ra_hir_ty/src/traits/chalk/tls.rs
rename to crates/hir_ty/src/traits/chalk/tls.rs
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs
similarity index 100%
rename from crates/ra_hir_ty/src/utils.rs
rename to crates/hir_ty/src/utils.rs
diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ide_db/Cargo.toml
similarity index 88%
rename from crates/ra_ide_db/Cargo.toml
rename to crates/ide_db/Cargo.toml
index 0cda7090d3..885212162f 100644
--- a/crates/ra_ide_db/Cargo.toml
+++ b/crates/ide_db/Cargo.toml
@@ -1,9 +1,9 @@
 [package]
-edition = "2018"
-name = "ra_ide_db"
-version = "0.1.0"
-authors = ["rust-analyzer developers"]
+name = "ide_db"
+version = "0.0.0"
 license = "MIT OR Apache-2.0"
+authors = ["rust-analyzer developers"]
+edition = "2018"
 
 [lib]
 doctest = false
@@ -20,13 +20,11 @@ once_cell = "1.3.1"
 either = "1.5.3"
 
 stdx = { path = "../stdx" }
-
 syntax = { path = "../syntax" }
 text_edit = { path = "../text_edit" }
 base_db = { path = "../base_db" }
 profile = { path = "../profile" }
 test_utils = { path = "../test_utils" }
-
 # ra_ide should depend only on the top-level `hir` package. if you need
 # something from some `hir_xxx` subpackage, reexport the API via `hir`.
-hir = { path = "../ra_hir", package = "ra_hir" }
+hir = { path = "../hir" }
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ide_db/src/change.rs
similarity index 100%
rename from crates/ra_ide_db/src/change.rs
rename to crates/ide_db/src/change.rs
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ide_db/src/defs.rs
similarity index 100%
rename from crates/ra_ide_db/src/defs.rs
rename to crates/ide_db/src/defs.rs
diff --git a/crates/ra_ide_db/src/imports_locator.rs b/crates/ide_db/src/imports_locator.rs
similarity index 100%
rename from crates/ra_ide_db/src/imports_locator.rs
rename to crates/ide_db/src/imports_locator.rs
diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ide_db/src/lib.rs
similarity index 100%
rename from crates/ra_ide_db/src/lib.rs
rename to crates/ide_db/src/lib.rs
diff --git a/crates/ra_ide_db/src/line_index.rs b/crates/ide_db/src/line_index.rs
similarity index 100%
rename from crates/ra_ide_db/src/line_index.rs
rename to crates/ide_db/src/line_index.rs
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ide_db/src/search.rs
similarity index 100%
rename from crates/ra_ide_db/src/search.rs
rename to crates/ide_db/src/search.rs
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ide_db/src/source_change.rs
similarity index 100%
rename from crates/ra_ide_db/src/source_change.rs
rename to crates/ide_db/src/source_change.rs
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ide_db/src/symbol_index.rs
similarity index 100%
rename from crates/ra_ide_db/src/symbol_index.rs
rename to crates/ide_db/src/symbol_index.rs
diff --git a/crates/ra_ide_db/src/wasm_shims.rs b/crates/ide_db/src/wasm_shims.rs
similarity index 100%
rename from crates/ra_ide_db/src/wasm_shims.rs
rename to crates/ide_db/src/wasm_shims.rs
diff --git a/crates/ra_assists/Cargo.toml b/crates/ra_assists/Cargo.toml
index ebac09be62..19e7591f71 100644
--- a/crates/ra_assists/Cargo.toml
+++ b/crates/ra_assists/Cargo.toml
@@ -19,6 +19,6 @@ syntax = { path = "../syntax" }
 text_edit = { path = "../text_edit" }
 profile = { path = "../profile" }
 base_db = { path = "../base_db" }
-ra_ide_db = { path = "../ra_ide_db" }
-hir = { path = "../ra_hir", package = "ra_hir" }
+ide_db = { path = "../ide_db" }
+hir = { path = "../hir" }
 test_utils = { path = "../test_utils" }
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs
index 2fdce037fb..79574b9ac8 100644
--- a/crates/ra_assists/src/assist_context.rs
+++ b/crates/ra_assists/src/assist_context.rs
@@ -5,7 +5,7 @@ use std::mem;
 use algo::find_covering_element;
 use base_db::{FileId, FileRange};
 use hir::Semantics;
-use ra_ide_db::{
+use ide_db::{
     source_change::{SourceChange, SourceFileEdit},
     RootDatabase,
 };
diff --git a/crates/ra_assists/src/handlers/add_turbo_fish.rs b/crates/ra_assists/src/handlers/add_turbo_fish.rs
index 8c7ffae3dd..f4f997d8e1 100644
--- a/crates/ra_assists/src/handlers/add_turbo_fish.rs
+++ b/crates/ra_assists/src/handlers/add_turbo_fish.rs
@@ -1,4 +1,4 @@
-use ra_ide_db::defs::{classify_name_ref, Definition, NameRefClass};
+use ide_db::defs::{classify_name_ref, Definition, NameRefClass};
 use syntax::{ast, AstNode, SyntaxKind, T};
 use test_utils::mark;
 
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs
index e19b197d9e..cce789972e 100644
--- a/crates/ra_assists/src/handlers/auto_import.rs
+++ b/crates/ra_assists/src/handlers/auto_import.rs
@@ -5,7 +5,7 @@ use hir::{
     AsAssocItem, AssocItemContainer, ModPath, Module, ModuleDef, PathResolution, Semantics, Trait,
     Type,
 };
-use ra_ide_db::{imports_locator, RootDatabase};
+use ide_db::{imports_locator, RootDatabase};
 use rustc_hash::FxHashSet;
 use syntax::{
     ast::{self, AstNode},
diff --git a/crates/ra_assists/src/handlers/expand_glob_import.rs b/crates/ra_assists/src/handlers/expand_glob_import.rs
index cf34ffaf7f..f690ec343b 100644
--- a/crates/ra_assists/src/handlers/expand_glob_import.rs
+++ b/crates/ra_assists/src/handlers/expand_glob_import.rs
@@ -1,5 +1,5 @@
 use hir::{AssocItem, MacroDef, ModuleDef, Name, PathResolution, ScopeDef, SemanticsScope};
-use ra_ide_db::{
+use ide_db::{
     defs::{classify_name_ref, Definition, NameRefClass},
     RootDatabase,
 };
diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
index 52fbc540eb..4bcdae7ba0 100644
--- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -1,6 +1,6 @@
 use base_db::FileId;
 use hir::{EnumVariant, Module, ModuleDef, Name};
-use ra_ide_db::{defs::Definition, search::Reference, RootDatabase};
+use ide_db::{defs::Definition, search::Reference, RootDatabase};
 use rustc_hash::FxHashSet;
 use syntax::{
     algo::find_node_at_offset,
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs
index 8f66606372..3d9bdb2bf7 100644
--- a/crates/ra_assists/src/handlers/fill_match_arms.rs
+++ b/crates/ra_assists/src/handlers/fill_match_arms.rs
@@ -1,8 +1,8 @@
 use std::iter;
 
 use hir::{Adt, HasSource, ModuleDef, Semantics};
+use ide_db::RootDatabase;
 use itertools::Itertools;
-use ra_ide_db::RootDatabase;
 use syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat};
 use test_utils::mark;
 
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
index 302b6b67d4..7f04b95725 100644
--- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
+++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
@@ -1,4 +1,4 @@
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::ast::{self, AstNode, NameOwner};
 use test_utils::mark;
 
diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs
index 5315923206..2b52b333b8 100644
--- a/crates/ra_assists/src/handlers/inline_local_variable.rs
+++ b/crates/ra_assists/src/handlers/inline_local_variable.rs
@@ -1,4 +1,4 @@
-use ra_ide_db::defs::Definition;
+use ide_db::defs::Definition;
 use syntax::{
     ast::{self, AstNode, AstToken},
     TextRange,
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs
index 013720dfcb..527f457a79 100644
--- a/crates/ra_assists/src/handlers/reorder_fields.rs
+++ b/crates/ra_assists/src/handlers/reorder_fields.rs
@@ -2,7 +2,7 @@ use itertools::Itertools;
 use rustc_hash::FxHashMap;
 
 use hir::{Adt, ModuleDef, PathResolution, Semantics, Struct};
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{algo, ast, match_ast, AstNode, SyntaxKind, SyntaxKind::*, SyntaxNode};
 
 use crate::{AssistContext, AssistId, AssistKind, Assists};
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 5d062b88b8..f0cf35caf4 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -19,7 +19,7 @@ pub mod ast_transform;
 
 use base_db::FileRange;
 use hir::Semantics;
-use ra_ide_db::{source_change::SourceChange, RootDatabase};
+use ide_db::{source_change::SourceChange, RootDatabase};
 use syntax::TextRange;
 
 pub(crate) use crate::assist_context::{AssistContext, Assists};
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs
index a20453dd87..84ccacafe3 100644
--- a/crates/ra_assists/src/utils.rs
+++ b/crates/ra_assists/src/utils.rs
@@ -4,8 +4,8 @@ pub(crate) mod insert_use;
 use std::{iter, ops};
 
 use hir::{Adt, Crate, Enum, ScopeDef, Semantics, Trait, Type};
+use ide_db::RootDatabase;
 use itertools::Itertools;
-use ra_ide_db::RootDatabase;
 use rustc_hash::FxHashSet;
 use syntax::{
     ast::{self, make, NameOwner},
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml
index 1af51f3ae8..8519e9ccae 100644
--- a/crates/ra_ide/Cargo.toml
+++ b/crates/ra_ide/Cargo.toml
@@ -24,16 +24,16 @@ stdx = { path = "../stdx" }
 syntax = { path = "../syntax" }
 text_edit = { path = "../text_edit" }
 base_db = { path = "../base_db" }
-ra_ide_db = { path = "../ra_ide_db" }
+ide_db = { path = "../ide_db" }
 cfg = { path = "../cfg" }
 profile = { path = "../profile" }
 test_utils = { path = "../test_utils" }
 ra_assists = { path = "../ra_assists" }
-ra_ssr = { path = "../ra_ssr" }
+ssr = { path = "../ssr" }
 
 # ra_ide should depend only on the top-level `hir` package. if you need
 # something from some `hir_xxx` subpackage, reexport the API via `hir`.
-hir = { path = "../ra_hir", package = "ra_hir" }
+hir = { path = "../hir" }
 
 [dev-dependencies]
 expect = { path = "../expect" }
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs
index 3578b8d3ce..58e26b94ca 100644
--- a/crates/ra_ide/src/call_hierarchy.rs
+++ b/crates/ra_ide/src/call_hierarchy.rs
@@ -3,7 +3,7 @@
 use indexmap::IndexMap;
 
 use hir::Semantics;
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{ast, match_ast, AstNode, TextRange};
 
 use crate::{
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs
index 703cbc6b43..86abd2d8ce 100644
--- a/crates/ra_ide/src/call_info.rs
+++ b/crates/ra_ide/src/call_info.rs
@@ -1,7 +1,7 @@
 //! FIXME: write short doc here
 use either::Either;
 use hir::{Docs, HirDisplay, Semantics, Type};
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use stdx::format_to;
 use syntax::{
     ast::{self, ArgListOwner},
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs
index 68ac05e4ca..7fb4d687e1 100644
--- a/crates/ra_ide/src/completion.rs
+++ b/crates/ra_ide/src/completion.rs
@@ -19,7 +19,7 @@ mod complete_postfix;
 mod complete_macro_in_item_position;
 mod complete_trait_impl;
 
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 
 use crate::{
     completion::{
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 0e0a201d09..047ecd9d77 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -2,7 +2,7 @@
 
 use base_db::SourceDatabase;
 use hir::{Semantics, SemanticsScope, Type};
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{
     algo::{find_covering_element, find_node_at_offset},
     ast, match_ast, AstNode, NodeOrToken,
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index 4e59e3a480..a3ec98178a 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -8,8 +8,8 @@ use std::cell::RefCell;
 
 use base_db::SourceDatabase;
 use hir::{diagnostics::DiagnosticSinkBuilder, Semantics};
+use ide_db::RootDatabase;
 use itertools::Itertools;
-use ra_ide_db::RootDatabase;
 use syntax::{
     ast::{self, AstNode},
     SyntaxNode, TextRange, T,
diff --git a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs
index 7e126d7a6a..85b46c9958 100644
--- a/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs
+++ b/crates/ra_ide/src/diagnostics/diagnostics_with_fix.rs
@@ -8,7 +8,7 @@ use hir::{
     diagnostics::{Diagnostic, MissingFields, MissingOkInTailExpr, NoSuchField, UnresolvedModule},
     HasSource, HirDisplay, Semantics, VariantDef,
 };
-use ra_ide_db::{
+use ide_db::{
     source_change::{FileSystemEdit, SourceFileEdit},
     RootDatabase,
 };
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index 09ec3f65e6..e771061772 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -3,7 +3,7 @@
 use base_db::{FileId, SourceDatabase};
 use either::Either;
 use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource};
-use ra_ide_db::{defs::Definition, RootDatabase};
+use ide_db::{defs::Definition, RootDatabase};
 use syntax::{
     ast::{self, DocCommentsOwner, NameOwner},
     match_ast, AstNode, SmolStr,
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs
index c25e068d60..31455709d7 100644
--- a/crates/ra_ide/src/expand_macro.rs
+++ b/crates/ra_ide/src/expand_macro.rs
@@ -1,5 +1,5 @@
 use hir::Semantics;
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{
     algo::{find_node_at_offset, SyntaxRewriter},
     ast, AstNode, NodeOrToken, SyntaxKind,
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs
index f30df2bff4..34563a0267 100644
--- a/crates/ra_ide/src/extend_selection.rs
+++ b/crates/ra_ide/src/extend_selection.rs
@@ -1,7 +1,7 @@
 use std::iter::successors;
 
 use hir::Semantics;
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{
     algo::{self, find_covering_element, skip_trivia_token},
     ast::{self, AstNode, AstToken},
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index b93d116bf8..15e9b7fad8 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -1,5 +1,5 @@
 use hir::Semantics;
-use ra_ide_db::{
+use ide_db::{
     defs::{classify_name, classify_name_ref},
     symbol_index, RootDatabase,
 };
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs
index 6dc2ccfd05..f503f4ec5f 100644
--- a/crates/ra_ide/src/goto_implementation.rs
+++ b/crates/ra_ide/src/goto_implementation.rs
@@ -1,5 +1,5 @@
 use hir::{Crate, ImplDef, Semantics};
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{algo::find_node_at_offset, ast, AstNode};
 
 use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs
index 8017ca58cb..4a151b1506 100644
--- a/crates/ra_ide/src/goto_type_definition.rs
+++ b/crates/ra_ide/src/goto_type_definition.rs
@@ -1,4 +1,4 @@
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T};
 
 use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index a74087f87a..331aa4db0c 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -3,11 +3,11 @@ use hir::{
     Adt, AsAssocItem, AssocItemContainer, Documentation, FieldSource, HasSource, HirDisplay,
     Module, ModuleDef, ModuleSource, Semantics,
 };
-use itertools::Itertools;
-use ra_ide_db::{
+use ide_db::{
     defs::{classify_name, classify_name_ref, Definition},
     RootDatabase,
 };
+use itertools::Itertools;
 use stdx::format_to;
 use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset, T};
 use test_utils::mark;
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 81fe274adf..002adf9159 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -1,5 +1,5 @@
 use hir::{Adt, Callable, HirDisplay, Semantics, Type};
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use stdx::to_lower_snake_case;
 use syntax::{
     ast::{self, ArgListOwner, AstNode},
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index 789fbdaf23..bbc9e4b8af 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -3,7 +3,7 @@
 //! Strings, suitable for displaying to the human.
 //!
 //! What powers this API are the `RootDatabase` struct, which defines a `salsa`
-//! database, and the `ra_hir` crate, where majority of the analysis happens.
+//! database, and the `hir` crate, where majority of the analysis happens.
 //! However, IDE specific bits of the analysis (most notably completion) happen
 //! in this crate.
 
@@ -39,7 +39,6 @@ mod matching_brace;
 mod parent_module;
 mod references;
 mod runnables;
-mod ssr;
 mod status;
 mod syntax_highlighting;
 mod syntax_tree;
@@ -52,7 +51,7 @@ use base_db::{
     CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath,
 };
 use cfg::CfgOptions;
-use ra_ide_db::{
+use ide_db::{
     symbol_index::{self, FileSymbol},
     LineIndexDatabase,
 };
@@ -86,8 +85,7 @@ pub use base_db::{
     SourceRootId,
 };
 pub use hir::{Documentation, Semantics};
-pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist};
-pub use ra_ide_db::{
+pub use ide_db::{
     change::AnalysisChange,
     line_index::{LineCol, LineIndex},
     search::SearchScope,
@@ -95,7 +93,8 @@ pub use ra_ide_db::{
     symbol_index::Query,
     RootDatabase,
 };
-pub use ra_ssr::SsrError;
+pub use ra_assists::{Assist, AssistConfig, AssistId, AssistKind, ResolvedAssist};
+pub use ssr::SsrError;
 pub use text_edit::{Indel, TextEdit};
 
 pub type Cancelable<T> = Result<T, Canceled>;
@@ -515,20 +514,23 @@ impl Analysis {
         &self,
         query: &str,
         parse_only: bool,
-        position: FilePosition,
+        resolve_context: FilePosition,
         selections: Vec<FileRange>,
     ) -> Cancelable<Result<SourceChange, SsrError>> {
         self.with_db(|db| {
-            let edits = ssr::parse_search_replace(query, parse_only, db, position, selections)?;
+            let rule: ssr::SsrRule = query.parse()?;
+            let mut match_finder = ssr::MatchFinder::in_context(db, resolve_context, selections);
+            match_finder.add_rule(rule)?;
+            let edits = if parse_only { Vec::new() } else { match_finder.edits() };
             Ok(SourceChange::from(edits))
         })
     }
 
     /// Performs an operation on that may be Canceled.
-    fn with_db<F: FnOnce(&RootDatabase) -> T + std::panic::UnwindSafe, T>(
-        &self,
-        f: F,
-    ) -> Cancelable<T> {
+    fn with_db<F, T>(&self, f: F) -> Cancelable<T>
+    where
+        F: FnOnce(&RootDatabase) -> T + std::panic::UnwindSafe,
+    {
         self.db.catch_canceled(f)
     }
 }
diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs
index 8439e1d5d3..59ed2967cf 100644
--- a/crates/ra_ide/src/parent_module.rs
+++ b/crates/ra_ide/src/parent_module.rs
@@ -1,6 +1,6 @@
 use base_db::{CrateId, FileId, FilePosition};
 use hir::Semantics;
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{
     algo::find_node_at_offset,
     ast::{self, AstNode},
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index e89dca869c..0a76ec6b43 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -12,7 +12,7 @@
 mod rename;
 
 use hir::Semantics;
-use ra_ide_db::{
+use ide_db::{
     defs::{classify_name, classify_name_ref, Definition},
     search::SearchScope,
     RootDatabase,
@@ -27,7 +27,7 @@ use crate::{display::TryToNav, FilePosition, FileRange, NavigationTarget, RangeI
 
 pub(crate) use self::rename::rename;
 
-pub use ra_ide_db::search::{Reference, ReferenceAccess, ReferenceKind};
+pub use ide_db::search::{Reference, ReferenceAccess, ReferenceKind};
 
 #[derive(Debug, Clone)]
 pub struct ReferenceSearchResult {
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 5697b9d879..d73dc9cd00 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -2,7 +2,7 @@
 
 use base_db::SourceDatabaseExt;
 use hir::{Module, ModuleDef, ModuleSource, Semantics};
-use ra_ide_db::{
+use ide_db::{
     defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass},
     RootDatabase,
 };
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index fb40762cfb..c3e07c8dec 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -2,8 +2,8 @@ use std::fmt;
 
 use cfg::CfgExpr;
 use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics};
+use ide_db::RootDatabase;
 use itertools::Itertools;
-use ra_ide_db::RootDatabase;
 use syntax::{
     ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner},
     match_ast, SyntaxNode,
diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs
deleted file mode 100644
index 97b82b70e5..0000000000
--- a/crates/ra_ide/src/ssr.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-use base_db::{FilePosition, FileRange};
-use ra_ide_db::RootDatabase;
-
-use crate::SourceFileEdit;
-use ra_ssr::{MatchFinder, SsrError, SsrRule};
-
-// Feature: Structural Search and Replace
-//
-// Search and replace with named wildcards that will match any expression, type, path, pattern or item.
-// The syntax for a structural search replace command is `<search_pattern> ==>> <replace_pattern>`.
-// A `$<name>` placeholder in the search pattern will match any AST node and `$<name>` will reference it in the replacement.
-// Within a macro call, a placeholder will match up until whatever token follows the placeholder.
-//
-// All paths in both the search pattern and the replacement template must resolve in the context
-// in which this command is invoked. Paths in the search pattern will then match the code if they
-// resolve to the same item, even if they're written differently. For example if we invoke the
-// command in the module `foo` with a pattern of `Bar`, then code in the parent module that refers
-// to `foo::Bar` will match.
-//
-// Paths in the replacement template will be rendered appropriately for the context in which the
-// replacement occurs. For example if our replacement template is `foo::Bar` and we match some
-// code in the `foo` module, we'll insert just `Bar`.
-//
-// Inherent method calls should generally be written in UFCS form. e.g. `foo::Bar::baz($s, $a)` will
-// match `$s.baz($a)`, provided the method call `baz` resolves to the method `foo::Bar::baz`.
-//
-// The scope of the search / replace will be restricted to the current selection if any, otherwise
-// it will apply to the whole workspace.
-//
-// Placeholders may be given constraints by writing them as `${<name>:<constraint1>:<constraint2>...}`.
-//
-// Supported constraints:
-//
-// |===
-// | Constraint    | Restricts placeholder
-//
-// | kind(literal) | Is a literal (e.g. `42` or `"forty two"`)
-// | not(a)        | Negates the constraint `a`
-// |===
-//
-// Available via the command `rust-analyzer.ssr`.
-//
-// ```rust
-// // Using structural search replace command [foo($a, $b) ==>> ($a).foo($b)]
-//
-// // BEFORE
-// String::from(foo(y + 5, z))
-//
-// // AFTER
-// String::from((y + 5).foo(z))
-// ```
-//
-// |===
-// | Editor  | Action Name
-//
-// | VS Code | **Rust Analyzer: Structural Search Replace**
-// |===
-pub fn parse_search_replace(
-    rule: &str,
-    parse_only: bool,
-    db: &RootDatabase,
-    resolve_context: FilePosition,
-    selections: Vec<FileRange>,
-) -> Result<Vec<SourceFileEdit>, SsrError> {
-    let rule: SsrRule = rule.parse()?;
-    let mut match_finder = MatchFinder::in_context(db, resolve_context, selections);
-    match_finder.add_rule(rule)?;
-    if parse_only {
-        return Ok(Vec::new());
-    }
-    Ok(match_finder.edits())
-}
diff --git a/crates/ra_ide/src/status.rs b/crates/ra_ide/src/status.rs
index 869c74accc..c237081818 100644
--- a/crates/ra_ide/src/status.rs
+++ b/crates/ra_ide/src/status.rs
@@ -5,11 +5,11 @@ use base_db::{
     FileTextQuery, SourceRootId,
 };
 use hir::MacroFile;
-use profile::{memory_usage, Bytes};
-use ra_ide_db::{
+use ide_db::{
     symbol_index::{LibrarySymbolsQuery, SymbolIndex},
     RootDatabase,
 };
+use profile::{memory_usage, Bytes};
 use rustc_hash::FxHashMap;
 use syntax::{ast, Parse, SyntaxNode};
 
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 4b41ceb1dc..5d7c7e8d02 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -5,7 +5,7 @@ mod injection;
 mod tests;
 
 use hir::{Name, Semantics, VariantDef};
-use ra_ide_db::{
+use ide_db::{
     defs::{classify_name, classify_name_ref, Definition, NameClass, NameRefClass},
     RootDatabase,
 };
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs
index 17daf06b66..f800449596 100644
--- a/crates/ra_ide/src/syntax_tree.rs
+++ b/crates/ra_ide/src/syntax_tree.rs
@@ -1,5 +1,5 @@
 use base_db::{FileId, SourceDatabase};
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{
     algo, AstNode, NodeOrToken, SourceFile,
     SyntaxKind::{RAW_STRING, STRING},
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs
index 75f2a6b605..899ce5f265 100644
--- a/crates/ra_ide/src/typing.rs
+++ b/crates/ra_ide/src/typing.rs
@@ -16,7 +16,7 @@
 mod on_enter;
 
 use base_db::{FilePosition, SourceDatabase};
-use ra_ide_db::{source_change::SourceFileEdit, RootDatabase};
+use ide_db::{source_change::SourceFileEdit, RootDatabase};
 use syntax::{
     algo::find_node_at_offset,
     ast::{self, edit::IndentLevel, AstToken},
diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs
index 1939306590..f7d46146c5 100644
--- a/crates/ra_ide/src/typing/on_enter.rs
+++ b/crates/ra_ide/src/typing/on_enter.rs
@@ -2,7 +2,7 @@
 //! comments, but should handle indent some time in the future as well.
 
 use base_db::{FilePosition, SourceDatabase};
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::{
     ast::{self, AstToken},
     AstNode, SmolStr, SourceFile,
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 0dee719de5..749cf648c6 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -47,11 +47,11 @@ toolchain = { path = "../toolchain" }
 
 # This should only be used in CLI
 base_db = { path = "../base_db" }
-ra_ide_db = { path = "../ra_ide_db" }
-ra_ssr = { path = "../ra_ssr" }
-hir = { path = "../ra_hir", package = "ra_hir" }
+ide_db = { path = "../ide_db" }
+ssr = { path = "../ssr" }
+hir = { path = "../hir" }
 hir_def = { path = "../hir_def" }
-hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" }
+hir_ty = { path = "../hir_ty" }
 proc_macro_srv = { path = "../proc_macro_srv" }
 
 [target.'cfg(windows)'.dependencies]
diff --git a/crates/rust-analyzer/src/bin/args.rs b/crates/rust-analyzer/src/bin/args.rs
index d3081e88bd..0bc92431a9 100644
--- a/crates/rust-analyzer/src/bin/args.rs
+++ b/crates/rust-analyzer/src/bin/args.rs
@@ -7,8 +7,8 @@ use std::{env, fmt::Write, path::PathBuf};
 
 use anyhow::{bail, Result};
 use pico_args::Arguments;
-use ra_ssr::{SsrPattern, SsrRule};
 use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity};
+use ssr::{SsrPattern, SsrRule};
 use vfs::AbsPathBuf;
 
 pub(crate) struct Args {
diff --git a/crates/rust-analyzer/src/cli.rs b/crates/rust-analyzer/src/cli.rs
index 420abaccb9..b237a94d11 100644
--- a/crates/rust-analyzer/src/cli.rs
+++ b/crates/rust-analyzer/src/cli.rs
@@ -13,11 +13,13 @@ use anyhow::Result;
 use ra_ide::Analysis;
 use syntax::{AstNode, SourceFile};
 
-pub use analysis_bench::{BenchCmd, BenchWhat, Position};
-pub use analysis_stats::AnalysisStatsCmd;
-pub use diagnostics::diagnostics;
-pub use load_cargo::load_cargo;
-pub use ssr::{apply_ssr_rules, search_for_patterns};
+pub use self::{
+    analysis_bench::{BenchCmd, BenchWhat, Position},
+    analysis_stats::AnalysisStatsCmd,
+    diagnostics::diagnostics,
+    load_cargo::load_cargo,
+    ssr::{apply_ssr_rules, search_for_patterns},
+};
 
 #[derive(Clone, Copy)]
 pub enum Verbosity {
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs
index 08788fb415..c11e109437 100644
--- a/crates/rust-analyzer/src/cli/ssr.rs
+++ b/crates/rust-analyzer/src/cli/ssr.rs
@@ -1,7 +1,7 @@
 //! Applies structured search replace rules from the command line.
 
 use crate::cli::{load_cargo::load_cargo, Result};
-use ra_ssr::{MatchFinder, SsrPattern, SsrRule};
+use ssr::{MatchFinder, SsrPattern, SsrRule};
 
 pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
     use base_db::SourceDatabaseExt;
@@ -27,7 +27,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
 /// for much else.
 pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<String>) -> Result<()> {
     use base_db::SourceDatabaseExt;
-    use ra_ide_db::symbol_index::SymbolsDatabase;
+    use ide_db::symbol_index::SymbolsDatabase;
     let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?;
     let db = host.raw_database();
     let mut match_finder = MatchFinder::at_first_file(db)?;
diff --git a/crates/ra_ssr/Cargo.toml b/crates/ssr/Cargo.toml
similarity index 82%
rename from crates/ra_ssr/Cargo.toml
rename to crates/ssr/Cargo.toml
index f290939cfb..cd05eeecc8 100644
--- a/crates/ra_ssr/Cargo.toml
+++ b/crates/ssr/Cargo.toml
@@ -1,22 +1,23 @@
 [package]
-edition = "2018"
-name = "ra_ssr"
+name = "ssr"
 version = "0.1.0"
-authors = ["rust-analyzer developers"]
-license = "MIT OR Apache-2.0"
 description = "Structural search and replace of Rust code"
+license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-analyzer/rust-analyzer"
+authors = ["rust-analyzer developers"]
+edition = "2018"
 
 [lib]
 doctest = false
 
 [dependencies]
+rustc-hash = "1.1.0"
+
 text_edit = { path = "../text_edit" }
 syntax = { path = "../syntax" }
 base_db = { path = "../base_db" }
-ra_ide_db = { path = "../ra_ide_db" }
-hir = { path = "../ra_hir", package = "ra_hir" }
-rustc-hash = "1.1.0"
+ide_db = { path = "../ide_db" }
+hir = { path = "../hir" }
 test_utils = { path = "../test_utils" }
 
 [dev-dependencies]
diff --git a/crates/ra_ssr/src/errors.rs b/crates/ssr/src/errors.rs
similarity index 100%
rename from crates/ra_ssr/src/errors.rs
rename to crates/ssr/src/errors.rs
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ssr/src/lib.rs
similarity index 80%
rename from crates/ra_ssr/src/lib.rs
rename to crates/ssr/src/lib.rs
index 6725582e49..292bd5b9a7 100644
--- a/crates/ra_ssr/src/lib.rs
+++ b/crates/ssr/src/lib.rs
@@ -3,6 +3,58 @@
 //! Allows searching the AST for code that matches one or more patterns and then replacing that code
 //! based on a template.
 
+// Feature: Structural Search and Replace
+//
+// Search and replace with named wildcards that will match any expression, type, path, pattern or item.
+// The syntax for a structural search replace command is `<search_pattern> ==>> <replace_pattern>`.
+// A `$<name>` placeholder in the search pattern will match any AST node and `$<name>` will reference it in the replacement.
+// Within a macro call, a placeholder will match up until whatever token follows the placeholder.
+//
+// All paths in both the search pattern and the replacement template must resolve in the context
+// in which this command is invoked. Paths in the search pattern will then match the code if they
+// resolve to the same item, even if they're written differently. For example if we invoke the
+// command in the module `foo` with a pattern of `Bar`, then code in the parent module that refers
+// to `foo::Bar` will match.
+//
+// Paths in the replacement template will be rendered appropriately for the context in which the
+// replacement occurs. For example if our replacement template is `foo::Bar` and we match some
+// code in the `foo` module, we'll insert just `Bar`.
+//
+// Inherent method calls should generally be written in UFCS form. e.g. `foo::Bar::baz($s, $a)` will
+// match `$s.baz($a)`, provided the method call `baz` resolves to the method `foo::Bar::baz`.
+//
+// The scope of the search / replace will be restricted to the current selection if any, otherwise
+// it will apply to the whole workspace.
+//
+// Placeholders may be given constraints by writing them as `${<name>:<constraint1>:<constraint2>...}`.
+//
+// Supported constraints:
+//
+// |===
+// | Constraint    | Restricts placeholder
+//
+// | kind(literal) | Is a literal (e.g. `42` or `"forty two"`)
+// | not(a)        | Negates the constraint `a`
+// |===
+//
+// Available via the command `rust-analyzer.ssr`.
+//
+// ```rust
+// // Using structural search replace command [foo($a, $b) ==>> ($a).foo($b)]
+//
+// // BEFORE
+// String::from(foo(y + 5, z))
+//
+// // AFTER
+// String::from((y + 5).foo(z))
+// ```
+//
+// |===
+// | Editor  | Action Name
+//
+// | VS Code | **Rust Analyzer: Structural Search Replace**
+// |===
+
 mod matching;
 mod nester;
 mod parsing;
@@ -20,7 +72,7 @@ pub use crate::matching::Match;
 use crate::matching::MatchFailureReason;
 use base_db::{FileId, FilePosition, FileRange};
 use hir::Semantics;
-use ra_ide_db::source_change::SourceFileEdit;
+use ide_db::source_change::SourceFileEdit;
 use resolving::ResolvedRule;
 use rustc_hash::FxHashMap;
 use syntax::{ast, AstNode, SyntaxNode, TextRange};
@@ -49,7 +101,7 @@ pub struct SsrMatches {
 /// Searches a crate for pattern matches and possibly replaces them with something else.
 pub struct MatchFinder<'db> {
     /// Our source of information about the user's code.
-    sema: Semantics<'db, ra_ide_db::RootDatabase>,
+    sema: Semantics<'db, ide_db::RootDatabase>,
     rules: Vec<ResolvedRule>,
     resolution_scope: resolving::ResolutionScope<'db>,
     restrict_ranges: Vec<FileRange>,
@@ -59,7 +111,7 @@ impl<'db> MatchFinder<'db> {
     /// Constructs a new instance where names will be looked up as if they appeared at
     /// `lookup_context`.
     pub fn in_context(
-        db: &'db ra_ide_db::RootDatabase,
+        db: &'db ide_db::RootDatabase,
         lookup_context: FilePosition,
         mut restrict_ranges: Vec<FileRange>,
     ) -> MatchFinder<'db> {
@@ -70,9 +122,9 @@ impl<'db> MatchFinder<'db> {
     }
 
     /// Constructs an instance using the start of the first file in `db` as the lookup context.
-    pub fn at_first_file(db: &'db ra_ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> {
+    pub fn at_first_file(db: &'db ide_db::RootDatabase) -> Result<MatchFinder<'db>, SsrError> {
         use base_db::SourceDatabaseExt;
-        use ra_ide_db::symbol_index::SymbolsDatabase;
+        use ide_db::symbol_index::SymbolsDatabase;
         if let Some(first_file_id) = db
             .local_roots()
             .iter()
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ssr/src/matching.rs
similarity index 99%
rename from crates/ra_ssr/src/matching.rs
rename to crates/ssr/src/matching.rs
index e81a87c471..ffc7202ae5 100644
--- a/crates/ra_ssr/src/matching.rs
+++ b/crates/ssr/src/matching.rs
@@ -92,7 +92,7 @@ pub(crate) fn get_match(
     rule: &ResolvedRule,
     code: &SyntaxNode,
     restrict_range: &Option<FileRange>,
-    sema: &Semantics<ra_ide_db::RootDatabase>,
+    sema: &Semantics<ide_db::RootDatabase>,
 ) -> Result<Match, MatchFailed> {
     record_match_fails_reasons_scope(debug_active, || {
         Matcher::try_match(rule, code, restrict_range, sema)
@@ -101,7 +101,7 @@ pub(crate) fn get_match(
 
 /// Checks if our search pattern matches a particular node of the AST.
 struct Matcher<'db, 'sema> {
-    sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>,
+    sema: &'sema Semantics<'db, ide_db::RootDatabase>,
     /// If any placeholders come from anywhere outside of this range, then the match will be
     /// rejected.
     restrict_range: Option<FileRange>,
@@ -123,7 +123,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
         rule: &ResolvedRule,
         code: &SyntaxNode,
         restrict_range: &Option<FileRange>,
-        sema: &'sema Semantics<'db, ra_ide_db::RootDatabase>,
+        sema: &'sema Semantics<'db, ide_db::RootDatabase>,
     ) -> Result<Match, MatchFailed> {
         let match_state = Matcher { sema, restrict_range: restrict_range.clone(), rule };
         // First pass at matching, where we check that node types and idents match.
@@ -606,7 +606,7 @@ impl Match {
     fn render_template_paths(
         &mut self,
         template: &ResolvedPattern,
-        sema: &Semantics<ra_ide_db::RootDatabase>,
+        sema: &Semantics<ide_db::RootDatabase>,
     ) -> Result<(), MatchFailed> {
         let module = sema
             .scope(&self.matched_node)
diff --git a/crates/ra_ssr/src/nester.rs b/crates/ssr/src/nester.rs
similarity index 93%
rename from crates/ra_ssr/src/nester.rs
rename to crates/ssr/src/nester.rs
index 8be570d3cf..6ac355dfc2 100644
--- a/crates/ra_ssr/src/nester.rs
+++ b/crates/ssr/src/nester.rs
@@ -13,7 +13,7 @@ use syntax::SyntaxNode;
 
 pub(crate) fn nest_and_remove_collisions(
     mut matches: Vec<Match>,
-    sema: &hir::Semantics<ra_ide_db::RootDatabase>,
+    sema: &hir::Semantics<ide_db::RootDatabase>,
 ) -> SsrMatches {
     // We sort the matches by depth then by rule index. Sorting by depth means that by the time we
     // see a match, any parent matches or conflicting matches will have already been seen. Sorting
@@ -36,7 +36,7 @@ impl MatchCollector {
     /// Attempts to add `m` to matches. If it conflicts with an existing match, it is discarded. If
     /// it is entirely within the a placeholder of an existing match, then it is added as a child
     /// match of the existing match.
-    fn add_match(&mut self, m: Match, sema: &hir::Semantics<ra_ide_db::RootDatabase>) {
+    fn add_match(&mut self, m: Match, sema: &hir::Semantics<ide_db::RootDatabase>) {
         let matched_node = m.matched_node.clone();
         if let Some(existing) = self.matches_by_node.get_mut(&matched_node) {
             try_add_sub_match(m, existing, sema);
@@ -53,11 +53,7 @@ impl MatchCollector {
 }
 
 /// Attempts to add `m` as a sub-match of `existing`.
-fn try_add_sub_match(
-    m: Match,
-    existing: &mut Match,
-    sema: &hir::Semantics<ra_ide_db::RootDatabase>,
-) {
+fn try_add_sub_match(m: Match, existing: &mut Match, sema: &hir::Semantics<ide_db::RootDatabase>) {
     for p in existing.placeholder_values.values_mut() {
         // Note, no need to check if p.range.file is equal to m.range.file, since we
         // already know we're within `existing`.
diff --git a/crates/ra_ssr/src/parsing.rs b/crates/ssr/src/parsing.rs
similarity index 100%
rename from crates/ra_ssr/src/parsing.rs
rename to crates/ssr/src/parsing.rs
diff --git a/crates/ra_ssr/src/replacing.rs b/crates/ssr/src/replacing.rs
similarity index 100%
rename from crates/ra_ssr/src/replacing.rs
rename to crates/ssr/src/replacing.rs
diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ssr/src/resolving.rs
similarity index 99%
rename from crates/ra_ssr/src/resolving.rs
rename to crates/ssr/src/resolving.rs
index dac09bae80..020fd79941 100644
--- a/crates/ra_ssr/src/resolving.rs
+++ b/crates/ssr/src/resolving.rs
@@ -187,7 +187,7 @@ impl Resolver<'_, '_> {
 
 impl<'db> ResolutionScope<'db> {
     pub(crate) fn new(
-        sema: &hir::Semantics<'db, ra_ide_db::RootDatabase>,
+        sema: &hir::Semantics<'db, ide_db::RootDatabase>,
         resolve_context: FilePosition,
     ) -> ResolutionScope<'db> {
         use syntax::ast::AstNode;
diff --git a/crates/ra_ssr/src/search.rs b/crates/ssr/src/search.rs
similarity index 99%
rename from crates/ra_ssr/src/search.rs
rename to crates/ssr/src/search.rs
index 434953fb48..8509cfa4de 100644
--- a/crates/ra_ssr/src/search.rs
+++ b/crates/ssr/src/search.rs
@@ -6,7 +6,7 @@ use crate::{
     Match, MatchFinder,
 };
 use base_db::{FileId, FileRange};
-use ra_ide_db::{
+use ide_db::{
     defs::Definition,
     search::{Reference, SearchScope},
 };
@@ -146,7 +146,7 @@ impl<'db> MatchFinder<'db> {
         if self.restrict_ranges.is_empty() {
             // Unrestricted search.
             use base_db::SourceDatabaseExt;
-            use ra_ide_db::symbol_index::SymbolsDatabase;
+            use ide_db::symbol_index::SymbolsDatabase;
             for &root in self.sema.db.local_roots().iter() {
                 let sr = self.sema.db.source_root(root);
                 for file_id in sr.iter() {
diff --git a/docs/dev/README.md b/docs/dev/README.md
index 4aab6e2b86..04bebbfca5 100644
--- a/docs/dev/README.md
+++ b/docs/dev/README.md
@@ -148,14 +148,14 @@ Internal representations are lowered to LSP in the `rust-analyzer` crate (the on
 
 ## IDE/Compiler split
 
-There's a semi-hard split between "compiler" and "IDE", at the `ra_hir` crate.
+There's a semi-hard split between "compiler" and "IDE", at the `hir` crate.
 Compiler derives new facts about source code.
 It explicitly acknowledges that not all info is available (i.e. you can't look at types during name resolution).
 
 IDE assumes that all information is available at all times.
 
-IDE should use only types from `ra_hir`, and should not depend on the underling compiler types.
-`ra_hir` is a facade.
+IDE should use only types from `hir`, and should not depend on the underling compiler types.
+`hir` is a facade.
 
 ## IDE API
 
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index 746d41f83c..0ffe61026a 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -102,7 +102,7 @@ defines most of the "input" queries: facts supplied by the client of the
 analyzer. Reading the docs of the `base_db::input` module should be useful:
 everything else is strictly derived from those inputs.
 
-### `crates/ra_hir*` crates
+### `crates/hir*` crates
 
 HIR provides high-level "object oriented" access to Rust code.
 
@@ -113,10 +113,10 @@ is responsible for guessing a HIR for a particular source position.
 
 Underneath, HIR works on top of salsa, using a `HirDatabase` trait.
 
-`ra_hir_xxx` crates have a strong ECS flavor, in that they work with raw ids and
+`hir_xxx` crates have a strong ECS flavor, in that they work with raw ids and
 directly query the database.
 
-The top-level `ra_hir` façade crate wraps ids into a more OO-flavored API.
+The top-level `hir` façade crate wraps ids into a more OO-flavored API.
 
 ### `crates/ra_ide`
 
diff --git a/docs/dev/guide.md b/docs/dev/guide.md
index d14143226b..29d84bf3f6 100644
--- a/docs/dev/guide.md
+++ b/docs/dev/guide.md
@@ -275,7 +275,7 @@ several times, with different sets of `cfg`s enabled. The IDE-specific task of
 mapping source code position into a semantic model is inherently imprecise for
 this reason, and is handled by the [`source_binder`].
 
-[`source_binder`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/source_binder.rs
+[`source_binder`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/source_binder.rs
 
 The semantic interface is declared in the [`code_model_api`] module. Each entity is
 identified by an integer ID and has a bunch of methods which take a salsa database
@@ -283,8 +283,8 @@ as an argument and returns other entities (which are also IDs). Internally, thes
 methods invoke various queries on the database to build the model on demand.
 Here's [the list of queries].
 
-[`code_model_api`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/code_model_api.rs
-[the list of queries]: https://github.com/rust-analyzer/rust-analyzer/blob/7e84440e25e19529e4ff8a66e521d1b06349c6ec/crates/ra_hir/src/db.rs#L20-L106
+[`code_model_api`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/code_model_api.rs
+[the list of queries]: https://github.com/rust-analyzer/rust-analyzer/blob/7e84440e25e19529e4ff8a66e521d1b06349c6ec/crates/hir/src/db.rs#L20-L106
 
 The first step of building the model is parsing the source code.
 
@@ -341,7 +341,7 @@ The algorithm for building a tree of modules is to start with a crate root
 declarations and recursively process child modules. This is handled by the
 [`module_tree_query`], with two slight variations.
 
-[`module_tree_query`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/module_tree.rs#L116-L123
+[`module_tree_query`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/module_tree.rs#L116-L123
 
 First, rust-analyzer builds a module tree for all crates in a source root
 simultaneously. The main reason for this is historical (`module_tree` predates
@@ -364,7 +364,7 @@ the same, we don't have to re-execute [`module_tree_query`]. In fact, we only
 need to re-execute it when we add/remove new files or when we change mod
 declarations.
 
-[`submodules_query`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/module_tree.rs#L41
+[`submodules_query`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/module_tree.rs#L41
 
 We store the resulting modules in a `Vec`-based indexed arena. The indices in
 the arena becomes module IDs. And this brings us to the next topic:
@@ -393,7 +393,7 @@ database we use includes a couple of [interners]. How to "garbage collect"
 unused locations is an open question.
 
 [`LocationInterner`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/base_db/src/loc2id.rs#L65-L71
-[interners]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/db.rs#L22-L23
+[interners]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/db.rs#L22-L23
 
 For example, we use `LocationInterner` to assign IDs to definitions of functions,
 structs, enums, etc. The location, [`DefLoc`] contains two bits of information:
@@ -407,7 +407,7 @@ using offsets, text ranges or syntax trees as keys and values for queries. What
 we do instead is we store "index" of the item among all of the items of a file
 (so, a positional based ID, but localized to a single file).
 
-[`DefLoc`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/ids.rs#L127-L139
+[`DefLoc`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/ids.rs#L127-L139
 
 One thing we've glossed over for the time being is support for macros. We have
 only proof of concept handling of macros at the moment, but they are extremely
@@ -440,7 +440,7 @@ terms of `HirFileId`! This does not recur infinitely though: any chain of
 `HirFileId`s bottoms out in `HirFileId::FileId`, that is, some source file
 actually written by the user.
 
-[`HirFileId`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/ids.rs#L18-L125
+[`HirFileId`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/ids.rs#L18-L125
 
 Now that we understand how to identify a definition, in a source or in a
 macro-generated file, we can discuss name resolution a bit.
@@ -454,14 +454,14 @@ each module into a position-independent representation which does not change if
 we modify bodies of the items. After that we [loop] resolving all imports until
 we've reached a fixed point.
 
-[lower]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L113-L117
-[loop]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres.rs#L186-L196
+[lower]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/nameres/lower.rs#L113-L117
+[loop]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/nameres.rs#L186-L196
 
 And, given all our preparation with IDs and a position-independent representation,
 it is satisfying to [test] that typing inside function body does not invalidate
 name resolution results.
 
-[test]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/tests.rs#L376
+[test]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/nameres/tests.rs#L376
 
 An interesting fact about name resolution is that it "erases" all of the
 intermediate paths from the imports: in the end, we know which items are defined
@@ -496,10 +496,10 @@ there's an intermediate [projection query] which returns only the first
 position-independent part of the lowering. The result of this query is stable.
 Naturally, name resolution [uses] this stable projection query.
 
-[imports]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L52-L59
-[`SourceMap`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L52-L59
-[projection query]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L97-L103
-[uses]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/query_definitions.rs#L49
+[imports]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/nameres/lower.rs#L52-L59
+[`SourceMap`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/nameres/lower.rs#L52-L59
+[projection query]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/nameres/lower.rs#L97-L103
+[uses]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/query_definitions.rs#L49
 
 ## Type inference
 
@@ -521,10 +521,10 @@ construct a mapping from `ExprId`s to types.
 
 [@flodiebold]: https://github.com/flodiebold
 [#327]: https://github.com/rust-analyzer/rust-analyzer/pull/327
-[lower the AST]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/expr.rs
-[positional ID]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/expr.rs#L13-L15
-[a source map]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/expr.rs#L41-L44
-[type inference]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/ty.rs#L1208-L1223
+[lower the AST]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/expr.rs
+[positional ID]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/expr.rs#L13-L15
+[a source map]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/expr.rs#L41-L44
+[type inference]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/hir/src/ty.rs#L1208-L1223
 
 ## Tying it all together: completion
 


Test patch:
diff --git a/crates/ra_hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs
similarity index 100%
rename from crates/ra_hir_ty/src/autoderef.rs
rename to crates/hir_ty/src/autoderef.rs
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/hir_ty/src/db.rs
similarity index 100%
rename from crates/ra_hir_ty/src/db.rs
rename to crates/hir_ty/src/db.rs
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs
similarity index 100%
rename from crates/ra_hir_ty/src/diagnostics.rs
rename to crates/hir_ty/src/diagnostics.rs
diff --git a/crates/ra_hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs
similarity index 100%
rename from crates/ra_hir_ty/src/diagnostics/expr.rs
rename to crates/hir_ty/src/diagnostics/expr.rs
diff --git a/crates/ra_hir_ty/src/diagnostics/match_check.rs b/crates/hir_ty/src/diagnostics/match_check.rs
similarity index 100%
rename from crates/ra_hir_ty/src/diagnostics/match_check.rs
rename to crates/hir_ty/src/diagnostics/match_check.rs
diff --git a/crates/ra_hir_ty/src/diagnostics/unsafe_check.rs b/crates/hir_ty/src/diagnostics/unsafe_check.rs
similarity index 100%
rename from crates/ra_hir_ty/src/diagnostics/unsafe_check.rs
rename to crates/hir_ty/src/diagnostics/unsafe_check.rs
diff --git a/crates/ra_hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
similarity index 100%
rename from crates/ra_hir_ty/src/display.rs
rename to crates/hir_ty/src/display.rs
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs
similarity index 100%
rename from crates/ra_hir_ty/src/infer.rs
rename to crates/hir_ty/src/infer.rs
diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs
similarity index 100%
rename from crates/ra_hir_ty/src/infer/coerce.rs
rename to crates/hir_ty/src/infer/coerce.rs
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
similarity index 100%
rename from crates/ra_hir_ty/src/infer/expr.rs
rename to crates/hir_ty/src/infer/expr.rs
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs
similarity index 100%
rename from crates/ra_hir_ty/src/infer/pat.rs
rename to crates/hir_ty/src/infer/pat.rs
diff --git a/crates/ra_hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs
similarity index 100%
rename from crates/ra_hir_ty/src/infer/path.rs
rename to crates/hir_ty/src/infer/path.rs
diff --git a/crates/ra_hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs
similarity index 100%
rename from crates/ra_hir_ty/src/infer/unify.rs
rename to crates/hir_ty/src/infer/unify.rs
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
similarity index 100%
rename from crates/ra_hir_ty/src/lib.rs
rename to crates/hir_ty/src/lib.rs
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
similarity index 100%
rename from crates/ra_hir_ty/src/lower.rs
rename to crates/hir_ty/src/lower.rs
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs
similarity index 100%
rename from crates/ra_hir_ty/src/method_resolution.rs
rename to crates/hir_ty/src/method_resolution.rs
diff --git a/crates/ra_hir_ty/src/op.rs b/crates/hir_ty/src/op.rs
similarity index 100%
rename from crates/ra_hir_ty/src/op.rs
rename to crates/hir_ty/src/op.rs
diff --git a/crates/ra_hir_ty/src/primitive.rs b/crates/hir_ty/src/primitive.rs
similarity index 100%
rename from crates/ra_hir_ty/src/primitive.rs
rename to crates/hir_ty/src/primitive.rs
diff --git a/crates/ra_hir_ty/src/test_db.rs b/crates/hir_ty/src/test_db.rs
similarity index 100%
rename from crates/ra_hir_ty/src/test_db.rs
rename to crates/hir_ty/src/test_db.rs
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs
similarity index 99%
rename from crates/ra_hir_ty/src/tests.rs
rename to crates/hir_ty/src/tests.rs
index f6b172c3af..c953925ecb 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/hir_ty/src/tests.rs
@@ -35,7 +35,7 @@ use crate::{
 
 // These tests compare the inference results for all expressions in a file
 // against snapshots of the expected results using expect. Use
-// `env UPDATE_EXPECT=1 cargo test -p ra_hir_ty` to update the snapshots.
+// `env UPDATE_EXPECT=1 cargo test -p hir_ty` to update the snapshots.
 
 fn setup_tracing() -> tracing::subscriber::DefaultGuard {
     use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry};
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs
index 75d9736882..ba1fb543b8 100644
--- a/crates/ra_assists/src/tests.rs
+++ b/crates/ra_assists/src/tests.rs
@@ -2,7 +2,7 @@ mod generated;
 
 use base_db::{fixture::WithFixture, FileId, FileRange, SourceDatabaseExt};
 use hir::Semantics;
-use ra_ide_db::RootDatabase;
+use ide_db::RootDatabase;
 use syntax::TextRange;
 use test_utils::{assert_eq_text, extract_offset, extract_range};
 
diff --git a/crates/ra_ssr/src/tests.rs b/crates/ssr/src/tests.rs
similarity index 99%
rename from crates/ra_ssr/src/tests.rs
rename to crates/ssr/src/tests.rs
index 54c3da9db3..0d0a000906 100644
--- a/crates/ra_ssr/src/tests.rs
+++ b/crates/ssr/src/tests.rs
@@ -61,13 +61,13 @@ fn parser_undefined_placeholder_in_replacement() {
 
 /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be
 /// the start of the file. If there's a second cursor marker, then we'll return a single range.
-pub(crate) fn single_file(code: &str) -> (ra_ide_db::RootDatabase, FilePosition, Vec<FileRange>) {
+pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) {
     use base_db::fixture::WithFixture;
-    use ra_ide_db::symbol_index::SymbolsDatabase;
+    use ide_db::symbol_index::SymbolsDatabase;
     let (mut db, file_id, range_or_offset) = if code.contains(test_utils::CURSOR_MARKER) {
-        ra_ide_db::RootDatabase::with_range_or_offset(code)
+        ide_db::RootDatabase::with_range_or_offset(code)
     } else {
-        let (db, file_id) = ra_ide_db::RootDatabase::with_single_file(code);
+        let (db, file_id) = ide_db::RootDatabase::with_single_file(code);
         (db, file_id, RangeOrOffset::Offset(0.into()))
     };
     let selections;
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index dc367d1e03..97a11a01ee 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -192,7 +192,7 @@ impl TidyDocs {
         }
 
         let poorly_documented = [
-            "ra_hir",
+            "hir",
             "hir_expand",
             "ra_ide",
             "mbe",
@@ -201,7 +201,7 @@ impl TidyDocs {
             "project_model",
             "syntax",
             "tt",
-            "ra_hir_ty",
+            "hir_ty",
         ];
 
         let mut has_fixmes =