Skip to content

Commit 52a220c

Browse files
committed
Deprecate hir::Path::from_ast
1 parent 5413a2f commit 52a220c

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

crates/ra_assists/src/ast_transform.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ impl<'a> SubstituteTypeParams<'a> {
106106
_ => return None,
107107
};
108108
// FIXME: use `hir::Path::from_src` instead.
109+
#[allow(deprecated)]
109110
let path = hir::Path::from_ast(path)?;
110111
let resolution = self.source_scope.resolve_hir_path(&path)?;
111112
match resolution {
@@ -150,6 +151,7 @@ impl<'a> QualifyPaths<'a> {
150151
return None;
151152
}
152153
// FIXME: use `hir::Path::from_src` instead.
154+
#[allow(deprecated)]
153155
let hir_path = hir::Path::from_ast(p.clone());
154156
let resolution = self.source_scope.resolve_hir_path(&hir_path?)?;
155157
match resolution {

crates/ra_hir_def/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pub enum GenericArg {
154154

155155
impl Path {
156156
/// Converts an `ast::Path` to `Path`. Works with use trees.
157-
/// DEPRECATED: It does not handle `$crate` from macro call.
157+
#[deprecated = "Doesn't handle hygiene, don't add new calls, remove old ones"]
158158
pub fn from_ast(path: ast::Path) -> Option<Path> {
159159
lower::lower_path(path, &Hygiene::new_unhygienic())
160160
}

crates/ra_ide/src/completion/completion_context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ impl<'a> CompletionContext<'a> {
381381
self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some();
382382
self.has_type_args = segment.type_arg_list().is_some();
383383

384+
#[allow(deprecated)]
384385
if let Some(path) = hir::Path::from_ast(path.clone()) {
385386
if let Some(path_prefix) = path.qualifier() {
386387
self.path_prefix = Some(path_prefix);

0 commit comments

Comments
 (0)