aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/assists/src/handlers/fill_match_arms.rs1
-rw-r--r--crates/assists/src/handlers/fix_visibility.rs2
-rw-r--r--crates/assists/src/utils.rs11
-rw-r--r--crates/completion/src/completions/trait_impl.rs2
-rw-r--r--crates/completion/src/render/const_.rs1
-rw-r--r--crates/completion/src/render/function.rs1
-rw-r--r--crates/completion/src/render/macro_.rs1
-rw-r--r--crates/completion/src/render/type_alias.rs1
-rw-r--r--crates/hir/src/code_model.rs2
-rw-r--r--crates/hir/src/has_source.rs1
-rw-r--r--crates/ide/src/diagnostics/fixes.rs3
-rw-r--r--crates/ide/src/display/navigation_target.rs6
-rw-r--r--crates/ide/src/hover.rs4
-rw-r--r--crates/ide_db/src/search.rs2
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs1
15 files changed, 35 insertions, 4 deletions
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs
index a8efad6d6..d17c82e18 100644
--- a/crates/assists/src/handlers/fill_match_arms.rs
+++ b/crates/assists/src/handlers/fill_match_arms.rs
@@ -196,6 +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 #[allow(deprecated)]
199 let pat: ast::Pat = match var.source_old(db).value.kind() { 200 let pat: ast::Pat = match var.source_old(db).value.kind() {
200 ast::StructKind::Tuple(field_list) => { 201 ast::StructKind::Tuple(field_list) => {
201 let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count()); 202 let pats = iter::repeat(make::wildcard_pat().into()).take(field_list.fields().count());
diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs
index d8150abd9..7d440d420 100644
--- a/crates/assists/src/handlers/fix_visibility.rs
+++ b/crates/assists/src/handlers/fix_visibility.rs
@@ -97,6 +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 #[allow(deprecated)]
100 let in_file_source = record_field_def.source_old(ctx.db()); 101 let in_file_source = record_field_def.source_old(ctx.db());
101 let (offset, current_visibility, target) = match in_file_source.value { 102 let (offset, current_visibility, target) = match in_file_source.value {
102 hir::FieldSource::Named(it) => { 103 hir::FieldSource::Named(it) => {
@@ -150,6 +151,7 @@ fn target_data_for_def(
150 S: HasSource<Ast = Ast>, 151 S: HasSource<Ast = Ast>,
151 Ast: AstNode + ast::VisibilityOwner, 152 Ast: AstNode + ast::VisibilityOwner,
152 { 153 {
154 #[allow(deprecated)]
153 let source = x.source_old(db); 155 let source = x.source_old(db);
154 let in_file_syntax = source.syntax(); 156 let in_file_syntax = source.syntax();
155 let file_id = in_file_syntax.file_id; 157 let file_id = in_file_syntax.file_id;
diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs
index 7ee7111ae..d15e5a24b 100644
--- a/crates/assists/src/utils.rs
+++ b/crates/assists/src/utils.rs
@@ -98,10 +98,13 @@ pub fn filter_assoc_items(
98 98
99 items 99 items
100 .iter() 100 .iter()
101 .map(|i| match i { 101 .map(|i| {
102 hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value), 102 #[allow(deprecated)]
103 hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value), 103 match i {
104 hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value), 104 hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source_old(db).value),
105 hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source_old(db).value),
106 hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source_old(db).value),
107 }
105 }) 108 })
106 .filter(has_def_name) 109 .filter(has_def_name)
107 .filter(|it| match it { 110 .filter(|it| match it {
diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs
index 759253c53..43b3d939f 100644
--- a/crates/completion/src/completions/trait_impl.rs
+++ b/crates/completion/src/completions/trait_impl.rs
@@ -156,6 +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 #[allow(deprecated)]
159 let function_decl = function_declaration(&func.source_old(ctx.db).value); 160 let function_decl = function_declaration(&func.source_old(ctx.db).value);
160 match ctx.config.snippet_cap { 161 match ctx.config.snippet_cap {
161 Some(cap) => { 162 Some(cap) => {
@@ -200,6 +201,7 @@ fn add_const_impl(
200 let const_name = const_.name(ctx.db).map(|n| n.to_string()); 201 let const_name = const_.name(ctx.db).map(|n| n.to_string());
201 202
202 if let Some(const_name) = const_name { 203 if let Some(const_name) = const_name {
204 #[allow(deprecated)]
203 let snippet = make_const_compl_syntax(&const_.source_old(ctx.db).value); 205 let snippet = make_const_compl_syntax(&const_.source_old(ctx.db).value);
204 206
205 let range = TextRange::new(const_def_node.text_range().start(), ctx.source_range().end()); 207 let range = TextRange::new(const_def_node.text_range().start(), ctx.source_range().end());
diff --git a/crates/completion/src/render/const_.rs b/crates/completion/src/render/const_.rs
index a8820a4fe..648a1afc5 100644
--- a/crates/completion/src/render/const_.rs
+++ b/crates/completion/src/render/const_.rs
@@ -27,6 +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 #[allow(deprecated)]
30 let ast_node = const_.source_old(ctx.db()).value; 31 let ast_node = const_.source_old(ctx.db()).value;
31 ConstRender { ctx, const_, ast_node } 32 ConstRender { ctx, const_, ast_node }
32 } 33 }
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs
index d9ea425a0..4c8996204 100644
--- a/crates/completion/src/render/function.rs
+++ b/crates/completion/src/render/function.rs
@@ -34,6 +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 #[allow(deprecated)]
37 let ast_node = fn_.source_old(ctx.db()).value; 38 let ast_node = fn_.source_old(ctx.db()).value;
38 39
39 FunctionRender { ctx, name, func: fn_, ast_node } 40 FunctionRender { ctx, name, func: fn_, ast_node }
diff --git a/crates/completion/src/render/macro_.rs b/crates/completion/src/render/macro_.rs
index 3d13fd9e2..95408ff9a 100644
--- a/crates/completion/src/render/macro_.rs
+++ b/crates/completion/src/render/macro_.rs
@@ -96,6 +96,7 @@ impl<'a> MacroRender<'a> {
96 } 96 }
97 97
98 fn detail(&self) -> String { 98 fn detail(&self) -> String {
99 #[allow(deprecated)]
99 let ast_node = self.macro_.source_old(self.ctx.db()).value; 100 let ast_node = self.macro_.source_old(self.ctx.db()).value;
100 macro_label(&ast_node) 101 macro_label(&ast_node)
101 } 102 }
diff --git a/crates/completion/src/render/type_alias.rs b/crates/completion/src/render/type_alias.rs
index 4099a5d0e..276090015 100644
--- a/crates/completion/src/render/type_alias.rs
+++ b/crates/completion/src/render/type_alias.rs
@@ -27,6 +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 #[allow(deprecated)]
30 let ast_node = type_alias.source_old(ctx.db()).value; 31 let ast_node = type_alias.source_old(ctx.db()).value;
31 TypeAliasRender { ctx, type_alias, ast_node } 32 TypeAliasRender { ctx, type_alias, ast_node }
32 } 33 }
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 5020aa196..285905e96 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -989,6 +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 #[allow(deprecated)]
992 self.source_old(db).value.name().map(|it| it.as_name()) 993 self.source_old(db).value.name().map(|it| it.as_name())
993 } 994 }
994 995
@@ -1378,6 +1379,7 @@ impl Impl {
1378 } 1379 }
1379 1380
1380 pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> { 1381 pub fn is_builtin_derive(self, db: &dyn HirDatabase) -> Option<InFile<ast::Attr>> {
1382 #[allow(deprecated)]
1381 let src = self.source_old(db); 1383 let src = self.source_old(db);
1382 let item = src.file_id.is_builtin_derive(db.upcast())?; 1384 let item = src.file_id.is_builtin_derive(db.upcast())?;
1383 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id); 1385 let hygenic = hir_expand::hygiene::Hygiene::new(db.upcast(), item.file_id);
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 84fbeca75..8a7306def 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -16,6 +16,7 @@ use crate::{
16 16
17pub trait HasSource { 17pub trait HasSource {
18 type Ast; 18 type Ast;
19 #[deprecated = "migrating to source() method that returns an Option"]
19 fn source_old(self, db: &dyn HirDatabase) -> InFile<Self::Ast>; 20 fn source_old(self, db: &dyn HirDatabase) -> InFile<Self::Ast>;
20 fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>; 21 fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>>;
21} 22}
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index 702e8239d..0b5e0a4c1 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -156,6 +156,7 @@ 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 #[allow(deprecated)]
159 let source = s.source_old(sema.db); 160 let source = s.source_old(sema.db);
160 def_file_id = source.file_id; 161 def_file_id = source.file_id;
161 let fields = source.value.field_list()?; 162 let fields = source.value.field_list()?;
@@ -163,12 +164,14 @@ fn missing_record_expr_field_fix(
163 } 164 }
164 VariantDef::Union(u) => { 165 VariantDef::Union(u) => {
165 module = u.module(sema.db); 166 module = u.module(sema.db);
167 #[allow(deprecated)]
166 let source = u.source_old(sema.db); 168 let source = u.source_old(sema.db);
167 def_file_id = source.file_id; 169 def_file_id = source.file_id;
168 source.value.record_field_list()? 170 source.value.record_field_list()?
169 } 171 }
170 VariantDef::Variant(e) => { 172 VariantDef::Variant(e) => {
171 module = e.module(sema.db); 173 module = e.module(sema.db);
174 #[allow(deprecated)]
172 let source = e.source_old(sema.db); 175 let source = e.source_old(sema.db);
173 def_file_id = source.file_id; 176 def_file_id = source.file_id;
174 let fields = source.value.field_list()?; 177 let fields = source.value.field_list()?;
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs
index de4c0fa12..efa0418ad 100644
--- a/crates/ide/src/display/navigation_target.rs
+++ b/crates/ide/src/display/navigation_target.rs
@@ -285,6 +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 #[allow(deprecated)]
288 let src = self.source_old(db); 289 let src = self.source_old(db);
289 let mut res = NavigationTarget::from_named( 290 let mut res = NavigationTarget::from_named(
290 db, 291 db,
@@ -314,6 +315,7 @@ impl ToNav for hir::Module {
314 315
315impl ToNav for hir::Impl { 316impl ToNav for hir::Impl {
316 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 317 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
318 #[allow(deprecated)]
317 let src = self.source_old(db); 319 let src = self.source_old(db);
318 let derive_attr = self.is_builtin_derive(db); 320 let derive_attr = self.is_builtin_derive(db);
319 let frange = if let Some(item) = &derive_attr { 321 let frange = if let Some(item) = &derive_attr {
@@ -339,6 +341,7 @@ impl ToNav for hir::Impl {
339 341
340impl ToNav for hir::Field { 342impl ToNav for hir::Field {
341 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 343 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
344 #[allow(deprecated)]
342 let src = self.source_old(db); 345 let src = self.source_old(db);
343 346
344 match &src.value { 347 match &src.value {
@@ -365,6 +368,7 @@ impl ToNav for hir::Field {
365 368
366impl ToNav for hir::MacroDef { 369impl ToNav for hir::MacroDef {
367 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 370 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
371 #[allow(deprecated)]
368 let src = self.source_old(db); 372 let src = self.source_old(db);
369 log::debug!("nav target {:#?}", src.value.syntax()); 373 log::debug!("nav target {:#?}", src.value.syntax());
370 let mut res = NavigationTarget::from_named( 374 let mut res = NavigationTarget::from_named(
@@ -448,6 +452,7 @@ impl ToNav for hir::Label {
448 452
449impl ToNav for hir::TypeParam { 453impl ToNav for hir::TypeParam {
450 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 454 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
455 #[allow(deprecated)]
451 let src = self.source_old(db); 456 let src = self.source_old(db);
452 let full_range = match &src.value { 457 let full_range = match &src.value {
453 Either::Left(it) => it.syntax().text_range(), 458 Either::Left(it) => it.syntax().text_range(),
@@ -472,6 +477,7 @@ impl ToNav for hir::TypeParam {
472 477
473impl ToNav for hir::LifetimeParam { 478impl ToNav for hir::LifetimeParam {
474 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 479 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
480 #[allow(deprecated)]
475 let src = self.source_old(db); 481 let src = self.source_old(db);
476 let full_range = src.value.syntax().text_range(); 482 let full_range = src.value.syntax().text_range();
477 NavigationTarget { 483 NavigationTarget {
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 90781ea34..c192e3ed7 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -206,6 +206,7 @@ fn runnable_action(
206 _ => None, 206 _ => None,
207 }, 207 },
208 ModuleDef::Function(it) => { 208 ModuleDef::Function(it) => {
209 #[allow(deprecated)]
209 let src = it.source_old(sema.db); 210 let src = it.source_old(sema.db);
210 if src.file_id != file_id.into() { 211 if src.file_id != file_id.into() {
211 mark::hit!(hover_macro_generated_struct_fn_doc_comment); 212 mark::hit!(hover_macro_generated_struct_fn_doc_comment);
@@ -332,10 +333,12 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
332 if it.is_proc_macro() { 333 if it.is_proc_macro() {
333 return None; 334 return None;
334 } 335 }
336 #[allow(deprecated)]
335 let label = macro_label(&it.source_old(db).value); 337 let label = macro_label(&it.source_old(db).value);
336 from_def_source_labeled(db, it, Some(label), mod_path) 338 from_def_source_labeled(db, it, Some(label), mod_path)
337 } 339 }
338 Definition::Field(def) => { 340 Definition::Field(def) => {
341 #[allow(deprecated)]
339 let src = def.source_old(db).value; 342 let src = def.source_old(db).value;
340 if let FieldSource::Named(it) = src { 343 if let FieldSource::Named(it) = src {
341 from_def_source_labeled(db, def, it.short_label(), mod_path) 344 from_def_source_labeled(db, def, it.short_label(), mod_path)
@@ -385,6 +388,7 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {
385 D: HasSource<Ast = A> + HasAttrs + Copy, 388 D: HasSource<Ast = A> + HasAttrs + Copy,
386 A: ShortLabel, 389 A: ShortLabel,
387 { 390 {
391 #[allow(deprecated)]
388 let short_label = def.source_old(db).value.short_label(); 392 let short_label = def.source_old(db).value.short_label();
389 from_def_source_labeled(db, def, short_label, mod_path) 393 from_def_source_labeled(db, def, short_label, mod_path)
390 } 394 }
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index 2df4894a1..e69f9d141 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -120,6 +120,7 @@ impl Definition {
120 let file_id = module_src.file_id.original_file(db); 120 let file_id = module_src.file_id.original_file(db);
121 121
122 if let Definition::Local(var) = self { 122 if let Definition::Local(var) = self {
123 #[allow(deprecated)]
123 let range = match var.parent(db) { 124 let range = match var.parent(db) {
124 DefWithBody::Function(f) => f.source_old(db).value.syntax().text_range(), 125 DefWithBody::Function(f) => f.source_old(db).value.syntax().text_range(),
125 DefWithBody::Const(c) => c.source_old(db).value.syntax().text_range(), 126 DefWithBody::Const(c) => c.source_old(db).value.syntax().text_range(),
@@ -131,6 +132,7 @@ impl Definition {
131 } 132 }
132 133
133 if let Definition::LifetimeParam(param) = self { 134 if let Definition::LifetimeParam(param) = self {
135 #[allow(deprecated)]
134 let range = match param.parent(db) { 136 let range = match param.parent(db) {
135 hir::GenericDef::Function(it) => it.source_old(db).value.syntax().text_range(), 137 hir::GenericDef::Function(it) => it.source_old(db).value.syntax().text_range(),
136 hir::GenericDef::Adt(it) => match it { 138 hir::GenericDef::Adt(it) => match it {
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index 3ee11a8f0..bfc7d7b5a 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -161,6 +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 #[allow(deprecated)]
164 let src = f.source_old(db); 165 let src = f.source_old(db);
165 let original_file = src.file_id.original_file(db); 166 let original_file = src.file_id.original_file(db);
166 let path = vfs.file_path(original_file); 167 let path = vfs.file_path(original_file);