mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Remove last traces of adt from Ty
This commit is contained in:
parent
882fe0a47e
commit
936c6950e7
3 changed files with 7 additions and 6 deletions
|
@ -1104,7 +1104,7 @@ impl Type {
|
||||||
|
|
||||||
pub fn as_adt(&self) -> Option<Adt> {
|
pub fn as_adt(&self) -> Option<Adt> {
|
||||||
let (adt, _subst) = self.ty.value.as_adt()?;
|
let (adt, _subst) = self.ty.value.as_adt()?;
|
||||||
Some(adt)
|
Some(adt.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn derived(&self, ty: Ty) -> Type {
|
fn derived(&self, ty: Ty) -> Type {
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::{
|
||||||
db::HirDatabase,
|
db::HirDatabase,
|
||||||
diagnostics::{MissingFields, MissingOkInTailExpr},
|
diagnostics::{MissingFields, MissingOkInTailExpr},
|
||||||
ty::{ApplicationTy, InferenceResult, Ty, TypeCtor},
|
ty::{ApplicationTy, InferenceResult, Ty, TypeCtor},
|
||||||
Adt, Function, Name, Path,
|
Function, Name, Path, Struct,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use hir_def::{
|
pub use hir_def::{
|
||||||
|
@ -69,7 +69,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let struct_def = match self.infer[id].as_adt() {
|
let struct_def = match self.infer[id].as_adt() {
|
||||||
Some((Adt::Struct(s), _)) => s,
|
Some((AdtId::StructId(s), _)) => Struct::from(s),
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,14 @@ use hir_def::{
|
||||||
expr::ExprId, generics::GenericParams, type_ref::Mutability, AdtId, ContainerId, DefWithBodyId,
|
expr::ExprId, generics::GenericParams, type_ref::Mutability, AdtId, ContainerId, DefWithBodyId,
|
||||||
GenericDefId, HasModule, Lookup, TraitId, TypeAliasId,
|
GenericDefId, HasModule, Lookup, TraitId, TypeAliasId,
|
||||||
};
|
};
|
||||||
|
use hir_expand::name::Name;
|
||||||
use ra_db::{impl_intern_key, salsa};
|
use ra_db::{impl_intern_key, salsa};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db::HirDatabase,
|
db::HirDatabase,
|
||||||
ty::primitive::{FloatTy, IntTy, Uncertain},
|
ty::primitive::{FloatTy, IntTy, Uncertain},
|
||||||
util::make_mut_slice,
|
util::make_mut_slice,
|
||||||
Adt, Crate, Name,
|
Crate,
|
||||||
};
|
};
|
||||||
use display::{HirDisplay, HirFormatter};
|
use display::{HirDisplay, HirFormatter};
|
||||||
|
|
||||||
|
@ -598,10 +599,10 @@ impl Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_adt(&self) -> Option<(Adt, &Substs)> {
|
pub fn as_adt(&self) -> Option<(AdtId, &Substs)> {
|
||||||
match self {
|
match self {
|
||||||
Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => {
|
Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => {
|
||||||
Some(((*adt_def).into(), parameters))
|
Some((*adt_def, parameters))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue