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:
parent
ceb45d5519
commit
a34c26e7ec
38 changed files with 136 additions and 131 deletions
|
@ -158,9 +158,8 @@ fn check_liveness(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
}
|
||||
|
||||
let mut maps = IrMaps::new(tcx);
|
||||
let body_id = tcx.hir().body_owned_by(def_id);
|
||||
let hir_id = tcx.hir().body_owner(body_id);
|
||||
let body = tcx.hir().body(body_id);
|
||||
let body = tcx.hir().body_owned_by(def_id);
|
||||
let hir_id = tcx.hir().body_owner(body.id());
|
||||
|
||||
if let Some(upvars) = tcx.upvars_mentioned(def_id) {
|
||||
for &var_hir_id in upvars.keys() {
|
||||
|
@ -171,17 +170,17 @@ fn check_liveness(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
|
||||
// gather up the various local variables, significant expressions,
|
||||
// and so forth:
|
||||
maps.visit_body(body);
|
||||
maps.visit_body(&body);
|
||||
|
||||
// compute liveness
|
||||
let mut lsets = Liveness::new(&mut maps, def_id);
|
||||
let entry_ln = lsets.compute(body, hir_id);
|
||||
lsets.log_liveness(entry_ln, body_id.hir_id);
|
||||
let entry_ln = lsets.compute(&body, hir_id);
|
||||
lsets.log_liveness(entry_ln, body.id().hir_id);
|
||||
|
||||
// check for various error conditions
|
||||
lsets.visit_body(body);
|
||||
lsets.visit_body(&body);
|
||||
lsets.warn_about_unused_upvars(entry_ln);
|
||||
lsets.warn_about_unused_args(body, entry_ln);
|
||||
lsets.warn_about_unused_args(&body, entry_ln);
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue