mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 04:48:13 +00:00
TypeNs contain module
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
This commit is contained in:
parent
a7dc60a2c4
commit
1b471ebfd5
5 changed files with 71 additions and 88 deletions
|
|
@ -1648,7 +1648,8 @@ impl<'a> InferenceContext<'a> {
|
|||
TypeNs::AdtId(AdtId::EnumId(_))
|
||||
| TypeNs::BuiltinType(_)
|
||||
| TypeNs::TraitId(_)
|
||||
| TypeNs::TraitAliasId(_) => {
|
||||
| TypeNs::TraitAliasId(_)
|
||||
| TypeNs::ModuleId(_) => {
|
||||
// FIXME diagnostic
|
||||
(self.err_ty(), None)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ use hir_def::{
|
|||
expr_store::HygieneId,
|
||||
generics::{TypeParamProvenance, WherePredicate, WherePredicateTypeTarget},
|
||||
path::{GenericArg, GenericArgs, GenericArgsParentheses, Path, PathSegment, PathSegments},
|
||||
resolver::{ModuleOrTypeNs, ResolveValueResult, TypeNs, ValueNs},
|
||||
resolver::{ResolveValueResult, TypeNs, ValueNs},
|
||||
type_ref::{TypeBound, TypeRef, TypesMap},
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
|
@ -285,7 +285,9 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
|
|||
TypeNs::BuiltinType(it) => self.lower_path_inner(it.into(), infer_args),
|
||||
TypeNs::TypeAliasId(it) => self.lower_path_inner(it.into(), infer_args),
|
||||
// FIXME: report error
|
||||
TypeNs::EnumVariantId(_) => return (TyKind::Error.intern(Interner), None),
|
||||
TypeNs::EnumVariantId(_) | TypeNs::ModuleId(_) => {
|
||||
return (TyKind::Error.intern(Interner), None);
|
||||
}
|
||||
};
|
||||
|
||||
self.skip_resolved_segment();
|
||||
|
|
@ -316,6 +318,9 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
|
|||
TypeNs::BuiltinType(_) => {
|
||||
prohibit_generics_on_resolved(GenericArgsProhibitedReason::PrimitiveTy)
|
||||
}
|
||||
TypeNs::ModuleId(_) => {
|
||||
prohibit_generics_on_resolved(GenericArgsProhibitedReason::Module)
|
||||
}
|
||||
TypeNs::AdtId(_)
|
||||
| TypeNs::EnumVariantId(_)
|
||||
| TypeNs::TypeAliasId(_)
|
||||
|
|
@ -338,10 +343,6 @@ impl<'a, 'b> PathLoweringContext<'a, 'b> {
|
|||
.resolver
|
||||
.resolve_path_in_type_ns_with_prefix_info(self.ctx.db.upcast(), self.path)?;
|
||||
|
||||
let ModuleOrTypeNs::TypeNs(resolution) = resolution else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let segments = self.segments;
|
||||
if segments.is_empty() || matches!(self.path, Path::LangItem(..)) {
|
||||
// `segments.is_empty()` can occur with `self`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue