From 52a220cece729acb2f6c6fd40bda3964846eb7d2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 15 Jun 2020 10:49:40 +0200 Subject: Deprecate hir::Path::from_ast --- crates/ra_assists/src/ast_transform.rs | 2 ++ crates/ra_hir_def/src/path.rs | 2 +- crates/ra_ide/src/completion/completion_context.rs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index 3079a02a2..00fa95b6c 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs @@ -106,6 +106,7 @@ impl<'a> SubstituteTypeParams<'a> { _ => return None, }; // FIXME: use `hir::Path::from_src` instead. + #[allow(deprecated)] let path = hir::Path::from_ast(path)?; let resolution = self.source_scope.resolve_hir_path(&path)?; match resolution { @@ -150,6 +151,7 @@ impl<'a> QualifyPaths<'a> { return None; } // FIXME: use `hir::Path::from_src` instead. + #[allow(deprecated)] let hir_path = hir::Path::from_ast(p.clone()); let resolution = self.source_scope.resolve_hir_path(&hir_path?)?; match resolution { diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index ba16442bd..190d6d98d 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs @@ -154,7 +154,7 @@ pub enum GenericArg { impl Path { /// Converts an `ast::Path` to `Path`. Works with use trees. - /// DEPRECATED: It does not handle `$crate` from macro call. + #[deprecated = "Doesn't handle hygiene, don't add new calls, remove old ones"] pub fn from_ast(path: ast::Path) -> Option { lower::lower_path(path, &Hygiene::new_unhygienic()) } diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 9f4c582d0..560fb19e6 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs @@ -381,6 +381,7 @@ impl<'a> CompletionContext<'a> { self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some(); self.has_type_args = segment.type_arg_list().is_some(); + #[allow(deprecated)] if let Some(path) = hir::Path::from_ast(path.clone()) { if let Some(path_prefix) = path.qualifier() { self.path_prefix = Some(path_prefix); -- cgit v1.2.3