aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/assists/src/handlers/fill_match_arms.rs2
-rw-r--r--crates/assists/src/handlers/fix_visibility.rs4
-rw-r--r--crates/assists/src/utils.rs6
-rw-r--r--crates/completion/src/completions/trait_impl.rs4
-rw-r--r--crates/completion/src/render/const_.rs2
-rw-r--r--crates/completion/src/render/function.rs2
-rw-r--r--crates/completion/src/render/macro_.rs2
-rw-r--r--crates/completion/src/render/type_alias.rs2
-rw-r--r--crates/hir/src/code_model.rs4
-rw-r--r--crates/hir/src/has_source.rs30
-rw-r--r--crates/ide/src/diagnostics/fixes.rs6
-rw-r--r--crates/ide/src/display/navigation_target.rs12
-rw-r--r--crates/ide/src/hover.rs8
-rw-r--r--crates/ide_db/src/search.rs24
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs2
15 files changed, 55 insertions, 55 deletions
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs
index cb60a3128..a8efad6d6 100644
--- a/crates/assists/src/handlers/fill_match_arms.rs
+++ b/crates/assists/src/handlers/fill_match_arms.rs
@@ -196,7 +196,7 @@ fn build_pat(db: &RootDatabase, module: hir::Module, var: hir::Variant) -> Optio
196 let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?); 196 let path = mod_path_to_ast(&module.find_use_path(db, ModuleDef::from(var))?);
197 197
198 // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though 198 // FIXME: use HIR for this; it doesn't currently expose struct vs. tuple vs. unit variants though
199 let pat: ast::Pat = match var.source(db).value.kind() { 199 let pat: ast::Pat = match var.source_old(db).value.kind() {
200 ast::StructKind::Tuple(field_list) => { 200 ast::StructKind::Tuple(field_list) => {
201 let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count()); 201 let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count());
202 make::tuple_struct_pat(path, pats).into() 202 make::tuple_struct_pat(path, pats).into()
diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs
index 8558a8ff0..d8150abd9 100644
--- a/crates/assists/src/handlers/fix_visibility.rs
+++ b/crates/assists/src/handlers/fix_visibility.rs
@@ -97,7 +97,7 @@ fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) ->
97 let parent_name = parent.name(ctx.db()); 97 let parent_name = parent.name(ctx.db());
98 let target_module = parent.module(ctx.db()); 98 let target_module = parent.module(ctx.db());
99 99
100 let in_file_source = record_field_def.source(ctx.db()); 100 let in_file_source = record_field_def.source_old(ctx.db());
101 let (offset, current_visibility, target) = match in_file_source.value { 101 let (offset, current_visibility, target) = match in_file_source.value {
102 hir::FieldSource::Named(it) => { 102 hir::FieldSource::Named(it) => {
103 let s = it.syntax(); 103 let s = it.syntax();
@@ -150,7 +150,7 @@ fn target_data_for_def(
150 S: HasSource<Ast = Ast>, 150 S: HasSource<Ast = Ast>,
151 Ast: AstNode + ast::VisibilityOwner, 151 Ast: AstNode + ast::VisibilityOwner,
152 { 152 {
153 let source = x.source(db); 153 let source = x.source_old(db);
154 let in_file_syntax = source.syntax(); 154 let in_file_syntax = source.syntax();
155 let file_id = in_file_syntax.file_id; 155 let file_id = in_file_syntax.file_id;
156 let syntax = in_file_syntax.value; 156 let syntax = in_file_syntax.value;
diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs
index d41084b59..7ee7111ae 100644
--- a/crates/assists/src/utils.rs
+++ b/crates/assists/src/utils.rs
@@ -99,9 +99,9 @@ pub fn filter_assoc_items(
99 items 99 items
100 .iter() 100 .iter()
101 .map(|i| match i { 101 .map(|i| match i {
102 hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(db).value), 102 hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value),
103 hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(db).value), 103 hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value),
104 hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source(db).value), 104 hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value),
105 }) 105 })
106 .filter(has_def_name) 106 .filter(has_def_name)
107 .filter(|it| match it { 107 .filter(|it| match it {
diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs
index c4e0d0669..759253c53 100644
--- a/crates/completion/src/completions/trait_impl.rs
+++ b/crates/completion/src/completions/trait_impl.rs
@@ -156,7 +156,7 @@ fn add_function_impl(
156 }; 156 };
157 let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end()); 157 let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end());
158 158
159 let function_decl = function_declaration(&func.source(ctx.db).value); 159 let function_decl = function_declaration(&func.source_old(ctx.db).value);
160 match ctx.config.snippet_cap { 160 match ctx.config.snippet_cap {
161 Some(cap) => { 161 Some(cap) => {
162 let snippet = format!("{} {{\n $0\n}}", function_decl); 162 let snippet = format!("{} {{\n $0\n}}", function_decl);
@@ -200,7 +200,7 @@ fn add_const_impl(
200 let const_name = const_.name(ctx.db).map(|n| n.to_string()); 200 let const_name = const_.name(ctx.db).map(|n| n.to_string());
201 201
202 if let Some(const_name) = const_name { 202 if let Some(const_name) = const_name {
203 let snippet = make_const_compl_syntax(&const_.source(ctx.db).value); 203 let snippet = make_const_compl_syntax(&const_.source_old(ctx.db).value);
204 204
205 let range = TextRange::new(const_def_node.text_range().start(), ctx.source_range().end()); 205 let range = TextRange::new(const_def_node.text_range().start(), ctx.source_range().end());
206 206
diff --git a/crates/completion/src/render/const_.rs b/crates/completion/src/render/const_.rs
index 039bdabc0..a8820a4fe 100644
--- a/crates/completion/src/render/const_.rs
+++ b/crates/completion/src/render/const_.rs
@@ -27,7 +27,7 @@ struct ConstRender<'a> {
27 27
28impl<'a> ConstRender<'a> { 28impl<'a> ConstRender<'a> {
29 fn new(ctx: RenderContext<'a>, const_: hir::Const) -> ConstRender<'a> { 29 fn new(ctx: RenderContext<'a>, const_: hir::Const) -> ConstRender<'a> {
30 let ast_node = const_.source(ctx.db()).value; 30 let ast_node = const_.source_old(ctx.db()).value;
31 ConstRender { ctx, const_, ast_node } 31 ConstRender { ctx, const_, ast_node }
32 } 32 }
33 33
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs
index 316e05b52..d9ea425a0 100644
--- a/crates/completion/src/render/function.rs
+++ b/crates/completion/src/render/function.rs
@@ -34,7 +34,7 @@ impl<'a> FunctionRender<'a> {
34 fn_: hir::Function, 34 fn_: hir::Function,
35 ) -> FunctionRender<'a> { 35 ) -> FunctionRender<'a> {
36 let name = local_name.unwrap_or_else(|| fn_.name(ctx.db()).to_string()); 36 let name = local_name.unwrap_or_else(|| fn_.name(ctx.db()).to_string());
37 let ast_node = fn_.source(ctx.db()).value; 37 let ast_node = fn_.source_old(ctx.db()).value;
38 38
39 FunctionRender { ctx, name, func: fn_, ast_node } 39 FunctionRender { ctx, name, func: fn_, ast_node }
40 } 40 }
diff --git a/crates/completion/src/render/macro_.rs b/crates/completion/src/render/macro_.rs
index dac79592f..3d13fd9e2 100644
--- a/crates/completion/src/render/macro_.rs
+++ b/crates/completion/src/render/macro_.rs
@@ -96,7 +96,7 @@ impl<'a> MacroRender<'a> {
96 } 96 }
97 97
98 fn detail(&self) -> String { 98 fn detail(&self) -> String {
99 let ast_node = self.macro_.source(self.ctx.db()).value; 99 let ast_node = self.macro_.source_old(self.ctx.db()).value;
100 macro_label(&ast_node) 100 macro_label(&ast_node)
101 } 101 }
102} 102}
diff --git a/crates/completion/src/render/type_alias.rs b/crates/completion/src/render/type_alias.rs
index 9605c7fa9..4099a5d0e 100644
--- a/crates/completion/src/render/type_alias.rs
+++ b/crates/completion/src/render/type_alias.rs
@@ -27,7 +27,7 @@ struct TypeAliasRender<'a> {
27 27
28impl<'a> TypeAliasRender<'a> { 28impl<'a> TypeAliasRender<'a> {
29 fn new(ctx: RenderContext<'a>, type_alias: hir::TypeAlias) -> TypeAliasRender<'a> { 29 fn new(ctx: RenderContext<'a>, type_alias: hir::TypeAlias) -> TypeAliasRender<'a> {
30 let ast_node = type_alias.source(ctx.db()).value; 30 let ast_node = type_alias.source_old(ctx.db()).value;
31 TypeAliasRender { ctx, type_alias, ast_node } 31 TypeAliasRender { ctx, type_alias, ast_node }
32 } 32 }
33 33
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 97b7a8b5f..5020aa196 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -989,7 +989,7 @@ impl MacroDef {
989 if self.is_proc_macro() { 989 if self.is_proc_macro() {
990 return None; 990 return None;
991 } 991 }
992 self.source(db).value.name().map(|it| it.as_name()) 992 self.source_old(db).value.name().map(|it| it.as_name())
993 } 993 }
994 994
995 /// Indicate it is a proc-macro 995 /// Indicate it is a proc-macro
@@ -1378,7 +1378,7 @@ impl Impl {
1378 } 1378 }
1379 1379
1380 pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> { 1380 pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> {
1381 let src = self.source(db); 1381 let src = self.source_old(db);
1382 let item = src.file_id.is_builtin_derive(db.upcast())?; 1382 let item = src.file_id.is_builtin_derive(db.upcast())?;
1383 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id); 1383 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id);
1384 1384
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index dd7c0c570..a8256c181 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -16,7 +16,7 @@ use crate::{
16 16
17pub trait HasSource { 17pub trait HasSource {
18 type Ast; 18 type Ast;
19 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast>; 19 fn source_old(self, db: &dyn HirDatabase) -> InFile<Self::Ast>;
20} 20}
21 21
22/// NB: Module is !HasSource, because it has two source nodes at the same time: 22/// NB: Module is !HasSource, because it has two source nodes at the same time:
@@ -46,7 +46,7 @@ impl Module {
46 46
47impl HasSource for Field { 47impl HasSource for Field {
48 type Ast = FieldSource; 48 type Ast = FieldSource;
49 fn source(self, db: &dyn HirDatabase) -> InFile<FieldSource> { 49 fn source_old(self, db: &dyn HirDatabase) -> InFile<FieldSource> {
50 let var = VariantId::from(self.parent); 50 let var = VariantId::from(self.parent);
51 let src = var.child_source(db.upcast()); 51 let src = var.child_source(db.upcast());
52 src.map(|it| match it[self.id].clone() { 52 src.map(|it| match it[self.id].clone() {
@@ -57,61 +57,61 @@ impl HasSource for Field {
57} 57}
58impl HasSource for Struct { 58impl HasSource for Struct {
59 type Ast = ast::Struct; 59 type Ast = ast::Struct;
60 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Struct> { 60 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Struct> {
61 self.id.lookup(db.upcast()).source(db.upcast()) 61 self.id.lookup(db.upcast()).source(db.upcast())
62 } 62 }
63} 63}
64impl HasSource for Union { 64impl HasSource for Union {
65 type Ast = ast::Union; 65 type Ast = ast::Union;
66 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Union> { 66 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Union> {
67 self.id.lookup(db.upcast()).source(db.upcast()) 67 self.id.lookup(db.upcast()).source(db.upcast())
68 } 68 }
69} 69}
70impl HasSource for Enum { 70impl HasSource for Enum {
71 type Ast = ast::Enum; 71 type Ast = ast::Enum;
72 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Enum> { 72 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Enum> {
73 self.id.lookup(db.upcast()).source(db.upcast()) 73 self.id.lookup(db.upcast()).source(db.upcast())
74 } 74 }
75} 75}
76impl HasSource for Variant { 76impl HasSource for Variant {
77 type Ast = ast::Variant; 77 type Ast = ast::Variant;
78 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Variant> { 78 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Variant> {
79 self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone()) 79 self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone())
80 } 80 }
81} 81}
82impl HasSource for Function { 82impl HasSource for Function {
83 type Ast = ast::Fn; 83 type Ast = ast::Fn;
84 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Fn> { 84 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Fn> {
85 self.id.lookup(db.upcast()).source(db.upcast()) 85 self.id.lookup(db.upcast()).source(db.upcast())
86 } 86 }
87} 87}
88impl HasSource for Const { 88impl HasSource for Const {
89 type Ast = ast::Const; 89 type Ast = ast::Const;
90 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Const> { 90 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Const> {
91 self.id.lookup(db.upcast()).source(db.upcast()) 91 self.id.lookup(db.upcast()).source(db.upcast())
92 } 92 }
93} 93}
94impl HasSource for Static { 94impl HasSource for Static {
95 type Ast = ast::Static; 95 type Ast = ast::Static;
96 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Static> { 96 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Static> {
97 self.id.lookup(db.upcast()).source(db.upcast()) 97 self.id.lookup(db.upcast()).source(db.upcast())
98 } 98 }
99} 99}
100impl HasSource for Trait { 100impl HasSource for Trait {
101 type Ast = ast::Trait; 101 type Ast = ast::Trait;
102 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Trait> { 102 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Trait> {
103 self.id.lookup(db.upcast()).source(db.upcast()) 103 self.id.lookup(db.upcast()).source(db.upcast())
104 } 104 }
105} 105}
106impl HasSource for TypeAlias { 106impl HasSource for TypeAlias {
107 type Ast = ast::TypeAlias; 107 type Ast = ast::TypeAlias;
108 fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAlias> { 108 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::TypeAlias> {
109 self.id.lookup(db.upcast()).source(db.upcast()) 109 self.id.lookup(db.upcast()).source(db.upcast())
110 } 110 }
111} 111}
112impl HasSource for MacroDef { 112impl HasSource for MacroDef {
113 type Ast = ast::Macro; 113 type Ast = ast::Macro;
114 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Macro> { 114 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Macro> {
115 InFile { 115 InFile {
116 file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id, 116 file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id,
117 value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db.upcast()), 117 value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db.upcast()),
@@ -120,14 +120,14 @@ impl HasSource for MacroDef {
120} 120}
121impl HasSource for Impl { 121impl HasSource for Impl {
122 type Ast = ast::Impl; 122 type Ast = ast::Impl;
123 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Impl> { 123 fn source_old(self, db: &dyn HirDatabase) -> InFile<ast::Impl> {
124 self.id.lookup(db.upcast()).source(db.upcast()) 124 self.id.lookup(db.upcast()).source(db.upcast())
125 } 125 }
126} 126}
127 127
128impl HasSource for TypeParam { 128impl HasSource for TypeParam {
129 type Ast = Either<ast::Trait, ast::TypeParam>; 129 type Ast = Either<ast::Trait, ast::TypeParam>;
130 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { 130 fn source_old(self, db: &dyn HirDatabase) -> InFile<Self::Ast> {
131 let child_source = self.id.parent.child_source(db.upcast()); 131 let child_source = self.id.parent.child_source(db.upcast());
132 child_source.map(|it| it[self.id.local_id].clone()) 132 child_source.map(|it| it[self.id.local_id].clone())
133 } 133 }
@@ -135,7 +135,7 @@ impl HasSource for TypeParam {
135 135
136impl HasSource for LifetimeParam { 136impl HasSource for LifetimeParam {
137 type Ast = ast::LifetimeParam; 137 type Ast = ast::LifetimeParam;
138 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { 138 fn source_old(self, db: &dyn HirDatabase) -> InFile<Self::Ast> {
139 let child_source = self.id.parent.child_source(db.upcast()); 139 let child_source = self.id.parent.child_source(db.upcast());
140 child_source.map(|it| it[self.id.local_id].clone()) 140 child_source.map(|it| it[self.id.local_id].clone())
141 } 141 }
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index d79f5c170..702e8239d 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -156,20 +156,20 @@ fn missing_record_expr_field_fix(
156 let record_fields = match VariantDef::from(def_id) { 156 let record_fields = match VariantDef::from(def_id) {
157 VariantDef::Struct(s) => { 157 VariantDef::Struct(s) => {
158 module = s.module(sema.db); 158 module = s.module(sema.db);
159 let source = s.source(sema.db); 159 let source = s.source_old(sema.db);
160 def_file_id = source.file_id; 160 def_file_id = source.file_id;
161 let fields = source.value.field_list()?; 161 let fields = source.value.field_list()?;
162 record_field_list(fields)? 162 record_field_list(fields)?
163 } 163 }
164 VariantDef::Union(u) => { 164 VariantDef::Union(u) => {
165 module = u.module(sema.db); 165 module = u.module(sema.db);
166 let source = u.source(sema.db); 166 let source = u.source_old(sema.db);
167 def_file_id = source.file_id; 167 def_file_id = source.file_id;
168 source.value.record_field_list()? 168 source.value.record_field_list()?
169 } 169 }
170 VariantDef::Variant(e) => { 170 VariantDef::Variant(e) => {
171 module = e.module(sema.db); 171 module = e.module(sema.db);
172 let source = e.source(sema.db); 172 let source = e.source_old(sema.db);
173 def_file_id = source.file_id; 173 def_file_id = source.file_id;
174 let fields = source.value.field_list()?; 174 let fields = source.value.field_list()?;
175 record_field_list(fields)? 175 record_field_list(fields)?
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index bcde2b6f1..de4c0fa12 100644
--- a/crates/ide/src/display/navigation_target.rs
+++ b/crates/ide/src/display/navigation_target.rs
@@ -285,7 +285,7 @@ where
285 D::Ast: ast::NameOwner + ShortLabel, 285 D::Ast: ast::NameOwner + ShortLabel,
286{ 286{
287 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 287 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
288 let src = self.source(db); 288 let src = self.source_old(db);
289 let mut res = NavigationTarget::from_named( 289 let mut res = NavigationTarget::from_named(
290 db, 290 db,
291 src.as_ref().map(|it| it as &dyn ast::NameOwner), 291 src.as_ref().map(|it| it as &dyn ast::NameOwner),
@@ -314,7 +314,7 @@ impl ToNav for hir::Module {
314 314
315impl ToNav for hir::Impl { 315impl ToNav for hir::Impl {
316 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 316 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
317 let src = self.source(db); 317 let src = self.source_old(db);
318 let derive_attr = self.is_builtin_derive(db); 318 let derive_attr = self.is_builtin_derive(db);
319 let frange = if let Some(item) = &derive_attr { 319 let frange = if let Some(item) = &derive_attr {
320 item.syntax().original_file_range(db) 320 item.syntax().original_file_range(db)
@@ -339,7 +339,7 @@ impl ToNav for hir::Impl {
339 339
340impl ToNav for hir::Field { 340impl ToNav for hir::Field {
341 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 341 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
342 let src = self.source(db); 342 let src = self.source_old(db);
343 343
344 match &src.value { 344 match &src.value {
345 FieldSource::Named(it) => { 345 FieldSource::Named(it) => {
@@ -365,7 +365,7 @@ impl ToNav for hir::Field {
365 365
366impl ToNav for hir::MacroDef { 366impl ToNav for hir::MacroDef {
367 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 367 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
368 let src = self.source(db); 368 let src = self.source_old(db);
369 log::debug!("nav target {:#?}", src.value.syntax()); 369 log::debug!("nav target {:#?}", src.value.syntax());
370 let mut res = NavigationTarget::from_named( 370 let mut res = NavigationTarget::from_named(
371 db, 371 db,
@@ -448,7 +448,7 @@ impl ToNav for hir::Label {
448 448
449impl ToNav for hir::TypeParam { 449impl ToNav for hir::TypeParam {
450 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 450 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
451 let src = self.source(db); 451 let src = self.source_old(db);
452 let full_range = match &src.value { 452 let full_range = match &src.value {
453 Either::Left(it) => it.syntax().text_range(), 453 Either::Left(it) => it.syntax().text_range(),
454 Either::Right(it) => it.syntax().text_range(), 454 Either::Right(it) => it.syntax().text_range(),
@@ -472,7 +472,7 @@ impl ToNav for hir::TypeParam {
472 472
473impl ToNav for hir::LifetimeParam { 473impl ToNav for hir::LifetimeParam {
474 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 474 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
475 let src = self.source(db); 475 let src = self.source_old(db);
476 let full_range = src.value.syntax().text_range(); 476 let full_range = src.value.syntax().text_range();
477 NavigationTarget { 477 NavigationTarget {
478 file_id: src.file_id.original_file(db), 478 file_id: src.file_id.original_file(db),
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 98c7bfbe5..90781ea34 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -206,7 +206,7 @@ fn runnable_action(
206 _ => None, 206 _ => None,
207 }, 207 },
208 ModuleDef::Function(it) => { 208 ModuleDef::Function(it) => {
209 let src = it.source(sema.db); 209 let src = it.source_old(sema.db);
210 if src.file_id != file_id.into() { 210 if src.file_id != file_id.into() {
211 mark::hit!(hover_macro_generated_struct_fn_doc_comment); 211 mark::hit!(hover_macro_generated_struct_fn_doc_comment);
212 mark::hit!(hover_macro_generated_struct_fn_doc_attr); 212 mark::hit!(hover_macro_generated_struct_fn_doc_attr);
@@ -332,11 +332,11 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
332 if it.is_proc_macro() { 332 if it.is_proc_macro() {
333 return None; 333 return None;
334 } 334 }
335 let label = macro_label(&it.source(db).value); 335 let label = macro_label(&it.source_old(db).value);
336 from_def_source_labeled(db, it, Some(label), mod_path) 336 from_def_source_labeled(db, it, Some(label), mod_path)
337 } 337 }
338 Definition::Field(def) => { 338 Definition::Field(def) => {
339 let src = def.source(db).value; 339 let src = def.source_old(db).value;
340 if let FieldSource::Named(it) = src { 340 if let FieldSource::Named(it) = src {
341 from_def_source_labeled(db, def, it.short_label(), mod_path) 341 from_def_source_labeled(db, def, it.short_label(), mod_path)
342 } else { 342 } else {
@@ -385,7 +385,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
385 D: HasSource<Ast = A> + HasAttrs + Copy, 385 D: HasSource<Ast = A> + HasAttrs + Copy,
386 A: ShortLabel, 386 A: ShortLabel,
387 { 387 {
388 let short_label = def.source(db).value.short_label(); 388 let short_label = def.source_old(db).value.short_label();
389 from_def_source_labeled(db, def, short_label, mod_path) 389 from_def_source_labeled(db, def, short_label, mod_path)
390 } 390 }
391 391
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index ff10f71c3..2df4894a1 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -121,9 +121,9 @@ impl Definition {
121 121
122 if let Definition::Local(var) = self { 122 if let Definition::Local(var) = self {
123 let range = match var.parent(db) { 123 let range = match var.parent(db) {
124 DefWithBody::Function(f) => f.source(db).value.syntax().text_range(), 124 DefWithBody::Function(f) => f.source_old(db).value.syntax().text_range(),
125 DefWithBody::Const(c) => c.source(db).value.syntax().text_range(), 125 DefWithBody::Const(c) => c.source_old(db).value.syntax().text_range(),
126 DefWithBody::Static(s) => s.source(db).value.syntax().text_range(), 126 DefWithBody::Static(s) => s.source_old(db).value.syntax().text_range(),
127 }; 127 };
128 let mut res = FxHashMap::default(); 128 let mut res = FxHashMap::default();
129 res.insert(file_id, Some(range)); 129 res.insert(file_id, Some(range));
@@ -132,17 +132,17 @@ impl Definition {
132 132
133 if let Definition::LifetimeParam(param) = self { 133 if let Definition::LifetimeParam(param) = self {
134 let range = match param.parent(db) { 134 let range = match param.parent(db) {
135 hir::GenericDef::Function(it) => it.source(db).value.syntax().text_range(), 135 hir::GenericDef::Function(it) => it.source_old(db).value.syntax().text_range(),
136 hir::GenericDef::Adt(it) => match it { 136 hir::GenericDef::Adt(it) => match it {
137 hir::Adt::Struct(it) => it.source(db).value.syntax().text_range(), 137 hir::Adt::Struct(it) => it.source_old(db).value.syntax().text_range(),
138 hir::Adt::Union(it) => it.source(db).value.syntax().text_range(), 138 hir::Adt::Union(it) => it.source_old(db).value.syntax().text_range(),
139 hir::Adt::Enum(it) => it.source(db).value.syntax().text_range(), 139 hir::Adt::Enum(it) => it.source_old(db).value.syntax().text_range(),
140 }, 140 },
141 hir::GenericDef::Trait(it) => it.source(db).value.syntax().text_range(), 141 hir::GenericDef::Trait(it) => it.source_old(db).value.syntax().text_range(),
142 hir::GenericDef::TypeAlias(it) => it.source(db).value.syntax().text_range(), 142 hir::GenericDef::TypeAlias(it) => it.source_old(db).value.syntax().text_range(),
143 hir::GenericDef::Impl(it) => it.source(db).value.syntax().text_range(), 143 hir::GenericDef::Impl(it) => it.source_old(db).value.syntax().text_range(),
144 hir::GenericDef::Variant(it) => it.source(db).value.syntax().text_range(), 144 hir::GenericDef::Variant(it) => it.source_old(db).value.syntax().text_range(),
145 hir::GenericDef::Const(it) => it.source(db).value.syntax().text_range(), 145 hir::GenericDef::Const(it) => it.source_old(db).value.syntax().text_range(),
146 }; 146 };
147 let mut res = FxHashMap::default(); 147 let mut res = FxHashMap::default();
148 res.insert(file_id, Some(range)); 148 res.insert(file_id, Some(range));
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index a23fb7a33..3ee11a8f0 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -161,7 +161,7 @@ impl AnalysisStatsCmd {
161 } 161 }
162 let mut msg = format!("processing: {}", full_name); 162 let mut msg = format!("processing: {}", full_name);
163 if verbosity.is_verbose() { 163 if verbosity.is_verbose() {
164 let src = f.source(db); 164 let src = f.source_old(db);
165 let original_file = src.file_id.original_file(db); 165 let original_file = src.file_id.original_file(db);
166 let path = vfs.file_path(original_file); 166 let path = vfs.file_path(original_file);
167 let syntax_range = src.value.syntax().text_range(); 167 let syntax_range = src.value.syntax().text_range();