mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 04:48:13 +00:00
fix: shadow type by module
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
parent
0d64633d31
commit
2854ad9a41
4 changed files with 281 additions and 72 deletions
|
|
@ -10,7 +10,7 @@ use hir_def::{
|
|||
expr_store::HygieneId,
|
||||
generics::{TypeParamProvenance, WherePredicate, WherePredicateTypeTarget},
|
||||
path::{GenericArg, GenericArgs, GenericArgsParentheses, Path, PathSegment, PathSegments},
|
||||
resolver::{ResolveValueResult, TypeNs, ValueNs},
|
||||
resolver::{ModuleOrTypeNs, ResolveValueResult, TypeNs, ValueNs},
|
||||
type_ref::{TypeBound, TypeRef, TypesMap},
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
|
@ -333,10 +333,15 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
|
|||
}
|
||||
|
||||
pub(crate) fn resolve_path_in_type_ns(&mut self) -> Option<(TypeNs, Option<usize>)> {
|
||||
let (resolution, remaining_index, _, prefix_info) = self
|
||||
let (resolution, remaining_index, prefix_info) = self
|
||||
.ctx
|
||||
.resolver
|
||||
.resolve_path_in_type_ns_with_prefix_info(self.ctx.db.upcast(), self.path)?;
|
||||
.resolve_path_in_type_ns_with_prefix_info(self.ctx.db.upcast(), self.path)
|
||||
.filter_map(|(res, remaining_index, _, prefix_info)| match res {
|
||||
ModuleOrTypeNs::TypeNs(type_ns) => Some((type_ns, remaining_index, prefix_info)),
|
||||
ModuleOrTypeNs::ModuleNs(_) => None,
|
||||
})
|
||||
.next()?;
|
||||
|
||||
let segments = self.segments;
|
||||
if segments.is_empty() || matches!(self.path, Path::LangItem(..)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue