Skip to content

Commit 1385b70

Browse files
committed
Skip borrowck also for closures in formula_fn
1 parent 2ada3dd commit 1385b70

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/analyze.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ pub fn mir_borrowck_skip_formula_fn(
3939
local_def_id: rustc_span::def_id::LocalDefId,
4040
) -> rustc_middle::query::queries::mir_borrowck::ProvidedValue {
4141
// TODO: unify impl with local_def::Analyzer
42+
// if the def is closure defined in formula_fn
43+
let root_def_id = tcx.typeck_root_def_id(local_def_id.to_def_id());
4244
let is_annotated_as_formula_fn = tcx
4345
.get_attrs_by_path(local_def_id.to_def_id(), &analyze::annot::formula_fn_path())
4446
.next()
45-
.is_some();
47+
.is_some()
48+
|| tcx
49+
.get_attrs_by_path(root_def_id, &analyze::annot::formula_fn_path())
50+
.next()
51+
.is_some();
4652

4753
if is_annotated_as_formula_fn {
4854
tracing::debug!(?local_def_id, "skipping borrow check for formula fn");

0 commit comments

Comments
 (0)