Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errors
Use the power of adding helper function to simplify code w/ `Mutability` r? `@compiler-errors`
This commit is contained in:
commit
a2e485c25c
28 changed files with 144 additions and 218 deletions
|
@ -257,9 +257,9 @@ pub(crate) fn data_id_for_alloc_id(
|
|||
mutability: rustc_hir::Mutability,
|
||||
) -> DataId {
|
||||
cx.todo.push(TodoItem::Alloc(alloc_id));
|
||||
*cx.anon_allocs.entry(alloc_id).or_insert_with(|| {
|
||||
module.declare_anonymous_data(mutability == rustc_hir::Mutability::Mut, false).unwrap()
|
||||
})
|
||||
*cx.anon_allocs
|
||||
.entry(alloc_id)
|
||||
.or_insert_with(|| module.declare_anonymous_data(mutability.is_mut(), false).unwrap())
|
||||
}
|
||||
|
||||
fn data_id_for_static(
|
||||
|
@ -343,12 +343,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
|||
}
|
||||
};
|
||||
let data_id = *cx.anon_allocs.entry(alloc_id).or_insert_with(|| {
|
||||
module
|
||||
.declare_anonymous_data(
|
||||
alloc.inner().mutability == rustc_hir::Mutability::Mut,
|
||||
false,
|
||||
)
|
||||
.unwrap()
|
||||
module.declare_anonymous_data(alloc.inner().mutability.is_mut(), false).unwrap()
|
||||
});
|
||||
(data_id, alloc, None)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue