Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/body.rs')
-rw-r--r--crates/hir-def/src/body.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/crates/hir-def/src/body.rs b/crates/hir-def/src/body.rs
index 36626ed1a9..3ed7dfefc0 100644
--- a/crates/hir-def/src/body.rs
+++ b/crates/hir-def/src/body.rs
@@ -118,7 +118,7 @@ impl Body {
let _p = profile::span("body_with_source_map_query");
let mut params = None;
- let (file_id, module, body, is_async_fn) = {
+ let (file_id, body, is_async_fn) = {
match def {
DefWithBodyId::FunctionId(f) => {
let data = db.function_data(f);
@@ -138,31 +138,29 @@ impl Body {
}),
)
});
- (
- src.file_id,
- f.module(db),
- src.value.body().map(ast::Expr::from),
- data.has_async_kw(),
- )
+ (src.file_id, src.value.body().map(ast::Expr::from), data.has_async_kw())
}
DefWithBodyId::ConstId(c) => {
let c = c.lookup(db);
let src = c.source(db);
- (src.file_id, c.module(db), src.value.body(), false)
+ (src.file_id, src.value.body(), false)
}
DefWithBodyId::StaticId(s) => {
let s = s.lookup(db);
let src = s.source(db);
- (src.file_id, s.module(db), src.value.body(), false)
+ (src.file_id, src.value.body(), false)
}
DefWithBodyId::VariantId(v) => {
- let e = v.parent.lookup(db);
let src = v.parent.child_source(db);
let variant = &src.value[v.local_id];
- (src.file_id, e.container, variant.expr(), false)
+ (src.file_id, variant.expr(), false)
+ }
+ DefWithBodyId::InTypeConstId(c) => {
+ (c.lookup(db).0.file_id, c.source(db).expr(), false)
}
}
};
+ let module = def.module(db);
let expander = Expander::new(db, file_id, module);
let (mut body, source_map) =
Body::new(db, def, expander, params, body, module.krate, is_async_fn);