Make body_owned_by return the body directly.
Almost all callers want this anyway, and now we can use it to also return fed bodies
This commit is contained in:
@@ -16,17 +16,17 @@ pub fn provide(providers: &mut Providers) {
|
||||
}
|
||||
|
||||
let local_def_id = def_id.expect_local();
|
||||
let body = tcx.hir().body(tcx.hir().maybe_body_owned_by(local_def_id)?);
|
||||
let body = tcx.hir().maybe_body_owned_by(local_def_id)?;
|
||||
|
||||
let mut local_collector = LocalCollector::default();
|
||||
local_collector.visit_body(body);
|
||||
local_collector.visit_body(&body);
|
||||
|
||||
let mut capture_collector = CaptureCollector {
|
||||
tcx,
|
||||
locals: &local_collector.locals,
|
||||
upvars: FxIndexMap::default(),
|
||||
};
|
||||
capture_collector.visit_body(body);
|
||||
capture_collector.visit_body(&body);
|
||||
|
||||
if !capture_collector.upvars.is_empty() {
|
||||
Some(tcx.arena.alloc(capture_collector.upvars))
|
||||
|
||||
Reference in New Issue
Block a user