Don't expose hir::Path out of hir

Conjecture: it's impossible to use hir::Path *correctly* from an IDE.

I am not entirely sure about this, and we might need to add it back at
some point, but I have to arguments that convince me that we probably
won't:

* `hir::Path` has to know about hygiene, which an IDE can't set up
  properly.

* `hir::Path` lacks identity, but you actually have to know identity
  to resolve it correctly
This commit is contained in:
Aleksey Kladov 2020-08-15 18:50:41 +02:00
parent 2052d33b9b
commit 0ca1ba29e8
9 changed files with 51 additions and 92 deletions

View file

@ -13,6 +13,7 @@ use hir_def::{
Body, BodySourceMap,
},
expr::{ExprId, Pat, PatId},
path::{ModPath, Path, PathKind},
resolver::{resolver_for_scope, Resolver, TypeNs, ValueNs},
AsMacroCall, DefWithBodyId, FieldId, FunctionId, LocalFieldId, VariantId,
};
@ -28,8 +29,7 @@ use syntax::{
use crate::{
db::HirDatabase, semantics::PathResolution, Adt, Const, EnumVariant, Field, Function, Local,
MacroDef, ModPath, ModuleDef, Path, PathKind, Static, Struct, Trait, Type, TypeAlias,
TypeParam,
MacroDef, ModuleDef, Static, Struct, Trait, Type, TypeAlias, TypeParam,
};
use base_db::CrateId;
@ -508,7 +508,7 @@ pub(crate) fn resolve_hir_path(
/// }
/// ```
/// then we know that `foo` in `my::foo::Bar` refers to the module, not the function.
pub(crate) fn resolve_hir_path_qualifier(
fn resolve_hir_path_qualifier(
db: &dyn HirDatabase,
resolver: &Resolver,
path: &Path,