Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r--crates/hir/src/lib.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index d1735e9f1d..503c549327 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1418,16 +1418,14 @@ impl Adt {
}
pub fn layout(self, db: &dyn HirDatabase) -> Result<Layout, LayoutError> {
- if !db.generic_params(self.into()).is_empty() {
- return Err(LayoutError::HasPlaceholder);
- }
- let krate = self.krate(db).id;
db.layout_of_adt(
self.into(),
- Substitution::empty(Interner),
+ TyBuilder::adt(db, self.into())
+ .fill_with_defaults(db, || TyKind::Error.intern(Interner))
+ .build_into_subst(),
db.trait_environment(self.into()),
)
- .map(|layout| Layout(layout, db.target_data_layout(krate).unwrap()))
+ .map(|layout| Layout(layout, db.target_data_layout(self.krate(db).id).unwrap()))
}
/// Turns this ADT into a type. Any type parameters of the ADT will be