Repository: rust-analyzer/rust-analyzer
Pull request #2451 (2019-11-30 00:46:26)

Use env_logger instead of flexi_logger
This fixes https://github.com/rust-analyzer/rust-analyzer/issues/2335

- By default only `error` will be printed. From what I can tell this matches the current behaviour. Configured through `RUST_LOG`.
- I looked through the optional dependencies for `env_logger`and I have only enabled `human_time`. Without this feature no timestamp will be shown for log messages.
- `RA_LOG_DIR` feature is removed

This PR adds 2 new dependencies(`env_logger` and `human_time`) and removes 6 dependencies.


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 2557b5e59d..83e41940bd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -186,16 +186,6 @@ dependencies = [
  "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "chrono"
-version = "0.4.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "clicolors-control"
 version = "1.0.1"
@@ -323,6 +313,15 @@ name = "encode_unicode"
 version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
+[[package]]
+name = "env_logger"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "filetime"
 version = "0.2.8"
@@ -339,18 +338,6 @@ name = "fixedbitset"
 version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
-[[package]]
-name = "flexi_logger"
-version = "0.14.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "fnv"
 version = "1.0.6"
@@ -420,11 +407,6 @@ dependencies = [
  "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "glob"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
 [[package]]
 name = "globset"
 version = "0.4.4"
@@ -453,6 +435,14 @@ dependencies = [
  "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "humantime"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "idna"
 version = "0.2.0"
@@ -722,15 +712,6 @@ dependencies = [
  "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "num-integer"
-version = "0.1.41"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "num-traits"
 version = "0.2.10"
@@ -928,7 +909,7 @@ dependencies = [
 name = "ra_cli"
 version = "0.1.0"
 dependencies = [
- "flexi_logger 0.14.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "pico-args 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "ra_batch 0.1.0",
  "ra_db 0.1.0",
@@ -1060,7 +1041,7 @@ name = "ra_lsp_server"
 version = "0.1.0"
 dependencies = [
  "crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "flexi_logger 0.14.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "lsp-server 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1647,16 +1628,6 @@ dependencies = [
  "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "time"
-version = "0.1.42"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "unicase"
 version = "2.6.0"
@@ -1798,11 +1769,6 @@ dependencies = [
  "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "yansi"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
 [metadata]
 "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
 "checksum anyhow 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b412394828b7ca486b362f300b762d8e43dafd6f0d727b63f1cd2ade207c6cef"
@@ -1827,7 +1793,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum chalk-macros 0.1.1 (git+https://github.com/jackh726/chalk.git?rev=095cd38a4f16337913bba487f2055b9ca0179f30)" = "<none>"
 "checksum chalk-rust-ir 0.1.0 (git+https://github.com/jackh726/chalk.git?rev=095cd38a4f16337913bba487f2055b9ca0179f30)" = "<none>"
 "checksum chalk-solve 0.1.0 (git+https://github.com/jackh726/chalk.git?rev=095cd38a4f16337913bba487f2055b9ca0179f30)" = "<none>"
-"checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
 "checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
 "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
 "checksum console 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f5d540c2d34ac9dd0deb5f3b5f54c36c79efa78f6b3ad19106a554d07a7b5d9f"
@@ -1843,9 +1808,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
 "checksum ena 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8944dc8fa28ce4a38f778bd46bf7d923fe73eed5a439398507246c8e017e6f36"
 "checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
 "checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d"
 "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
-"checksum flexi_logger 0.14.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a13ea6b8a4debecf47bf3966d56db0e21366bc3a3649ba159e1a9e6fdd36a4f4"
 "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
 "checksum format-buf 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f7aea5a5909a74969507051a3b17adc84737e31a5f910559892aedce026f4d53"
 "checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
@@ -1856,10 +1821,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
 "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
 "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
-"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
 "checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2"
 "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
 "checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120"
+"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
 "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
 "checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2"
 "checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718"
@@ -1891,7 +1856,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
 "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
 "checksum notify 4.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "199628fc33b21bc767baa057490b00b382ecbae030803a7b36292422d15b778b"
-"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
 "checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
 "checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72"
 "checksum once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "891f486f630e5c5a4916c7e16c4b24a53e78c860b646e9f8e005e4f16847bfed"
@@ -1964,7 +1928,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum thin-dst 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c52fd98a9e4913c466d83381a59245691875d2f3e04611fca57f964bd8aa96e1"
 "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
 "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
-"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
 "checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
 "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
 "checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf"
@@ -1983,4 +1946,3 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
 "checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d"
-"checksum yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71"
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs
index 993aebc478..0ea84d5488 100644
--- a/crates/ra_assists/src/assist_ctx.rs
+++ b/crates/ra_assists/src/assist_ctx.rs
@@ -1,5 +1,5 @@
 //! This module defines `AssistCtx` -- the API surface that is exposed to assists.
-use hir::{db::HirDatabase, InFile, SourceAnalyzer};
+use hir::{db::HirDatabase, SourceAnalyzer};
 use ra_db::FileRange;
 use ra_fmt::{leading_indent, reindent};
 use ra_syntax::{
@@ -117,7 +117,7 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> {
         node: &SyntaxNode,
         offset: Option<TextUnit>,
     ) -> SourceAnalyzer {
-        SourceAnalyzer::new(self.db, InFile::new(self.frange.file_id.into(), node), offset)
+        SourceAnalyzer::new(self.db, hir::Source::new(self.frange.file_id.into(), node), offset)
     }
 
     pub(crate) fn covering_node_for_range(&self, range: TextRange) -> SyntaxElement {
diff --git a/crates/ra_assists/src/assists/add_new.rs b/crates/ra_assists/src/assists/add_new.rs
index f977547fb9..8f68bd5fb1 100644
--- a/crates/ra_assists/src/assists/add_new.rs
+++ b/crates/ra_assists/src/assists/add_new.rs
@@ -1,5 +1,5 @@
 use format_buf::format;
-use hir::{db::HirDatabase, FromSource, InFile};
+use hir::{db::HirDatabase, FromSource};
 use join_to_string::join;
 use ra_syntax::{
     ast::{
@@ -141,7 +141,7 @@ fn find_struct_impl(
     })?;
 
     let struct_ty = {
-        let src = InFile { file_id: ctx.frange.file_id.into(), value: strukt.clone() };
+        let src = hir::Source { file_id: ctx.frange.file_id.into(), value: strukt.clone() };
         hir::Struct::from_source(db, src).unwrap().ty(db)
     };
 
@@ -152,7 +152,7 @@ fn find_struct_impl(
             return false;
         }
 
-        let src = InFile { file_id: ctx.frange.file_id.into(), value: impl_blk.clone() };
+        let src = hir::Source { file_id: ctx.frange.file_id.into(), value: impl_blk.clone() };
         let blk = hir::ImplBlock::from_source(db, src).unwrap();
 
         let same_ty = blk.target_ty(db) == struct_ty;
diff --git a/crates/ra_cli/Cargo.toml b/crates/ra_cli/Cargo.toml
index c7e0d0f0f3..21a37c7bf4 100644
--- a/crates/ra_cli/Cargo.toml
+++ b/crates/ra_cli/Cargo.toml
@@ -7,7 +7,7 @@ publish = false
 
 [dependencies]
 pico-args = "0.3.0"
-flexi_logger = "0.14.0"
+env_logger = { version = "0.7.1", default-features = false, features = ["humantime"] }
 
 ra_syntax = { path = "../ra_syntax" }
 ra_ide = { path = "../ra_ide" }
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index fe847e6112..3808590abe 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -7,7 +7,6 @@ mod progress_report;
 
 use std::{error::Error, fmt::Write, io::Read};
 
-use flexi_logger::Logger;
 use pico_args::Arguments;
 use ra_ide::{file_structure, Analysis};
 use ra_prof::profile;
@@ -32,7 +31,7 @@ impl Verbosity {
 }
 
 fn main() -> Result<()> {
-    Logger::with_env_or_str("error").start()?;
+    env_logger::try_init()?;
 
     let subcommand = match std::env::args_os().nth(1) {
         None => {
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index dddac915bc..38d66c2a7c 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -30,7 +30,7 @@ use crate::{
     db::{DefDatabase, HirDatabase},
     ty::display::HirFormatter,
     ty::{self, InEnvironment, InferenceResult, TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk},
-    CallableDef, Either, HirDisplay, InFile, Name,
+    CallableDef, Either, HirDisplay, Name, Source,
 };
 
 /// hir::Crate describes a single crate. It's the main interface with which
@@ -118,7 +118,7 @@ impl ModuleSource {
         }
     }
 
-    pub fn from_child_node(db: &impl DefDatabase, child: InFile<&SyntaxNode>) -> ModuleSource {
+    pub fn from_child_node(db: &impl DefDatabase, child: Source<&SyntaxNode>) -> ModuleSource {
         if let Some(m) =
             child.value.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi())
         {
@@ -901,7 +901,7 @@ impl Local {
         Type { krate, ty: InEnvironment { value: ty, environment } }
     }
 
-    pub fn source(self, db: &impl HirDatabase) -> InFile<Either<ast::BindPat, ast::SelfParam>> {
+    pub fn source(self, db: &impl HirDatabase) -> Source<Either<ast::BindPat, ast::SelfParam>> {
         let (_body, source_map) = db.body_with_source_map(self.parent.into());
         let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm...
         let root = src.file_syntax(db);
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index 2cf2103497..bf3ee08341 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -1,9 +1,6 @@
 //! FIXME: write short doc here
 
-use hir_def::{
-    src::{HasChildSource, HasSource as _},
-    AstItemDef, Lookup, VariantId,
-};
+use hir_def::{AstItemDef, HasChildSource, HasSource as _, Lookup, VariantId};
 use hir_expand::either::Either;
 use ra_syntax::ast;
 
@@ -12,18 +9,18 @@ use crate::{
     Module, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
 };
 
-pub use hir_expand::InFile;
+pub use hir_expand::Source;
 
 pub trait HasSource {
     type Ast;
-    fn source(self, db: &impl DefDatabase) -> InFile<Self::Ast>;
+    fn source(self, db: &impl DefDatabase) -> Source<Self::Ast>;
 }
 
 /// NB: Module is !HasSource, because it has two source nodes at the same time:
 /// definition and declaration.
 impl Module {
     /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
-    pub fn definition_source(self, db: &impl DefDatabase) -> InFile<ModuleSource> {
+    pub fn definition_source(self, db: &impl DefDatabase) -> Source<ModuleSource> {
         let def_map = db.crate_def_map(self.id.krate);
         let src = def_map[self.id.local_id].definition_source(db);
         src.map(|it| match it {
@@ -34,7 +31,7 @@ impl Module {
 
     /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
     /// `None` for the crate root.
-    pub fn declaration_source(self, db: &impl DefDatabase) -> Option<InFile<ast::Module>> {
+    pub fn declaration_source(self, db: &impl DefDatabase) -> Option<Source<ast::Module>> {
         let def_map = db.crate_def_map(self.id.krate);
         def_map[self.id.local_id].declaration_source(db)
     }
@@ -42,7 +39,7 @@ impl Module {
 
 impl HasSource for StructField {
     type Ast = FieldSource;
-    fn source(self, db: &impl DefDatabase) -> InFile<FieldSource> {
+    fn source(self, db: &impl DefDatabase) -> Source<FieldSource> {
         let var = VariantId::from(self.parent);
         let src = var.child_source(db);
         src.map(|it| match it[self.id].clone() {
@@ -53,67 +50,67 @@ impl HasSource for StructField {
 }
 impl HasSource for Struct {
     type Ast = ast::StructDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::StructDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::StructDef> {
         self.id.source(db)
     }
 }
 impl HasSource for Union {
     type Ast = ast::UnionDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::UnionDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::UnionDef> {
         self.id.source(db)
     }
 }
 impl HasSource for Enum {
     type Ast = ast::EnumDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::EnumDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::EnumDef> {
         self.id.source(db)
     }
 }
 impl HasSource for EnumVariant {
     type Ast = ast::EnumVariant;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::EnumVariant> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::EnumVariant> {
         self.parent.id.child_source(db).map(|map| map[self.id].clone())
     }
 }
 impl HasSource for Function {
     type Ast = ast::FnDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::FnDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::FnDef> {
         self.id.lookup(db).source(db)
     }
 }
 impl HasSource for Const {
     type Ast = ast::ConstDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::ConstDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::ConstDef> {
         self.id.lookup(db).source(db)
     }
 }
 impl HasSource for Static {
     type Ast = ast::StaticDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::StaticDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::StaticDef> {
         self.id.lookup(db).source(db)
     }
 }
 impl HasSource for Trait {
     type Ast = ast::TraitDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::TraitDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::TraitDef> {
         self.id.source(db)
     }
 }
 impl HasSource for TypeAlias {
     type Ast = ast::TypeAliasDef;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::TypeAliasDef> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::TypeAliasDef> {
         self.id.lookup(db).source(db)
     }
 }
 impl HasSource for MacroDef {
     type Ast = ast::MacroCall;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::MacroCall> {
-        InFile { file_id: self.id.ast_id.file_id, value: self.id.ast_id.to_node(db) }
+    fn source(self, db: &impl DefDatabase) -> Source<ast::MacroCall> {
+        Source { file_id: self.id.ast_id.file_id(), value: self.id.ast_id.to_node(db) }
     }
 }
 impl HasSource for ImplBlock {
     type Ast = ast::ImplBlock;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::ImplBlock> {
+    fn source(self, db: &impl DefDatabase) -> Source<ast::ImplBlock> {
         self.id.source(db)
     }
 }
@@ -121,7 +118,7 @@ impl HasSource for Import {
     type Ast = Either<ast::UseTree, ast::ExternCrateItem>;
 
     /// Returns the syntax of the last path segment corresponding to this import
-    fn source(self, db: &impl DefDatabase) -> InFile<Self::Ast> {
+    fn source(self, db: &impl DefDatabase) -> Source<Self::Ast> {
         let src = self.parent.definition_source(db);
         let (_, source_map) = db.raw_items_with_source_map(src.file_id);
         let root = db.parse_or_expand(src.file_id).unwrap();
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 82bf641dca..9f7c22b211 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -10,46 +10,46 @@ use ra_syntax::{
 use crate::{
     db::{AstDatabase, DefDatabase, HirDatabase},
     AssocItem, Const, DefWithBody, Enum, EnumVariant, FieldSource, Function, HasSource, ImplBlock,
-    InFile, Local, MacroDef, Module, ModuleDef, ModuleSource, Static, Struct, StructField, Trait,
+    Local, MacroDef, Module, ModuleDef, ModuleSource, Source, Static, Struct, StructField, Trait,
     TypeAlias, Union, VariantDef,
 };
 
 pub trait FromSource: Sized {
     type Ast;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self>;
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self>;
 }
 
 impl FromSource for Struct {
     type Ast = ast::StructDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let id = from_source(db, src)?;
         Some(Struct { id })
     }
 }
 impl FromSource for Union {
     type Ast = ast::UnionDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let id = from_source(db, src)?;
         Some(Union { id })
     }
 }
 impl FromSource for Enum {
     type Ast = ast::EnumDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let id = from_source(db, src)?;
         Some(Enum { id })
     }
 }
 impl FromSource for Trait {
     type Ast = ast::TraitDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let id = from_source(db, src)?;
         Some(Trait { id })
     }
 }
 impl FromSource for Function {
     type Ast = ast::FnDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let items = match Container::find(db, src.as_ref().map(|it| it.syntax()))? {
             Container::Trait(it) => it.items(db),
             Container::ImplBlock(it) => it.items(db),
@@ -76,7 +76,7 @@ impl FromSource for Function {
 
 impl FromSource for Const {
     type Ast = ast::ConstDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let items = match Container::find(db, src.as_ref().map(|it| it.syntax()))? {
             Container::Trait(it) => it.items(db),
             Container::ImplBlock(it) => it.items(db),
@@ -102,7 +102,7 @@ impl FromSource for Const {
 }
 impl FromSource for Static {
     type Ast = ast::StaticDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let module = match Container::find(db, src.as_ref().map(|it| it.syntax()))? {
             Container::Module(it) => it,
             Container::Trait(_) | Container::ImplBlock(_) => return None,
@@ -120,7 +120,7 @@ impl FromSource for Static {
 
 impl FromSource for TypeAlias {
     type Ast = ast::TypeAliasDef;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let items = match Container::find(db, src.as_ref().map(|it| it.syntax()))? {
             Container::Trait(it) => it.items(db),
             Container::ImplBlock(it) => it.items(db),
@@ -147,11 +147,11 @@ impl FromSource for TypeAlias {
 
 impl FromSource for MacroDef {
     type Ast = ast::MacroCall;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let kind = MacroDefKind::Declarative;
 
         let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax()));
-        let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?;
+        let module = Module::from_definition(db, Source::new(src.file_id, module_src))?;
         let krate = module.krate().crate_id();
 
         let ast_id = AstId::new(src.file_id, db.ast_id_map(src.file_id).ast_id(&src.value));
@@ -163,7 +163,7 @@ impl FromSource for MacroDef {
 
 impl FromSource for ImplBlock {
     type Ast = ast::ImplBlock;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let id = from_source(db, src)?;
         Some(ImplBlock { id })
     }
@@ -171,9 +171,9 @@ impl FromSource for ImplBlock {
 
 impl FromSource for EnumVariant {
     type Ast = ast::EnumVariant;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let parent_enum = src.value.parent_enum();
-        let src_enum = InFile { file_id: src.file_id, value: parent_enum };
+        let src_enum = Source { file_id: src.file_id, value: parent_enum };
         let variants = Enum::from_source(db, src_enum)?.variants(db);
         variants.into_iter().find(|v| same_source(&v.source(db), &src))
     }
@@ -181,17 +181,17 @@ impl FromSource for EnumVariant {
 
 impl FromSource for StructField {
     type Ast = FieldSource;
-    fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
+    fn from_source(db: &(impl DefDatabase + AstDatabase), src: Source<Self::Ast>) -> Option<Self> {
         let variant_def: VariantDef = match src.value {
             FieldSource::Named(ref field) => {
                 let value = field.syntax().ancestors().find_map(ast::StructDef::cast)?;
-                let src = InFile { file_id: src.file_id, value };
+                let src = Source { file_id: src.file_id, value };
                 let def = Struct::from_source(db, src)?;
                 VariantDef::from(def)
             }
             FieldSource::Pos(ref field) => {
                 let value = field.syntax().ancestors().find_map(ast::EnumVariant::cast)?;
-                let src = InFile { file_id: src.file_id, value };
+                let src = Source { file_id: src.file_id, value };
                 let def = EnumVariant::from_source(db, src)?;
                 VariantDef::from(def)
             }
@@ -206,14 +206,14 @@ impl FromSource for StructField {
 }
 
 impl Local {
-    pub fn from_source(db: &impl HirDatabase, src: InFile<ast::BindPat>) -> Option<Self> {
+    pub fn from_source(db: &impl HirDatabase, src: Source<ast::BindPat>) -> Option<Self> {
         let file_id = src.file_id;
         let parent: DefWithBody = src.value.syntax().ancestors().find_map(|it| {
             let res = match_ast! {
                 match it {
-                    ast::ConstDef(value) => { Const::from_source(db, InFile { value, file_id})?.into() },
-                    ast::StaticDef(value) => { Static::from_source(db, InFile { value, file_id})?.into() },
-                    ast::FnDef(value) => { Function::from_source(db, InFile { value, file_id})?.into() },
+                    ast::ConstDef(value) => { Const::from_source(db, Source { value, file_id})?.into() },
+                    ast::StaticDef(value) => { Static::from_source(db, Source { value, file_id})?.into() },
+                    ast::FnDef(value) => { Function::from_source(db, Source { value, file_id})?.into() },
                     _ => return None,
                 }
             };
@@ -227,16 +227,16 @@ impl Local {
 }
 
 impl Module {
-    pub fn from_declaration(db: &impl DefDatabase, src: InFile<ast::Module>) -> Option<Self> {
+    pub fn from_declaration(db: &impl DefDatabase, src: Source<ast::Module>) -> Option<Self> {
         let parent_declaration = src.value.syntax().ancestors().skip(1).find_map(ast::Module::cast);
 
         let parent_module = match parent_declaration {
             Some(parent_declaration) => {
-                let src_parent = InFile { file_id: src.file_id, value: parent_declaration };
+                let src_parent = Source { file_id: src.file_id, value: parent_declaration };
                 Module::from_declaration(db, src_parent)
             }
             _ => {
-                let src_parent = InFile {
+                let src_parent = Source {
                     file_id: src.file_id,
                     value: ModuleSource::new(db, Some(src.file_id.original_file(db)), None),
                 };
@@ -248,13 +248,13 @@ impl Module {
         parent_module.child(db, &child_name.as_name())
     }
 
-    pub fn from_definition(db: &impl DefDatabase, src: InFile<ModuleSource>) -> Option<Self> {
+    pub fn from_definition(db: &impl DefDatabase, src: Source<ModuleSource>) -> Option<Self> {
         match src.value {
             ModuleSource::Module(ref module) => {
                 assert!(!module.has_semi());
                 return Module::from_declaration(
                     db,
-                    InFile { file_id: src.file_id, value: module.clone() },
+                    Source { file_id: src.file_id, value: module.clone() },
                 );
             }
             ModuleSource::SourceFile(_) => (),
@@ -271,13 +271,13 @@ impl Module {
     }
 }
 
-fn from_source<N, DEF>(db: &(impl DefDatabase + AstDatabase), src: InFile<N>) -> Option<DEF>
+fn from_source<N, DEF>(db: &(impl DefDatabase + AstDatabase), src: Source<N>) -> Option<DEF>
 where
     N: AstNode,
     DEF: AstItemDef<N>,
 {
     let module_src = ModuleSource::from_child_node(db, src.as_ref().map(|it| it.syntax()));
-    let module = Module::from_definition(db, InFile::new(src.file_id, module_src))?;
+    let module = Module::from_definition(db, Source::new(src.file_id, module_src))?;
     let ctx = LocationCtx::new(db, module.id, src.file_id);
     let items = db.ast_id_map(src.file_id);
     let item_id = items.ast_id(&src.value);
@@ -291,7 +291,7 @@ enum Container {
 }
 
 impl Container {
-    fn find(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option<Container> {
+    fn find(db: &impl DefDatabase, src: Source<&SyntaxNode>) -> Option<Container> {
         // FIXME: this doesn't try to handle nested declarations
         for container in src.value.ancestors() {
             let res = match_ast! {
@@ -322,6 +322,6 @@ impl Container {
 /// In general, we do not guarantee that we have exactly one instance of a
 /// syntax tree for each file. We probably should add such guarantee, but, for
 /// the time being, we will use identity-less AstPtr comparison.
-fn same_source<N: AstNode>(s1: &InFile<N>, s2: &InFile<N>) -> bool {
+fn same_source<N: AstNode>(s1: &Source<N>, s2: &Source<N>) -> bool {
     s1.as_ref().map(AstPtr::new) == s2.as_ref().map(AstPtr::new)
 }
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index 88d2f6e02a..3c12c61f03 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -63,5 +63,5 @@ pub use hir_def::{
     type_ref::Mutability,
 };
 pub use hir_expand::{
-    either::Either, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId, MacroFile,
+    either::Either, name::Name, HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Source,
 };
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 1661d92a2e..76c493f1a8 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -18,7 +18,7 @@ use hir_def::{
     AssocItemId, DefWithBodyId,
 };
 use hir_expand::{
-    hygiene::Hygiene, name::AsName, AstId, HirFileId, InFile, MacroCallId, MacroFileKind,
+    hygiene::Hygiene, name::AsName, AstId, HirFileId, MacroCallId, MacroFileKind, Source,
 };
 use ra_syntax::{
     ast::{self, AstNode},
@@ -37,7 +37,7 @@ use crate::{
     GenericParam, Local, MacroDef, Name, Path, ScopeDef, Static, Struct, Trait, Type, TypeAlias,
 };
 
-fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -> Option<Resolver> {
+fn try_get_resolver_for_node(db: &impl HirDatabase, node: Source<&SyntaxNode>) -> Option<Resolver> {
     match_ast! {
         match (node.value) {
             ast::Module(it) => {
@@ -71,7 +71,7 @@ fn try_get_resolver_for_node(db: &impl HirDatabase, node: InFile<&SyntaxNode>) -
 
 fn def_with_body_from_child_node(
     db: &impl HirDatabase,
-    child: InFile<&SyntaxNode>,
+    child: Source<&SyntaxNode>,
 ) -> Option<DefWithBody> {
     child.value.ancestors().find_map(|node| {
         match_ast! {
@@ -141,8 +141,8 @@ impl Expansion {
     pub fn map_token_down(
         &self,
         db: &impl HirDatabase,
-        token: InFile<&SyntaxToken>,
-    ) -> Option<InFile<SyntaxToken>> {
+        token: Source<&SyntaxToken>,
+    ) -> Option<Source<SyntaxToken>> {
         let exp_info = self.file_id().expansion_info(db)?;
         exp_info.map_token_down(token)
     }
@@ -155,7 +155,7 @@ impl Expansion {
 impl SourceAnalyzer {
     pub fn new(
         db: &impl HirDatabase,
-        node: InFile<&SyntaxNode>,
+        node: Source<&SyntaxNode>,
         offset: Option<TextUnit>,
     ) -> SourceAnalyzer {
         let def_with_body = def_with_body_from_child_node(db, node);
@@ -192,12 +192,12 @@ impl SourceAnalyzer {
     }
 
     fn expr_id(&self, expr: &ast::Expr) -> Option<ExprId> {
-        let src = InFile { file_id: self.file_id, value: expr };
+        let src = Source { file_id: self.file_id, value: expr };
         self.body_source_map.as_ref()?.node_expr(src)
     }
 
     fn pat_id(&self, pat: &ast::Pat) -> Option<PatId> {
-        let src = InFile { file_id: self.file_id, value: pat };
+        let src = Source { file_id: self.file_id, value: pat };
         self.body_source_map.as_ref()?.node_pat(src)
     }
 
@@ -243,7 +243,7 @@ impl SourceAnalyzer {
     pub fn resolve_macro_call(
         &self,
         db: &impl HirDatabase,
-        macro_call: InFile<&ast::MacroCall>,
+        macro_call: Source<&ast::MacroCall>,
     ) -> Option<MacroDef> {
         let hygiene = Hygiene::new(db, macro_call.file_id);
         let path = macro_call.value.path().and_then(|ast| Path::from_src(ast, &hygiene))?;
@@ -318,7 +318,7 @@ impl SourceAnalyzer {
         let name = name_ref.as_name();
         let source_map = self.body_source_map.as_ref()?;
         let scopes = self.scopes.as_ref()?;
-        let scope = scope_for(scopes, source_map, InFile::new(self.file_id, name_ref.syntax()))?;
+        let scope = scope_for(scopes, source_map, Source::new(self.file_id, name_ref.syntax()))?;
         let entry = scopes.resolve_name_in_scope(scope, &name)?;
         Some(ScopeEntryWithSyntax {
             name: entry.name().clone(),
@@ -446,7 +446,7 @@ impl SourceAnalyzer {
     pub fn expand(
         &self,
         db: &impl HirDatabase,
-        macro_call: InFile<&ast::MacroCall>,
+        macro_call: Source<&ast::MacroCall>,
     ) -> Option<Expansion> {
         let def = self.resolve_macro_call(db, macro_call)?.id;
         let ast_id = AstId::new(
@@ -463,19 +463,19 @@ impl SourceAnalyzer {
 fn scope_for(
     scopes: &ExprScopes,
     source_map: &BodySourceMap,
-    node: InFile<&SyntaxNode>,
+    node: Source<&SyntaxNode>,
 ) -> Option<ScopeId> {
     node.value
         .ancestors()
         .filter_map(ast::Expr::cast)
-        .filter_map(|it| source_map.node_expr(InFile::new(node.file_id, &it)))
+        .filter_map(|it| source_map.node_expr(Source::new(node.file_id, &it)))
         .find_map(|it| scopes.scope_for(it))
 }
 
 fn scope_for_offset(
     scopes: &ExprScopes,
     source_map: &BodySourceMap,
-    offset: InFile<TextUnit>,
+    offset: Source<TextUnit>,
 ) -> Option<ScopeId> {
     scopes
         .scope_by_expr()
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index 9ab829aab2..3666529b0c 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -5,13 +5,13 @@ use std::sync::Arc;
 use hir_expand::{
     either::Either,
     name::{AsName, Name},
-    InFile,
+    Source,
 };
 use ra_arena::{map::ArenaMap, Arena};
 use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
 
 use crate::{
-    db::DefDatabase, src::HasChildSource, trace::Trace, type_ref::TypeRef, AstItemDef, EnumId,
+    db::DefDatabase, trace::Trace, type_ref::TypeRef, AstItemDef, EnumId, HasChildSource,
     LocalEnumVariantId, LocalStructFieldId, StructId, UnionId, VariantId,
 };
 
@@ -88,7 +88,7 @@ impl EnumData {
 impl HasChildSource for EnumId {
     type ChildId = LocalEnumVariantId;
     type Value = ast::EnumVariant;
-    fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> {
+    fn child_source(&self, db: &impl DefDatabase) -> Source<ArenaMap<Self::ChildId, Self::Value>> {
         let src = self.source(db);
         let mut trace = Trace::new_for_map();
         lower_enum(&mut trace, &src.value);
@@ -145,7 +145,7 @@ impl HasChildSource for VariantId {
     type ChildId = LocalStructFieldId;
     type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>;
 
-    fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> {
+    fn child_source(&self, db: &impl DefDatabase) -> Source<ArenaMap<Self::ChildId, Self::Value>> {
         let src = match self {
             VariantId::EnumVariantId(it) => {
                 // I don't really like the fact that we call into parent source
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs
index bc7ade9212..fffb22201d 100644
--- a/crates/ra_hir_def/src/attr.rs
+++ b/crates/ra_hir_def/src/attr.rs
@@ -2,7 +2,7 @@
 
 use std::{ops, sync::Arc};
 
-use hir_expand::{either::Either, hygiene::Hygiene, AstId, InFile};
+use hir_expand::{either::Either, hygiene::Hygiene, AstId, Source};
 use mbe::ast_to_token_tree;
 use ra_syntax::{
     ast::{self, AstNode, AttrsOwner},
@@ -11,8 +11,7 @@ use ra_syntax::{
 use tt::Subtree;
 
 use crate::{
-    db::DefDatabase, path::Path, src::HasChildSource, src::HasSource, AdtId, AstItemDef, AttrDefId,
-    Lookup,
+    db::DefDatabase, path::Path, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup,
 };
 
 #[derive(Default, Debug, Clone, PartialEq, Eq)]
@@ -69,7 +68,7 @@ impl Attrs {
         }
     }
 
-    fn from_attrs_owner(db: &impl DefDatabase, owner: InFile<&dyn AttrsOwner>) -> Attrs {
+    fn from_attrs_owner(db: &impl DefDatabase, owner: Source<&dyn AttrsOwner>) -> Attrs {
         let hygiene = Hygiene::new(db, owner.file_id);
         Attrs::new(owner.value, &hygiene)
     }
@@ -158,7 +157,7 @@ where
     N: ast::AttrsOwner,
     D: DefDatabase,
 {
-    let src = InFile::new(src.file_id, src.to_node(db));
+    let src = Source::new(src.file_id(), src.to_node(db));
     Attrs::from_attrs_owner(db, src.as_ref().map(|it| it as &dyn AttrsOwner))
 }
 
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index 69508dd8a5..a57a0176d4 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -6,7 +6,7 @@ pub mod scope;
 use std::{ops::Index, sync::Arc};
 
 use hir_expand::{
-    either::Either, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId, MacroFileKind,
+    either::Either, hygiene::Hygiene, AstId, HirFileId, MacroDefId, MacroFileKind, Source,
 };
 use ra_arena::{map::ArenaMap, Arena};
 use ra_syntax::{ast, AstNode, AstPtr};
@@ -17,8 +17,7 @@ use crate::{
     expr::{Expr, ExprId, Pat, PatId},
     nameres::CrateDefMap,
     path::Path,
-    src::HasSource,
-    DefWithBodyId, HasModule, Lookup, ModuleId,
+    DefWithBodyId, HasModule, HasSource, Lookup, ModuleId,
 };
 
 struct Expander {
@@ -74,8 +73,8 @@ impl Expander {
         std::mem::forget(mark);
     }
 
-    fn to_source<T>(&self, value: T) -> InFile<T> {
-        InFile { file_id: self.current_file_id, value }
+    fn to_source<T>(&self, value: T) -> Source<T> {
+        Source { file_id: self.current_file_id, value }
     }
 
     fn parse_path(&mut self, path: ast::Path) -> Option<Path> {
@@ -116,10 +115,10 @@ pub struct Body {
 }
 
 pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>;
-pub type ExprSource = InFile<ExprPtr>;
+pub type ExprSource = Source<ExprPtr>;
 
 pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>;
-pub type PatSource = InFile<PatPtr>;
+pub type PatSource = Source<PatPtr>;
 
 /// An item body together with the mapping from syntax nodes to HIR expression
 /// IDs. This is needed to go from e.g. a position in a file to the HIR
@@ -206,7 +205,7 @@ impl BodySourceMap {
         self.expr_map_back.get(expr).copied()
     }
 
-    pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> {
+    pub fn node_expr(&self, node: Source<&ast::Expr>) -> Option<ExprId> {
         let src = node.map(|it| Either::A(AstPtr::new(it)));
         self.expr_map.get(&src).cloned()
     }
@@ -215,7 +214,7 @@ impl BodySourceMap {
         self.pat_map_back.get(pat).copied()
     }
 
-    pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> {
+    pub fn node_pat(&self, node: Source<&ast::Pat>) -> Option<PatId> {
         let src = node.map(|it| Either::A(AstPtr::new(it)));
         self.pat_map.get(&src).cloned()
     }
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index be1eaa5234..331736cb23 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -429,19 +429,10 @@ where
                 let index = self.collect_expr_opt(e.index());
                 self.alloc_expr(Expr::Index { base, index }, syntax_ptr)
             }
-            ast::Expr::RangeExpr(e) => {
-                let lhs = e.start().map(|lhs| self.collect_expr(lhs));
-                let rhs = e.end().map(|rhs| self.collect_expr(rhs));
-                match e.op_kind() {
-                    Some(range_type) => {
-                        self.alloc_expr(Expr::Range { lhs, rhs, range_type }, syntax_ptr)
-                    }
-                    None => self.alloc_expr(Expr::Missing, syntax_ptr),
-                }
-            }
 
             // FIXME implement HIR for these:
             ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
+            ast::Expr::RangeExpr(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
             ast::Expr::MacroCall(e) => match self.expander.enter_expand(self.db, e) {
                 Some((mark, expansion)) => {
                     let id = self.collect_expr(expansion);
diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs
index ab6599b23f..625aa39dd0 100644
--- a/crates/ra_hir_def/src/body/scope.rs
+++ b/crates/ra_hir_def/src/body/scope.rs
@@ -171,7 +171,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
 
 #[cfg(test)]
 mod tests {
-    use hir_expand::{name::AsName, InFile};
+    use hir_expand::{name::AsName, Source};
     use ra_db::{fixture::WithFixture, FileId, SourceDatabase};
     use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
     use test_utils::{assert_eq_text, covers, extract_offset};
@@ -211,7 +211,7 @@ mod tests {
         let (_body, source_map) = db.body_with_source_map(function.into());
 
         let expr_id = source_map
-            .node_expr(InFile { file_id: file_id.into(), value: &marker.into() })
+            .node_expr(Source { file_id: file_id.into(), value: &marker.into() })
             .unwrap();
         let scope = scopes.scope_for(expr_id);
 
@@ -318,7 +318,7 @@ mod tests {
         let expr_scope = {
             let expr_ast = name_ref.syntax().ancestors().find_map(ast::Expr::cast).unwrap();
             let expr_id =
-                source_map.node_expr(InFile { file_id: file_id.into(), value: &expr_ast }).unwrap();
+                source_map.node_expr(Source { file_id: file_id.into(), value: &expr_ast }).unwrap();
             scopes.scope_for(expr_id).unwrap()
         };
 
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs
index 095d7064a0..fee10b2375 100644
--- a/crates/ra_hir_def/src/data.rs
+++ b/crates/ra_hir_def/src/data.rs
@@ -10,10 +10,9 @@ use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
 
 use crate::{
     db::DefDatabase,
-    src::HasSource,
     type_ref::{Mutability, TypeRef},
-    AssocItemId, AstItemDef, ConstId, ConstLoc, ContainerId, FunctionId, FunctionLoc, ImplId,
-    Intern, Lookup, StaticId, TraitId, TypeAliasId, TypeAliasLoc,
+    AssocItemId, AstItemDef, ConstId, ConstLoc, ContainerId, FunctionId, FunctionLoc, HasSource,
+    ImplId, Intern, Lookup, StaticId, TraitId, TypeAliasId, TypeAliasLoc,
 };
 
 #[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs
index 0954984298..eda9b2269a 100644
--- a/crates/ra_hir_def/src/diagnostics.rs
+++ b/crates/ra_hir_def/src/diagnostics.rs
@@ -6,7 +6,7 @@ use hir_expand::diagnostics::Diagnostic;
 use ra_db::RelativePathBuf;
 use ra_syntax::{ast, AstPtr, SyntaxNodePtr};
 
-use hir_expand::{HirFileId, InFile};
+use hir_expand::{HirFileId, Source};
 
 #[derive(Debug)]
 pub struct UnresolvedModule {
@@ -19,8 +19,8 @@ impl Diagnostic for UnresolvedModule {
     fn message(&self) -> String {
         "unresolved module".to_string()
     }
-    fn source(&self) -> InFile<SyntaxNodePtr> {
-        InFile { file_id: self.file, value: self.decl.into() }
+    fn source(&self) -> Source<SyntaxNodePtr> {
+        Source { file_id: self.file, value: self.decl.into() }
     }
     fn as_any(&self) -> &(dyn Any + Send + 'static) {
         self
diff --git a/crates/ra_hir_def/src/docs.rs b/crates/ra_hir_def/src/docs.rs
index ec944373da..34ed9b7a5e 100644
--- a/crates/ra_hir_def/src/docs.rs
+++ b/crates/ra_hir_def/src/docs.rs
@@ -8,11 +8,7 @@ use std::sync::Arc;
 use hir_expand::either::Either;
 use ra_syntax::ast;
 
-use crate::{
-    db::DefDatabase,
-    src::{HasChildSource, HasSource},
-    AdtId, AstItemDef, AttrDefId, Lookup,
-};
+use crate::{db::DefDatabase, AdtId, AstItemDef, AttrDefId, HasChildSource, HasSource, Lookup};
 
 /// Holds documentation
 #[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/crates/ra_hir_def/src/expr.rs b/crates/ra_hir_def/src/expr.rs
index 6fad80a8d4..04c1d8f69b 100644
--- a/crates/ra_hir_def/src/expr.rs
+++ b/crates/ra_hir_def/src/expr.rs
@@ -14,7 +14,6 @@
 
 use hir_expand::name::Name;
 use ra_arena::{impl_arena_id, RawId};
-use ra_syntax::ast::RangeOp;
 
 use crate::{
     builtin_type::{BuiltinFloat, BuiltinInt},
@@ -131,11 +130,6 @@ pub enum Expr {
         rhs: ExprId,
         op: Option<BinaryOp>,
     },
-    Range {
-        lhs: Option<ExprId>,
-        rhs: Option<ExprId>,
-        range_type: RangeOp,
-    },
     Index {
         base: ExprId,
         index: ExprId,
@@ -294,14 +288,6 @@ impl Expr {
                 f(*lhs);
                 f(*rhs);
             }
-            Expr::Range { lhs, rhs, .. } => {
-                if let Some(lhs) = rhs {
-                    f(*lhs);
-                }
-                if let Some(rhs) = lhs {
-                    f(*rhs);
-                }
-            }
             Expr::Index { base, index } => {
                 f(*base);
                 f(*index);
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs
index 5f648ffc35..3f94e40e4f 100644
--- a/crates/ra_hir_def/src/generics.rs
+++ b/crates/ra_hir_def/src/generics.rs
@@ -9,9 +9,8 @@ use ra_syntax::ast::{self, NameOwner, TypeBoundsOwner, TypeParamsOwner};
 
 use crate::{
     db::DefDatabase,
-    src::HasSource,
     type_ref::{TypeBound, TypeRef},
-    AdtId, AstItemDef, ContainerId, GenericDefId, Lookup,
+    AdtId, AstItemDef, ContainerId, GenericDefId, HasSource, Lookup,
 };
 
 /// Data about a generic parameter (to a function, struct, impl, ...).
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs
index cfeacfded9..bc55308969 100644
--- a/crates/ra_hir_def/src/lib.rs
+++ b/crates/ra_hir_def/src/lib.rs
@@ -29,8 +29,6 @@ pub mod resolver;
 mod trace;
 pub mod nameres;
 
-pub mod src;
-
 #[cfg(test)]
 mod test_db;
 #[cfg(test)]
@@ -38,8 +36,8 @@ mod marks;
 
 use std::hash::{Hash, Hasher};
 
-use hir_expand::{ast_id_map::FileAstId, db::AstDatabase, AstId, HirFileId, InFile, MacroDefId};
-use ra_arena::{impl_arena_id, RawId};
+use hir_expand::{ast_id_map::FileAstId, db::AstDatabase, AstId, HirFileId, MacroDefId, Source};
+use ra_arena::{impl_arena_id, map::ArenaMap, RawId};
 use ra_db::{impl_intern_key, salsa, CrateId};
 use ra_syntax::{ast, AstNode};
 
@@ -107,10 +105,10 @@ pub trait AstItemDef<N: AstNode>: salsa::InternKey + Clone {
         let loc = ItemLoc { module: ctx.module, ast_id: AstId::new(ctx.file_id, ast_id) };
         Self::intern(ctx.db, loc)
     }
-    fn source(self, db: &(impl AstDatabase + InternDatabase)) -> InFile<N> {
+    fn source(self, db: &(impl AstDatabase + InternDatabase)) -> Source<N> {
         let loc = self.lookup_intern(db);
         let value = loc.ast_id.to_node(db);
-        InFile { file_id: loc.ast_id.file_id, value }
+        Source { file_id: loc.ast_id.file_id(), value }
     }
     fn module(self, db: &impl InternDatabase) -> ModuleId {
         let loc = self.lookup_intern(db);
@@ -516,3 +514,53 @@ impl HasModule for StaticLoc {
         self.container
     }
 }
+
+pub trait HasSource {
+    type Value;
+    fn source(&self, db: &impl db::DefDatabase) -> Source<Self::Value>;
+}
+
+impl HasSource for FunctionLoc {
+    type Value = ast::FnDef;
+
+    fn source(&self, db: &impl db::DefDatabase) -> Source<ast::FnDef> {
+        let node = self.ast_id.to_node(db);
+        Source::new(self.ast_id.file_id(), node)
+    }
+}
+
+impl HasSource for TypeAliasLoc {
+    type Value = ast::TypeAliasDef;
+
+    fn source(&self, db: &impl db::DefDatabase) -> Source<ast::TypeAliasDef> {
+        let node = self.ast_id.to_node(db);
+        Source::new(self.ast_id.file_id(), node)
+    }
+}
+
+impl HasSource for ConstLoc {
+    type Value = ast::ConstDef;
+
+    fn source(&self, db: &impl db::DefDatabase) -> Source<ast::ConstDef> {
+        let node = self.ast_id.to_node(db);
+        Source::new(self.ast_id.file_id(), node)
+    }
+}
+
+impl HasSource for StaticLoc {
+    type Value = ast::StaticDef;
+
+    fn source(&self, db: &impl db::DefDatabase) -> Source<ast::StaticDef> {
+        let node = self.ast_id.to_node(db);
+        Source::new(self.ast_id.file_id(), node)
+    }
+}
+
+pub trait HasChildSource {
+    type ChildId;
+    type Value;
+    fn child_source(
+        &self,
+        db: &impl db::DefDatabase,
+    ) -> Source<ArenaMap<Self::ChildId, Self::Value>>;
+}
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index df42ea84a2..2359386c28 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -58,8 +58,8 @@ mod tests;
 use std::sync::Arc;
 
 use hir_expand::{
-    ast_id_map::FileAstId, diagnostics::DiagnosticSink, either::Either, name::Name, InFile,
-    MacroDefId,
+    ast_id_map::FileAstId, diagnostics::DiagnosticSink, either::Either, name::Name, MacroDefId,
+    Source,
 };
 use once_cell::sync::Lazy;
 use ra_arena::Arena;
@@ -261,21 +261,21 @@ impl ModuleData {
     pub fn definition_source(
         &self,
         db: &impl DefDatabase,
-    ) -> InFile<Either<ast::SourceFile, ast::Module>> {
+    ) -> Source<Either<ast::SourceFile, ast::Module>> {
         if let Some(file_id) = self.definition {
             let sf = db.parse(file_id).tree();
-            return InFile::new(file_id.into(), Either::A(sf));
+            return Source::new(file_id.into(), Either::A(sf));
         }
         let decl = self.declaration.unwrap();
-        InFile::new(decl.file_id, Either::B(decl.to_node(db)))
+        Source::new(decl.file_id(), Either::B(decl.to_node(db)))
     }
 
     /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
     /// `None` for the crate root.
-    pub fn declaration_source(&self, db: &impl DefDatabase) -> Option<InFile<ast::Module>> {
+    pub fn declaration_source(&self, db: &impl DefDatabase) -> Option<Source<ast::Module>> {
         let decl = self.declaration?;
         let value = decl.to_node(db);
-        Some(InFile { file_id: decl.file_id, value })
+        Some(Source { file_id: decl.file_id(), value })
     }
 }
 
@@ -309,7 +309,7 @@ mod diagnostics {
                     }
                     let decl = declaration.to_node(db);
                     sink.push(UnresolvedModule {
-                        file: declaration.file_id,
+                        file: declaration.file_id(),
                         decl: AstPtr::new(&decl),
                         candidate: candidate.clone(),
                     })
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs
index 5196b67cad..6eb106094c 100644
--- a/crates/ra_hir_def/src/nameres/raw.rs
+++ b/crates/ra_hir_def/src/nameres/raw.rs
@@ -22,8 +22,8 @@ use ra_syntax::{
 use test_utils::tested_by;
 
 use crate::{
-    attr::Attrs, db::DefDatabase, path::Path, trace::Trace, FileAstId, HirFileId, InFile,
-    LocalImportId,
+    attr::Attrs, db::DefDatabase, path::Path, trace::Trace, FileAstId, HirFileId, LocalImportId,
+    Source,
 };
 
 /// `RawItems` is a set of top-level items in a file (except for impls).
@@ -313,7 +313,7 @@ impl RawItemsCollector {
 
         let mut buf = Vec::new();
         Path::expand_use_item(
-            InFile { value: use_item, file_id: self.file_id },
+            Source { value: use_item, file_id: self.file_id },
             &self.hygiene,
             |path, use_tree, is_glob, alias| {
                 let import_data = ImportData {
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index ff252fe442..6810a26dbb 100644
--- a/crates/ra_hir_def/src/path.rs
+++ b/crates/ra_hir_def/src/path.rs
@@ -13,7 +13,7 @@ use ra_syntax::{
     AstNode,
 };
 
-use crate::{type_ref::TypeRef, InFile};
+use crate::{type_ref::TypeRef, Source};
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
 pub struct Path {
@@ -67,7 +67,7 @@ pub enum PathKind {
 impl Path {
     /// Calls `cb` with all paths, represented by this use item.
     pub(crate) fn expand_use_item(
-        item_src: InFile<ast::UseItem>,
+        item_src: Source<ast::UseItem>,
         hygiene: &Hygiene,
         mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>),
     ) {
@@ -409,36 +409,6 @@ pub mod known {
         Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::OPS, name::TRY_TYPE])
     }
 
-    pub fn std_ops_range() -> Path {
-        Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::OPS, name::RANGE_TYPE])
-    }
-
-    pub fn std_ops_range_from() -> Path {
-        Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::OPS, name::RANGE_FROM_TYPE])
-    }
-
-    pub fn std_ops_range_full() -> Path {
-        Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::OPS, name::RANGE_FULL_TYPE])
-    }
-
-    pub fn std_ops_range_inclusive() -> Path {
-        Path::from_simple_segments(
-            PathKind::Abs,
-            vec![name::STD, name::OPS, name::RANGE_INCLUSIVE_TYPE],
-        )
-    }
-
-    pub fn std_ops_range_to() -> Path {
-        Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::OPS, name::RANGE_TO_TYPE])
-    }
-
-    pub fn std_ops_range_to_inclusive() -> Path {
-        Path::from_simple_segments(
-            PathKind::Abs,
-            vec![name::STD, name::OPS, name::RANGE_TO_INCLUSIVE_TYPE],
-        )
-    }
-
     pub fn std_result_result() -> Path {
         Path::from_simple_segments(PathKind::Abs, vec![name::STD, name::RESULT, name::RESULT_TYPE])
     }
diff --git a/crates/ra_hir_def/src/src.rs b/crates/ra_hir_def/src/src.rs
deleted file mode 100644
index 27caa02cc4..0000000000
--- a/crates/ra_hir_def/src/src.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-//! Utilities for mapping between hir IDs and the surface syntax.
-
-use hir_expand::InFile;
-use ra_arena::map::ArenaMap;
-use ra_syntax::ast;
-
-use crate::{db::DefDatabase, ConstLoc, FunctionLoc, StaticLoc, TypeAliasLoc};
-
-pub trait HasSource {
-    type Value;
-    fn source(&self, db: &impl DefDatabase) -> InFile<Self::Value>;
-}
-
-impl HasSource for FunctionLoc {
-    type Value = ast::FnDef;
-
-    fn source(&self, db: &impl DefDatabase) -> InFile<ast::FnDef> {
-        let node = self.ast_id.to_node(db);
-        InFile::new(self.ast_id.file_id, node)
-    }
-}
-
-impl HasSource for TypeAliasLoc {
-    type Value = ast::TypeAliasDef;
-
-    fn source(&self, db: &impl DefDatabase) -> InFile<ast::TypeAliasDef> {
-        let node = self.ast_id.to_node(db);
-        InFile::new(self.ast_id.file_id, node)
-    }
-}
-
-impl HasSource for ConstLoc {
-    type Value = ast::ConstDef;
-
-    fn source(&self, db: &impl DefDatabase) -> InFile<ast::ConstDef> {
-        let node = self.ast_id.to_node(db);
-        InFile::new(self.ast_id.file_id, node)
-    }
-}
-
-impl HasSource for StaticLoc {
-    type Value = ast::StaticDef;
-
-    fn source(&self, db: &impl DefDatabase) -> InFile<ast::StaticDef> {
-        let node = self.ast_id.to_node(db);
-        InFile::new(self.ast_id.file_id, node)
-    }
-}
-
-pub trait HasChildSource {
-    type ChildId;
-    type Value;
-    fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>>;
-}
diff --git a/crates/ra_hir_expand/src/diagnostics.rs b/crates/ra_hir_expand/src/diagnostics.rs
index 108c1e38c6..3d37e93358 100644
--- a/crates/ra_hir_expand/src/diagnostics.rs
+++ b/crates/ra_hir_expand/src/diagnostics.rs
@@ -18,11 +18,11 @@ use std::{any::Any, fmt};
 
 use ra_syntax::{SyntaxNode, SyntaxNodePtr, TextRange};
 
-use crate::{db::AstDatabase, InFile};
+use crate::{db::AstDatabase, Source};
 
 pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static {
     fn message(&self) -> String;
-    fn source(&self) -> InFile<SyntaxNodePtr>;
+    fn source(&self) -> Source<SyntaxNodePtr>;
     fn highlight_range(&self) -> TextRange {
         self.source().value.range()
     }
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index fb88d2ac27..b6a739cda5 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -13,7 +13,7 @@ pub mod diagnostics;
 pub mod builtin_macro;
 pub mod quote;
 
-use std::hash::Hash;
+use std::hash::{Hash, Hasher};
 use std::sync::Arc;
 
 use ra_db::{salsa, CrateId, FileId};
@@ -70,7 +70,7 @@ impl HirFileId {
             HirFileIdRepr::FileId(file_id) => file_id,
             HirFileIdRepr::MacroFile(macro_file) => {
                 let loc = db.lookup_intern_macro(macro_file.macro_call_id);
-                loc.ast_id.file_id.original_file(db)
+                loc.ast_id.file_id().original_file(db)
             }
         }
     }
@@ -90,9 +90,9 @@ impl HirFileId {
                 let macro_arg = db.macro_arg(macro_file.macro_call_id)?;
 
                 Some(ExpansionInfo {
-                    expanded: InFile::new(self, parse.syntax_node()),
-                    arg: InFile::new(loc.ast_id.file_id, arg_tt),
-                    def: InFile::new(loc.ast_id.file_id, def_tt),
+                    expanded: Source::new(self, parse.syntax_node()),
+                    arg: Source::new(loc.ast_id.file_id, arg_tt),
+                    def: Source::new(loc.ast_id.file_id, def_tt),
                     macro_arg,
                     macro_def,
                     exp_map,
@@ -167,9 +167,9 @@ impl MacroCallId {
 /// ExpansionInfo mainly describes how to map text range between src and expanded macro
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct ExpansionInfo {
-    expanded: InFile<SyntaxNode>,
-    arg: InFile<ast::TokenTree>,
-    def: InFile<ast::TokenTree>,
+    expanded: Source<SyntaxNode>,
+    arg: Source<ast::TokenTree>,
+    def: Source<ast::TokenTree>,
 
     macro_def: Arc<(db::TokenExpander, mbe::TokenMap)>,
     macro_arg: Arc<(tt::Subtree, mbe::TokenMap)>,
@@ -177,7 +177,7 @@ pub struct ExpansionInfo {
 }
 
 impl ExpansionInfo {
-    pub fn map_token_down(&self, token: InFile<&SyntaxToken>) -> Option<InFile<SyntaxToken>> {
+    pub fn map_token_down(&self, token: Source<&SyntaxToken>) -> Option<Source<SyntaxToken>> {
         assert_eq!(token.file_id, self.arg.file_id);
         let range =
             token.value.text_range().checked_sub(self.arg.value.syntax().text_range().start())?;
@@ -191,7 +191,7 @@ impl ExpansionInfo {
         Some(self.expanded.with_value(token))
     }
 
-    pub fn map_token_up(&self, token: InFile<&SyntaxToken>) -> Option<InFile<SyntaxToken>> {
+    pub fn map_token_up(&self, token: Source<&SyntaxToken>) -> Option<Source<SyntaxToken>> {
         let token_id = self.exp_map.token_by_range(token.value.text_range())?;
 
         let (token_id, origin) = self.macro_def.0.map_id_up(token_id);
@@ -214,42 +214,73 @@ impl ExpansionInfo {
 ///
 /// It is stable across reparses, and can be used as salsa key/value.
 // FIXME: isn't this just a `Source<FileAstId<N>>` ?
-pub type AstId<N> = InFile<FileAstId<N>>;
+#[derive(Debug)]
+pub struct AstId<N: AstNode> {
+    file_id: HirFileId,
+    file_ast_id: FileAstId<N>,
+}
+
+impl<N: AstNode> Clone for AstId<N> {
+    fn clone(&self) -> AstId<N> {
+        *self
+    }
+}
+impl<N: AstNode> Copy for AstId<N> {}
+
+impl<N: AstNode> PartialEq for AstId<N> {
+    fn eq(&self, other: &Self) -> bool {
+        (self.file_id, self.file_ast_id) == (other.file_id, other.file_ast_id)
+    }
+}
+impl<N: AstNode> Eq for AstId<N> {}
+impl<N: AstNode> Hash for AstId<N> {
+    fn hash<H: Hasher>(&self, hasher: &mut H) {
+        (self.file_id, self.file_ast_id).hash(hasher);
+    }
+}
 
 impl<N: AstNode> AstId<N> {
+    pub fn new(file_id: HirFileId, file_ast_id: FileAstId<N>) -> AstId<N> {
+        AstId { file_id, file_ast_id }
+    }
+
+    pub fn file_id(&self) -> HirFileId {
+        self.file_id
+    }
+
     pub fn to_node(&self, db: &dyn db::AstDatabase) -> N {
         let root = db.parse_or_expand(self.file_id).unwrap();
-        db.ast_id_map(self.file_id).get(self.value).to_node(&root)
+        db.ast_id_map(self.file_id).get(self.file_ast_id).to_node(&root)
     }
 }
 
-/// `InFile<T>` stores a value of `T` inside a particular file/syntax tree.
+/// `Source<T>` stores a value of `T` inside a particular file/syntax tree.
 ///
 /// Typical usages are:
 ///
-/// * `InFile<SyntaxNode>` -- syntax node in a file
-/// * `InFile<ast::FnDef>` -- ast node in a file
-/// * `InFile<TextUnit>` -- offset in a file
+/// * `Source<SyntaxNode>` -- syntax node in a file
+/// * `Source<ast::FnDef>` -- ast node in a file
+/// * `Source<TextUnit>` -- offset in a file
 #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
-pub struct InFile<T> {
+pub struct Source<T> {
     pub file_id: HirFileId,
     pub value: T,
 }
 
-impl<T> InFile<T> {
-    pub fn new(file_id: HirFileId, value: T) -> InFile<T> {
-        InFile { file_id, value }
+impl<T> Source<T> {
+    pub fn new(file_id: HirFileId, value: T) -> Source<T> {
+        Source { file_id, value }
     }
 
     // Similarly, naming here is stupid...
-    pub fn with_value<U>(&self, value: U) -> InFile<U> {
-        InFile::new(self.file_id, value)
+    pub fn with_value<U>(&self, value: U) -> Source<U> {
+        Source::new(self.file_id, value)
     }
 
-    pub fn map<F: FnOnce(T) -> U, U>(self, f: F) -> InFile<U> {
-        InFile::new(self.file_id, f(self.value))
+    pub fn map<F: FnOnce(T) -> U, U>(self, f: F) -> Source<U> {
+        Source::new(self.file_id, f(self.value))
     }
-    pub fn as_ref(&self) -> InFile<&T> {
+    pub fn as_ref(&self) -> Source<&T> {
         self.with_value(&self.value)
     }
     pub fn file_syntax(&self, db: &impl db::AstDatabase) -> SyntaxNode {
diff --git a/crates/ra_hir_expand/src/name.rs b/crates/ra_hir_expand/src/name.rs
index 05ba370706..7824489d7f 100644
--- a/crates/ra_hir_expand/src/name.rs
+++ b/crates/ra_hir_expand/src/name.rs
@@ -140,12 +140,6 @@ pub const RESULT_TYPE: Name = Name::new_inline_ascii(6, b"Result");
 pub const OUTPUT_TYPE: Name = Name::new_inline_ascii(6, b"Output");
 pub const TARGET_TYPE: Name = Name::new_inline_ascii(6, b"Target");
 pub const BOX_TYPE: Name = Name::new_inline_ascii(3, b"Box");
-pub const RANGE_FROM_TYPE: Name = Name::new_inline_ascii(9, b"RangeFrom");
-pub const RANGE_FULL_TYPE: Name = Name::new_inline_ascii(9, b"RangeFull");
-pub const RANGE_INCLUSIVE_TYPE: Name = Name::new_inline_ascii(14, b"RangeInclusive");
-pub const RANGE_TO_INCLUSIVE_TYPE: Name = Name::new_inline_ascii(16, b"RangeToInclusive");
-pub const RANGE_TO_TYPE: Name = Name::new_inline_ascii(7, b"RangeTo");
-pub const RANGE_TYPE: Name = Name::new_inline_ascii(5, b"Range");
 
 // Builtin Macros
 pub const FILE_MACRO: Name = Name::new_inline_ascii(4, b"file");
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index 5054189cc1..4a13fac239 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -2,7 +2,7 @@
 
 use std::any::Any;
 
-use hir_expand::{db::AstDatabase, name::Name, HirFileId, InFile};
+use hir_expand::{db::AstDatabase, name::Name, HirFileId, Source};
 use ra_syntax::{ast, AstNode, AstPtr, SyntaxNodePtr};
 
 pub use hir_def::diagnostics::UnresolvedModule;
@@ -19,8 +19,8 @@ impl Diagnostic for NoSuchField {
         "no such field".to_string()
     }
 
-    fn source(&self) -> InFile<SyntaxNodePtr> {
-        InFile { file_id: self.file, value: self.field.into() }
+    fn source(&self) -> Source<SyntaxNodePtr> {
+        Source { file_id: self.file, value: self.field.into() }
     }
 
     fn as_any(&self) -> &(dyn Any + Send + 'static) {
@@ -44,8 +44,8 @@ impl Diagnostic for MissingFields {
         }
         message
     }
-    fn source(&self) -> InFile<SyntaxNodePtr> {
-        InFile { file_id: self.file, value: self.field_list.into() }
+    fn source(&self) -> Source<SyntaxNodePtr> {
+        Source { file_id: self.file, value: self.field_list.into() }
     }
     fn as_any(&self) -> &(dyn Any + Send + 'static) {
         self
@@ -72,8 +72,8 @@ impl Diagnostic for MissingOkInTailExpr {
     fn message(&self) -> String {
         "wrap return expression in Ok".to_string()
     }
-    fn source(&self) -> InFile<SyntaxNodePtr> {
-        InFile { file_id: self.file, value: self.expr.into() }
+    fn source(&self) -> Source<SyntaxNodePtr> {
+        Source { file_id: self.file, value: self.expr.into() }
     }
     fn as_any(&self) -> &(dyn Any + Send + 'static) {
         self
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs
index fe259371f5..1e9f4b208d 100644
--- a/crates/ra_hir_ty/src/infer.rs
+++ b/crates/ra_hir_ty/src/infer.rs
@@ -577,42 +577,6 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
         let struct_ = self.resolver.resolve_known_struct(self.db, &path)?;
         Some(struct_.into())
     }
-
-    fn resolve_range_full(&self) -> Option<AdtId> {
-        let path = known::std_ops_range_full();
-        let struct_ = self.resolver.resolve_known_struct(self.db, &path)?;
-        Some(struct_.into())
-    }
-
-    fn resolve_range(&self) -> Option<AdtId> {
-        let path = known::std_ops_range();
-        let struct_ = self.resolver.resolve_known_struct(self.db, &path)?;
-        Some(struct_.into())
-    }
-
-    fn resolve_range_inclusive(&self) -> Option<AdtId> {
-        let path = known::std_ops_range_inclusive();
-        let struct_ = self.resolver.resolve_known_struct(self.db, &path)?;
-        Some(struct_.into())
-    }
-
-    fn resolve_range_from(&self) -> Option<AdtId> {
-        let path = known::std_ops_range_from();
-        let struct_ = self.resolver.resolve_known_struct(self.db, &path)?;
-        Some(struct_.into())
-    }
-
-    fn resolve_range_to(&self) -> Option<AdtId> {
-        let path = known::std_ops_range_to();
-        let struct_ = self.resolver.resolve_known_struct(self.db, &path)?;
-        Some(struct_.into())
-    }
-
-    fn resolve_range_to_inclusive(&self) -> Option<AdtId> {
-        let path = known::std_ops_range_to_inclusive();
-        let struct_ = self.resolver.resolve_known_struct(self.db, &path)?;
-        Some(struct_.into())
-    }
 }
 
 /// The ID of a type variable.
@@ -729,7 +693,7 @@ impl Expectation {
 }
 
 mod diagnostics {
-    use hir_def::{expr::ExprId, src::HasSource, FunctionId, Lookup};
+    use hir_def::{expr::ExprId, FunctionId, HasSource, Lookup};
     use hir_expand::diagnostics::DiagnosticSink;
 
     use crate::{db::HirDatabase, diagnostics::NoSuchField};
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 4014f4732d..2f9ca4bbbf 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -12,7 +12,6 @@ use hir_def::{
     AdtId, ContainerId, Lookup, StructFieldId,
 };
 use hir_expand::name::{self, Name};
-use ra_syntax::ast::RangeOp;
 
 use crate::{
     autoderef, db::HirDatabase, method_resolution, op, traits::InEnvironment, utils::variant_data,
@@ -416,44 +415,6 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
                 }
                 _ => Ty::Unknown,
             },
-            Expr::Range { lhs, rhs, range_type } => {
-                let lhs_ty = lhs.map(|e| self.infer_expr(e, &Expectation::none()));
-                let rhs_expect = lhs_ty
-                    .as_ref()
-                    .map_or_else(Expectation::none, |ty| Expectation::has_type(ty.clone()));
-                let rhs_ty = rhs.map(|e| self.infer_expr(e, &rhs_expect));
-                match (range_type, lhs_ty, rhs_ty) {
-                    (RangeOp::Exclusive, None, None) => match self.resolve_range_full() {
-                        Some(adt) => Ty::simple(TypeCtor::Adt(adt)),
-                        None => Ty::Unknown,
-                    },
-                    (RangeOp::Exclusive, None, Some(ty)) => match self.resolve_range_to() {
-                        Some(adt) => Ty::apply_one(TypeCtor::Adt(adt), ty),
-                        None => Ty::Unknown,
-                    },
-                    (RangeOp::Inclusive, None, Some(ty)) => {
-                        match self.resolve_range_to_inclusive() {
-                            Some(adt) => Ty::apply_one(TypeCtor::Adt(adt), ty),
-                            None => Ty::Unknown,
-                        }
-                    }
-                    (RangeOp::Exclusive, Some(_), Some(ty)) => match self.resolve_range() {
-                        Some(adt) => Ty::apply_one(TypeCtor::Adt(adt), ty),
-                        None => Ty::Unknown,
-                    },
-                    (RangeOp::Inclusive, Some(_), Some(ty)) => {
-                        match self.resolve_range_inclusive() {
-                            Some(adt) => Ty::apply_one(TypeCtor::Adt(adt), ty),
-                            None => Ty::Unknown,
-                        }
-                    }
-                    (RangeOp::Exclusive, Some(ty), None) => match self.resolve_range_from() {
-                        Some(adt) => Ty::apply_one(TypeCtor::Adt(adt), ty),
-                        None => Ty::Unknown,
-                    },
-                    (RangeOp::Inclusive, _, None) => Ty::Unknown,
-                }
-            }
             Expr::Index { base, index } => {
                 let _base_ty = self.infer_expr(*base, &Expectation::none());
                 let _index_ty = self.infer_expr(*index, &Expectation::none());
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs
index b3c323d38c..d559dc4d0e 100644
--- a/crates/ra_ide/src/call_info.rs
+++ b/crates/ra_ide/src/call_info.rs
@@ -18,7 +18,7 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
     // Find the calling expression and it's NameRef
     let calling_node = FnCallNode::with_node(&syntax, position.offset)?;
     let name_ref = calling_node.name_ref()?;
-    let name_ref = hir::InFile::new(position.file_id.into(), name_ref.syntax());
+    let name_ref = hir::Source::new(position.file_id.into(), name_ref.syntax());
 
     let analyzer = hir::SourceAnalyzer::new(db, name_ref, None);
     let (mut call_info, has_self) = match &calling_node {
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index ca0a483d4b..b8345c91d5 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -54,13 +54,13 @@ impl<'a> CompletionContext<'a> {
         let src = hir::ModuleSource::from_position(db, position);
         let module = hir::Module::from_definition(
             db,
-            hir::InFile { file_id: position.file_id.into(), value: src },
+            hir::Source { file_id: position.file_id.into(), value: src },
         );
         let token =
             original_parse.tree().syntax().token_at_offset(position.offset).left_biased()?;
         let analyzer = hir::SourceAnalyzer::new(
             db,
-            hir::InFile::new(position.file_id.into(), &token.parent()),
+            hir::Source::new(position.file_id.into(), &token.parent()),
             Some(position.offset),
         );
         let mut ctx = CompletionContext {
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index c50a70d990..cc1ccab4b5 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -96,7 +96,7 @@ pub(crate) fn diagnostics(db: &RootDatabase, file_id: FileId) -> Vec<Diagnostic>
     });
     let source_file = db.parse(file_id).tree();
     let src =
-        hir::InFile { file_id: file_id.into(), value: hir::ModuleSource::SourceFile(source_file) };
+        hir::Source { file_id: file_id.into(), value: hir::ModuleSource::SourceFile(source_file) };
     if let Some(m) = hir::Module::from_definition(db, src) {
         m.diagnostics(db, &mut sink);
     };
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index 61dca14ac5..6ac60722b9 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -1,6 +1,6 @@
 //! FIXME: write short doc here
 
-use hir::{AssocItem, Either, FieldSource, HasSource, InFile, ModuleSource};
+use hir::{AssocItem, Either, FieldSource, HasSource, ModuleSource, Source};
 use ra_db::{FileId, SourceDatabase};
 use ra_syntax::{
     ast::{self, DocCommentsOwner, NameOwner},
@@ -141,7 +141,7 @@ impl NavigationTarget {
     /// Allows `NavigationTarget` to be created from a `NameOwner`
     pub(crate) fn from_named(
         db: &RootDatabase,
-        node: InFile<&dyn ast::NameOwner>,
+        node: Source<&dyn ast::NameOwner>,
         docs: Option<String>,
         description: Option<String>,
     ) -> NavigationTarget {
diff --git a/crates/ra_ide/src/expand.rs b/crates/ra_ide/src/expand.rs
index 216d5cfec7..2f1abf509a 100644
--- a/crates/ra_ide/src/expand.rs
+++ b/crates/ra_ide/src/expand.rs
@@ -1,13 +1,13 @@
 //! Utilities to work with files, produced by macros.
 use std::iter::successors;
 
-use hir::InFile;
+use hir::Source;
 use ra_db::FileId;
 use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxToken};
 
 use crate::{db::RootDatabase, FileRange};
 
-pub(crate) fn original_range(db: &RootDatabase, node: InFile<&SyntaxNode>) -> FileRange {
+pub(crate) fn original_range(db: &RootDatabase, node: Source<&SyntaxNode>) -> FileRange {
     let expansion = match node.file_id.expansion_info(db) {
         None => {
             return FileRange {
@@ -44,8 +44,8 @@ pub(crate) fn descend_into_macros(
     db: &RootDatabase,
     file_id: FileId,
     token: SyntaxToken,
-) -> InFile<SyntaxToken> {
-    let src = InFile::new(file_id.into(), token);
+) -> Source<SyntaxToken> {
+    let src = Source::new(file_id.into(), token);
 
     successors(Some(src), |token| {
         let macro_call = token.value.ancestors().find_map(ast::MacroCall::cast)?;
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs
index 862c03304a..abc602244c 100644
--- a/crates/ra_ide/src/expand_macro.rs
+++ b/crates/ra_ide/src/expand_macro.rs
@@ -22,7 +22,7 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<
     let name_ref = find_node_at_offset::<ast::NameRef>(file.syntax(), position.offset)?;
     let mac = name_ref.syntax().ancestors().find_map(ast::MacroCall::cast)?;
 
-    let source = hir::InFile::new(position.file_id.into(), mac.syntax());
+    let source = hir::Source::new(position.file_id.into(), mac.syntax());
     let expanded = expand_macro_recur(db, source, source.with_value(&mac))?;
 
     // FIXME:
@@ -34,8 +34,8 @@ pub(crate) fn expand_macro(db: &RootDatabase, position: FilePosition) -> Option<
 
 fn expand_macro_recur(
     db: &RootDatabase,
-    source: hir::InFile<&SyntaxNode>,
-    macro_call: hir::InFile<&ast::MacroCall>,
+    source: hir::Source<&SyntaxNode>,
+    macro_call: hir::Source<&ast::MacroCall>,
 ) -> Option<SyntaxNode> {
     let analyzer = hir::SourceAnalyzer::new(db, source, None);
     let expansion = analyzer.expand(db, macro_call)?;
@@ -46,7 +46,7 @@ fn expand_macro_recur(
     let mut replaces = FxHashMap::default();
 
     for child in children.into_iter() {
-        let node = hir::InFile::new(macro_file_id, &child);
+        let node = hir::Source::new(macro_file_id, &child);
         if let Some(new_node) = expand_macro_recur(db, source, node) {
             // Replace the whole node if it is root
             // `replace_descendants` will not replace the parent node
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 76a7412076..c10a6c8448 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -1,6 +1,6 @@
 //! FIXME: write short doc here
 
-use hir::{db::AstDatabase, InFile};
+use hir::{db::AstDatabase, Source};
 use ra_syntax::{
     ast::{self, DocCommentsOwner},
     match_ast, AstNode, SyntaxNode,
@@ -58,7 +58,7 @@ impl ReferenceResult {
 
 pub(crate) fn reference_definition(
     db: &RootDatabase,
-    name_ref: InFile<&ast::NameRef>,
+    name_ref: Source<&ast::NameRef>,
 ) -> ReferenceResult {
     use self::ReferenceResult::*;
 
@@ -94,7 +94,7 @@ pub(crate) fn reference_definition(
 
 pub(crate) fn name_definition(
     db: &RootDatabase,
-    name: InFile<&ast::Name>,
+    name: Source<&ast::Name>,
 ) -> Option<Vec<NavigationTarget>> {
     let parent = name.value.syntax().parent()?;
 
@@ -115,7 +115,7 @@ pub(crate) fn name_definition(
     None
 }
 
-fn named_target(db: &RootDatabase, node: InFile<&SyntaxNode>) -> Option<NavigationTarget> {
+fn named_target(db: &RootDatabase, node: Source<&SyntaxNode>) -> Option<NavigationTarget> {
     match_ast! {
         match (node.value) {
             ast::StructDef(it) => {
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index d8185c6889..260a7b8694 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -227,7 +227,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
         .take_while(|it| it.text_range() == leaf_node.text_range())
         .find(|it| ast::Expr::cast(it.clone()).is_some() || ast::Pat::cast(it.clone()).is_some())?;
     let analyzer =
-        hir::SourceAnalyzer::new(db, hir::InFile::new(frange.file_id.into(), &node), None);
+        hir::SourceAnalyzer::new(db, hir::Source::new(frange.file_id.into(), &node), None);
     let ty = if let Some(ty) = ast::Expr::cast(node.clone()).and_then(|e| analyzer.type_of(db, &e))
     {
         ty
diff --git a/crates/ra_ide/src/impls.rs b/crates/ra_ide/src/impls.rs
index 9b165ee2aa..aa480e399b 100644
--- a/crates/ra_ide/src/impls.rs
+++ b/crates/ra_ide/src/impls.rs
@@ -16,7 +16,7 @@ pub(crate) fn goto_implementation(
     let src = hir::ModuleSource::from_position(db, position);
     let module = hir::Module::from_definition(
         db,
-        hir::InFile { file_id: position.file_id.into(), value: src },
+        hir::Source { file_id: position.file_id.into(), value: src },
     )?;
 
     if let Some(nominal_def) = find_node_at_offset::<ast::NominalDef>(&syntax, position.offset) {
@@ -42,15 +42,15 @@ fn impls_for_def(
 ) -> Option<Vec<NavigationTarget>> {
     let ty = match node {
         ast::NominalDef::StructDef(def) => {
-            let src = hir::InFile { file_id: position.file_id.into(), value: def.clone() };
+            let src = hir::Source { file_id: position.file_id.into(), value: def.clone() };
             hir::Struct::from_source(db, src)?.ty(db)
         }
         ast::NominalDef::EnumDef(def) => {
-            let src = hir::InFile { file_id: position.file_id.into(), value: def.clone() };
+            let src = hir::Source { file_id: position.file_id.into(), value: def.clone() };
             hir::Enum::from_source(db, src)?.ty(db)
         }
         ast::NominalDef::UnionDef(def) => {
-            let src = hir::InFile { file_id: position.file_id.into(), value: def.clone() };
+            let src = hir::Source { file_id: position.file_id.into(), value: def.clone() };
             hir::Union::from_source(db, src)?.ty(db)
         }
     };
@@ -73,7 +73,7 @@ fn impls_for_trait(
     node: &ast::TraitDef,
     module: hir::Module,
 ) -> Option<Vec<NavigationTarget>> {
-    let src = hir::InFile { file_id: position.file_id.into(), value: node.clone() };
+    let src = hir::Source { file_id: position.file_id.into(), value: node.clone() };
     let tr = hir::Trait::from_source(db, src)?;
 
     let krate = module.krate();
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 59eced9d73..45149bf0cc 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -38,7 +38,7 @@ fn get_inlay_hints(
     node: &SyntaxNode,
     max_inlay_hint_length: Option<usize>,
 ) -> Option<Vec<InlayHint>> {
-    let analyzer = SourceAnalyzer::new(db, hir::InFile::new(file_id.into(), node), None);
+    let analyzer = SourceAnalyzer::new(db, hir::Source::new(file_id.into(), node), None);
     match_ast! {
         match node {
             ast::LetStmt(it) => {
diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs
index 616d69fce2..6027e7d54d 100644
--- a/crates/ra_ide/src/parent_module.rs
+++ b/crates/ra_ide/src/parent_module.rs
@@ -10,7 +10,7 @@ pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec<Na
     let src = hir::ModuleSource::from_position(db, position);
     let module = match hir::Module::from_definition(
         db,
-        hir::InFile { file_id: position.file_id.into(), value: src },
+        hir::Source { file_id: position.file_id.into(), value: src },
     ) {
         None => return Vec::new(),
         Some(it) => it,
@@ -23,7 +23,7 @@ pub(crate) fn parent_module(db: &RootDatabase, position: FilePosition) -> Vec<Na
 pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> {
     let src = hir::ModuleSource::from_file_id(db, file_id);
     let module =
-        match hir::Module::from_definition(db, hir::InFile { file_id: file_id.into(), value: src })
+        match hir::Module::from_definition(db, hir::Source { file_id: file_id.into(), value: src })
         {
             Some(it) => it,
             None => return Vec::new(),
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index 3e7bfd872e..21a1ea69eb 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -14,7 +14,7 @@ mod name_definition;
 mod rename;
 mod search_scope;
 
-use hir::InFile;
+use hir::Source;
 use once_cell::unsync::Lazy;
 use ra_db::{SourceDatabase, SourceDatabaseExt};
 use ra_prof::profile;
@@ -107,12 +107,12 @@ fn find_name<'a>(
     position: FilePosition,
 ) -> Option<RangeInfo<(String, NameDefinition)>> {
     if let Some(name) = find_node_at_offset::<ast::Name>(&syntax, position.offset) {
-        let def = classify_name(db, InFile::new(position.file_id.into(), &name))?;
+        let def = classify_name(db, Source::new(position.file_id.into(), &name))?;
         let range = name.syntax().text_range();
         return Some(RangeInfo::new(range, (name.text().to_string(), def)));
     }
     let name_ref = find_node_at_offset::<ast::NameRef>(&syntax, position.offset)?;
-    let def = classify_name_ref(db, InFile::new(position.file_id.into(), &name_ref))?;
+    let def = classify_name_ref(db, Source::new(position.file_id.into(), &name_ref))?;
     let range = name_ref.syntax().text_range();
     Some(RangeInfo::new(range, (name_ref.text().to_string(), def)))
 }
@@ -144,7 +144,7 @@ fn process_definition(
                         continue;
                     }
                 }
-                if let Some(d) = classify_name_ref(db, InFile::new(file_id.into(), &name_ref)) {
+                if let Some(d) = classify_name_ref(db, Source::new(file_id.into(), &name_ref)) {
                     if d == def {
                         refs.push(FileRange { file_id, range });
                     }
diff --git a/crates/ra_ide/src/references/classify.rs b/crates/ra_ide/src/references/classify.rs
index b716d32e59..5cea805ec9 100644
--- a/crates/ra_ide/src/references/classify.rs
+++ b/crates/ra_ide/src/references/classify.rs
@@ -1,6 +1,6 @@
 //! Functions that are used to classify an element from its definition or reference.
 
-use hir::{FromSource, InFile, Module, ModuleSource, PathResolution, SourceAnalyzer};
+use hir::{FromSource, Module, ModuleSource, PathResolution, Source, SourceAnalyzer};
 use ra_prof::profile;
 use ra_syntax::{ast, match_ast, AstNode};
 use test_utils::tested_by;
@@ -11,7 +11,7 @@ use super::{
 };
 use crate::db::RootDatabase;
 
-pub(crate) fn classify_name(db: &RootDatabase, name: InFile<&ast::Name>) -> Option<NameDefinition> {
+pub(crate) fn classify_name(db: &RootDatabase, name: Source<&ast::Name>) -> Option<NameDefinition> {
     let _p = profile("classify_name");
     let parent = name.value.syntax().parent()?;
 
@@ -117,7 +117,7 @@ pub(crate) fn classify_name(db: &RootDatabase, name: InFile<&ast::Name>) -> Opti
 
 pub(crate) fn classify_name_ref(
     db: &RootDatabase,
-    name_ref: InFile<&ast::NameRef>,
+    name_ref: Source<&ast::NameRef>,
 ) -> Option<NameDefinition> {
     let _p = profile("classify_name_ref");
 
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index ea6b354c20..d58496049e 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -55,7 +55,7 @@ fn rename_mod(
 ) -> Option<SourceChange> {
     let mut source_file_edits = Vec::new();
     let mut file_system_edits = Vec::new();
-    let module_src = hir::InFile { file_id: position.file_id.into(), value: ast_module.clone() };
+    let module_src = hir::Source { file_id: position.file_id.into(), value: ast_module.clone() };
     if let Some(module) = hir::Module::from_declaration(db, module_src) {
         let src = module.definition_source(db);
         let file_id = src.file_id.original_file(db);
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index e213e1a06d..8039a5164e 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -1,6 +1,6 @@
 //! FIXME: write short doc here
 
-use hir::InFile;
+use hir::Source;
 use itertools::Itertools;
 use ra_db::SourceDatabase;
 use ra_syntax::{
@@ -66,8 +66,8 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Opti
         return None;
     }
     let range = module.syntax().text_range();
-    let src = hir::ModuleSource::from_child_node(db, InFile::new(file_id.into(), &module.syntax()));
-    let module = hir::Module::from_definition(db, InFile::new(file_id.into(), src))?;
+    let src = hir::ModuleSource::from_child_node(db, Source::new(file_id.into(), &module.syntax()));
+    let module = hir::Module::from_definition(db, Source::new(file_id.into(), src))?;
 
     let path = module.path_to_root(db).into_iter().rev().filter_map(|it| it.name(db)).join("::");
     Some(Runnable { range, kind: RunnableKind::TestMod { path } })
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index e6a79541fe..9a3e4c82f6 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -2,7 +2,7 @@
 
 use rustc_hash::{FxHashMap, FxHashSet};
 
-use hir::{InFile, Name};
+use hir::{Name, Source};
 use ra_db::SourceDatabase;
 use ra_prof::profile;
 use ra_syntax::{ast, AstNode, Direction, SyntaxElement, SyntaxKind, SyntaxKind::*, TextRange, T};
@@ -81,7 +81,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
 
                 let name_ref = node.as_node().cloned().and_then(ast::NameRef::cast).unwrap();
                 let name_kind =
-                    classify_name_ref(db, InFile::new(file_id.into(), &name_ref)).map(|d| d.kind);
+                    classify_name_ref(db, Source::new(file_id.into(), &name_ref)).map(|d| d.kind);
 
                 if let Some(Local(local)) = &name_kind {
                     if let Some(name) = local.name(db) {
@@ -95,7 +95,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
             NAME => {
                 let name = node.as_node().cloned().and_then(ast::Name::cast).unwrap();
                 let name_kind =
-                    classify_name(db, InFile::new(file_id.into(), &name)).map(|d| d.kind);
+                    classify_name(db, Source::new(file_id.into(), &name)).map(|d| d.kind);
 
                 if let Some(Local(local)) = &name_kind {
                     if let Some(name) = local.name(db) {
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml
index 21aef842ce..41672eaffe 100644
--- a/crates/ra_lsp_server/Cargo.toml
+++ b/crates/ra_lsp_server/Cargo.toml
@@ -13,7 +13,6 @@ relative-path = "1.0.0"
 serde_json = "1.0.34"
 serde = { version = "1.0.83", features = ["derive"] }
 crossbeam-channel = "0.4"
-flexi_logger = "0.14.0"
 log = "0.4.3"
 lsp-types = { version = "0.61.0", features = ["proposed"] }
 rustc-hash = "1.0"
@@ -27,6 +26,7 @@ lsp-server = "0.3.0"
 ra_project_model = { path = "../ra_project_model" }
 ra_prof = { path = "../ra_prof" }
 ra_vfs_glob = { path = "../ra_vfs_glob" }
+env_logger = { version = "0.7.1", default-features = false, features = ["humantime"] }
 
 [dev-dependencies]
 tempfile = "3"
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index e13c8ca144..8076a7fa5c 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -1,6 +1,5 @@
 //! `ra_lsp_server` binary
 
-use flexi_logger::{Duplicate, Logger};
 use lsp_server::Connection;
 use ra_lsp_server::{show_message, Result, ServerConfig};
 use ra_prof;
@@ -14,11 +13,7 @@ fn main() -> Result<()> {
 fn setup_logging() -> Result<()> {
     std::env::set_var("RUST_BACKTRACE", "short");
 
-    let logger = Logger::with_env_or_str("error").duplicate_to_stderr(Duplicate::All);
-    match std::env::var("RA_LOG_DIR") {
-        Ok(ref v) if v == "1" => logger.log_to_file().directory("log").start()?,
-        _ => logger.start()?,
-    };
+    env_logger::try_init()?;
 
     ra_prof::set_filter(match std::env::var("RA_PROFILE") {
         Ok(spec) => ra_prof::Filter::from_spec(&spec),
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs
index 4c00b8f302..20c251ff45 100644
--- a/crates/ra_tt/src/lib.rs
+++ b/crates/ra_tt/src/lib.rs
@@ -33,14 +33,14 @@ impl TokenId {
     }
 }
 
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub enum TokenTree {
     Leaf(Leaf),
     Subtree(Subtree),
 }
 impl_froms!(TokenTree: Leaf, Subtree);
 
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub enum Leaf {
     Literal(Literal),
     Punct(Punct),
@@ -48,13 +48,13 @@ pub enum Leaf {
 }
 impl_froms!(Leaf: Literal, Punct, Ident);
 
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub struct Subtree {
     pub delimiter: Delimiter,
     pub token_trees: Vec<TokenTree>,
 }
 
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
 pub enum Delimiter {
     Parenthesis,
     Brace,
@@ -62,24 +62,24 @@ pub enum Delimiter {
     None,
 }
 
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub struct Literal {
     pub text: SmolStr,
 }
 
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 pub struct Punct {
     pub char: char,
     pub spacing: Spacing,
 }
 
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
 pub enum Spacing {
     Alone,
     Joint,
 }
 
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, PartialEq, Eq)]
 pub struct Ident {
     pub text: SmolStr,
     pub id: TokenId,
diff --git a/docs/dev/README.md b/docs/dev/README.md
index 0f64d7e5f8..2f6215d6bb 100644
--- a/docs/dev/README.md
+++ b/docs/dev/README.md
@@ -124,9 +124,8 @@ Logging is done by both rust-analyzer and VS Code, so it might be tricky to
 figure out where logs go.
 
 Inside rust-analyzer, we use the standard `log` crate for logging, and
-`flexi_logger` for logging frotend. By default, log goes to stderr (the same as
-with `env_logger`), but the stderr itself is processed by VS Code. To mirror
-logs to a `./log` directory, set `RA_LOG_DIR=1` environmental variable.
+`env_logger` for logging frontend. By default, log goes to stderr, but the
+stderr itself is processed by VS Code.
 
 To see stderr in the running VS Code instance, go to the "Output" tab of the
 panel and select `rust-analyzer`. This shows `eprintln!` as well. Note that


Test patch:
diff --git a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
index e800cc68e4..e11530062d 100644
--- a/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
+++ b/crates/ra_hir_def/src/nameres/tests/mod_resolution.rs
@@ -668,7 +668,7 @@ fn unresolved_module_diagnostics() {
             module: LocalModuleId(
                 0,
             ),
-            declaration: InFile {
+            declaration: AstId {
                 file_id: HirFileId(
                     FileId(
                         FileId(
@@ -676,7 +676,7 @@ fn unresolved_module_diagnostics() {
                         ),
                     ),
                 ),
-                value: FileAstId {
+                file_ast_id: FileAstId {
                     raw: ErasedFileAstId(
                         1,
                     ),
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 4ba87e667a..c8461b447a 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -8,7 +8,7 @@ use hir_def::{
     body::BodySourceMap, db::DefDatabase, nameres::CrateDefMap, AssocItemId, DefWithBodyId,
     LocalModuleId, Lookup, ModuleDefId,
 };
-use hir_expand::InFile;
+use hir_expand::Source;
 use insta::assert_snapshot;
 use ra_db::{fixture::WithFixture, salsa::Database, FilePosition, SourceDatabase};
 use ra_syntax::{
@@ -221,56 +221,6 @@ mod collections {
     assert_eq!("&str", type_at_pos(&db, pos));
 }
 
-#[test]
-fn infer_ranges() {
-    let (db, pos) = TestDB::with_position(
-        r#"
-//- /main.rs crate:main deps:std
-fn test() {
-    let a = ..;
-    let b = 1..;
-    let c = ..2u32;
-    let d = 1..2usize;
-    let e = ..=10;
-    let f = 'a'..='z';
-
-    let t = (a, b, c, d, e, f);
-    t<|>;
-}
-
-//- /std.rs crate:std
-#[prelude_import] use prelude::*;
-mod prelude {}
-
-pub mod ops {
-    pub struct Range<Idx> {
-        pub start: Idx,
-        pub end: Idx,
-    }
-    pub struct RangeFrom<Idx> {
-        pub start: Idx,
-    }
-    struct RangeFull;
-    pub struct RangeInclusive<Idx> {
-        start: Idx,
-        end: Idx,
-        is_empty: u8,
-    }
-    pub struct RangeTo<Idx> {
-        pub end: Idx,
-    }
-    pub struct RangeToInclusive<Idx> {
-        pub end: Idx,
-    }
-}
-"#,
-    );
-    assert_eq!(
-        "(RangeFull, RangeFrom<i32>, RangeTo<u32>, Range<usize>, RangeToInclusive<i32>, RangeInclusive<char>)",
-        type_at_pos(&db, pos),
-    );
-}
-
 #[test]
 fn infer_while_let() {
     let (db, pos) = TestDB::with_position(
@@ -4730,7 +4680,7 @@ fn type_at_pos(db: &TestDB, pos: FilePosition) -> String {
     for decl in crate_def_map[module.local_id].scope.declarations() {
         if let ModuleDefId::FunctionId(func) = decl {
             let (_body, source_map) = db.body_with_source_map(func.into());
-            if let Some(expr_id) = source_map.node_expr(InFile::new(pos.file_id.into(), &expr)) {
+            if let Some(expr_id) = source_map.node_expr(Source::new(pos.file_id.into(), &expr)) {
                 let infer = db.infer(func.into());
                 let ty = &infer[expr_id];
                 return ty.display(db).to_string();
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index 2ba82ab051..29224cbe8e 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -15,7 +15,6 @@ use tempfile::TempDir;
 
 use crate::support::{project, Project};
 
-const LOG: &'static str = "";
 const PROFILE: &'static str = "";
 // const PROFILE: &'static str = "*@3>100";
 
diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs
index 86073b57df..d5ea52fa95 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/support.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs
@@ -7,7 +7,6 @@ use std::{
 };
 
 use crossbeam_channel::{after, select, Receiver};
-use flexi_logger::Logger;
 use lsp_server::{Connection, Message, Notification, Request};
 use lsp_types::{
     notification::{DidOpenTextDocument, Exit},
@@ -53,7 +52,7 @@ impl<'a> Project<'a> {
         let tmp_dir = self.tmp_dir.unwrap_or_else(|| TempDir::new().unwrap());
         static INIT: Once = Once::new();
         INIT.call_once(|| {
-            let _ = Logger::with_env_or_str(crate::LOG).start().unwrap();
+            let _ = env_logger::builder().is_test(true).try_init().unwrap();
             ra_prof::set_filter(if crate::PROFILE.is_empty() {
                 ra_prof::Filter::disabled()
             } else {