mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Support for nested ADT
This commit is contained in:
parent
94ad07af4b
commit
ac5a3f611b
5 changed files with 35 additions and 22 deletions
|
@ -269,7 +269,7 @@ pub struct Struct {
|
|||
|
||||
impl Struct {
|
||||
pub fn module(self, db: &impl DefDatabase) -> Module {
|
||||
Module { id: self.id.lookup(db).container }
|
||||
Module { id: self.id.lookup(db).container.module(db) }
|
||||
}
|
||||
|
||||
pub fn krate(self, db: &impl DefDatabase) -> Option<Crate> {
|
||||
|
@ -290,7 +290,7 @@ impl Struct {
|
|||
}
|
||||
|
||||
pub fn ty(self, db: &impl HirDatabase) -> Type {
|
||||
Type::from_def(db, self.id.lookup(db).container.krate, self.id)
|
||||
Type::from_def(db, self.id.lookup(db).container.module(db).krate, self.id)
|
||||
}
|
||||
|
||||
fn variant_data(self, db: &impl DefDatabase) -> Arc<VariantData> {
|
||||
|
@ -309,11 +309,11 @@ impl Union {
|
|||
}
|
||||
|
||||
pub fn module(self, db: &impl DefDatabase) -> Module {
|
||||
Module { id: self.id.lookup(db).container }
|
||||
Module { id: self.id.lookup(db).container.module(db) }
|
||||
}
|
||||
|
||||
pub fn ty(self, db: &impl HirDatabase) -> Type {
|
||||
Type::from_def(db, self.id.lookup(db).container.krate, self.id)
|
||||
Type::from_def(db, self.id.lookup(db).container.module(db).krate, self.id)
|
||||
}
|
||||
|
||||
pub fn fields(self, db: &impl HirDatabase) -> Vec<StructField> {
|
||||
|
@ -337,7 +337,7 @@ pub struct Enum {
|
|||
|
||||
impl Enum {
|
||||
pub fn module(self, db: &impl DefDatabase) -> Module {
|
||||
Module { id: self.id.lookup(db).container }
|
||||
Module { id: self.id.lookup(db).container.module(db) }
|
||||
}
|
||||
|
||||
pub fn krate(self, db: &impl DefDatabase) -> Option<Crate> {
|
||||
|
@ -357,7 +357,7 @@ impl Enum {
|
|||
}
|
||||
|
||||
pub fn ty(self, db: &impl HirDatabase) -> Type {
|
||||
Type::from_def(db, self.id.lookup(db).container.krate, self.id)
|
||||
Type::from_def(db, self.id.lookup(db).container.module(db).krate, self.id)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue