mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Deprecate hir::Path::from_ast
This commit is contained in:
parent
5413a2f962
commit
52a220cece
3 changed files with 4 additions and 1 deletions
|
@ -106,6 +106,7 @@ impl<'a> SubstituteTypeParams<'a> {
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
// FIXME: use `hir::Path::from_src` instead.
|
// FIXME: use `hir::Path::from_src` instead.
|
||||||
|
#[allow(deprecated)]
|
||||||
let path = hir::Path::from_ast(path)?;
|
let path = hir::Path::from_ast(path)?;
|
||||||
let resolution = self.source_scope.resolve_hir_path(&path)?;
|
let resolution = self.source_scope.resolve_hir_path(&path)?;
|
||||||
match resolution {
|
match resolution {
|
||||||
|
@ -150,6 +151,7 @@ impl<'a> QualifyPaths<'a> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
// FIXME: use `hir::Path::from_src` instead.
|
// FIXME: use `hir::Path::from_src` instead.
|
||||||
|
#[allow(deprecated)]
|
||||||
let hir_path = hir::Path::from_ast(p.clone());
|
let hir_path = hir::Path::from_ast(p.clone());
|
||||||
let resolution = self.source_scope.resolve_hir_path(&hir_path?)?;
|
let resolution = self.source_scope.resolve_hir_path(&hir_path?)?;
|
||||||
match resolution {
|
match resolution {
|
||||||
|
|
|
@ -154,7 +154,7 @@ pub enum GenericArg {
|
||||||
|
|
||||||
impl Path {
|
impl Path {
|
||||||
/// Converts an `ast::Path` to `Path`. Works with use trees.
|
/// 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> {
|
pub fn from_ast(path: ast::Path) -> Option<Path> {
|
||||||
lower::lower_path(path, &Hygiene::new_unhygienic())
|
lower::lower_path(path, &Hygiene::new_unhygienic())
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,6 +381,7 @@ impl<'a> CompletionContext<'a> {
|
||||||
self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some();
|
self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some();
|
||||||
self.has_type_args = segment.type_arg_list().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) = hir::Path::from_ast(path.clone()) {
|
||||||
if let Some(path_prefix) = path.qualifier() {
|
if let Some(path_prefix) = path.qualifier() {
|
||||||
self.path_prefix = Some(path_prefix);
|
self.path_prefix = Some(path_prefix);
|
||||||
|
|
Loading…
Reference in a new issue