mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
start cleaning up the resolution
Nameres related types, like `PerNs<Resolution>`, can represent unreasonable situations, like a local in a type namespace. We should clean this up, by requiring that call-site specifies the kind of resolution it expects.
This commit is contained in:
parent
5c09c5949a
commit
63e1e63a91
5 changed files with 59 additions and 49 deletions
|
@ -11,7 +11,7 @@ use crate::{
|
|||
name,
|
||||
path::{PathKind, PathSegment},
|
||||
ty::{ApplicationTy, InferenceResult, Ty, TypeCtor},
|
||||
Function, ModuleDef, Name, Path, PerNs, Resolution,
|
||||
Function, Name, Path,
|
||||
};
|
||||
|
||||
use super::{Expr, ExprId, RecordLitField};
|
||||
|
@ -119,11 +119,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
};
|
||||
|
||||
let resolver = self.func.resolver(db);
|
||||
let std_result_enum =
|
||||
match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() {
|
||||
PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e,
|
||||
_ => return,
|
||||
};
|
||||
let std_result_enum = match resolver.resolve_known_enum(db, &std_result_path) {
|
||||
Some(it) => it,
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let std_result_ctor = TypeCtor::Adt(AdtDef::Enum(std_result_enum));
|
||||
let params = match &mismatch.expected {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue