Deprecate hir::Path::from_ast

This commit is contained in:
Aleksey Kladov 2020-06-15 10:49:40 +02:00
parent 5413a2f962
commit 52a220cece
3 changed files with 4 additions and 1 deletions

View file

@ -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 {

View file

@ -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())
}

View file

@ -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);