use rustc crates instead of copy paste

This commit is contained in:
hkalbasi 2022-12-07 01:59:38 +03:30
parent f2c9502185
commit 05906da0ec
13 changed files with 291 additions and 2083 deletions

View file

@ -3,8 +3,7 @@ use std::fmt::Display;
use either::Either;
use hir::{
db::HirDatabase, Adt, AsAssocItem, AttributeTemplate, HasAttrs, HasSource, HirDisplay,
Semantics, TypeInfo,
Adt, AsAssocItem, AttributeTemplate, HasAttrs, HasSource, HirDisplay, Semantics, TypeInfo,
};
use ide_db::{
base_db::SourceDatabase,
@ -398,7 +397,7 @@ pub(super) fn definition(
let offset = match var_def {
hir::VariantDef::Struct(s) => {
let layout = Adt::from(s).layout(db).ok()?;
layout.fields.offset(id, &db.current_target_data_layout())
layout.fields.offset(id)
}
_ => return None,
};

View file

@ -537,7 +537,7 @@ struct Foo { fiel$0d_a: u8, field_b: i32, field_c: i16 }
```
```rust
field_a: u8 // size = 1, align = 1, offset = 6
field_a: u8 // size = 1, align = 1, offset = 4
```
"#]],
);