Skip to content

Commit

Permalink
Deprecate hir::Path::from_ast
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Jun 15, 2020
1 parent 5413a2f commit 52a220c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/ra_assists/src/ast_transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/ra_hir_def/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Path> {
lower::lower_path(path, &Hygiene::new_unhygienic())
}
Expand Down
1 change: 1 addition & 0 deletions crates/ra_ide/src/completion/completion_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 52a220c

Please sign in to comment.