Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwco
Improve HIR stats #100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection. r? `@davidtwco`
This commit is contained in:
commit
9ae329232b
@ -178,9 +178,9 @@ fn never_loop_expr(expr: &Expr<'_>, main_loop_id: HirId) -> NeverLoopResult {
|
||||
InlineAsmOperand::In { expr, .. } | InlineAsmOperand::InOut { expr, .. } => {
|
||||
never_loop_expr(expr, main_loop_id)
|
||||
},
|
||||
InlineAsmOperand::Out { expr, .. } => never_loop_expr_all(&mut expr.iter(), main_loop_id),
|
||||
InlineAsmOperand::Out { expr, .. } => never_loop_expr_all(&mut expr.iter().copied(), main_loop_id),
|
||||
InlineAsmOperand::SplitInOut { in_expr, out_expr, .. } => {
|
||||
never_loop_expr_all(&mut once(in_expr).chain(out_expr.iter()), main_loop_id)
|
||||
never_loop_expr_all(&mut once(*in_expr).chain(out_expr.iter().copied()), main_loop_id)
|
||||
},
|
||||
InlineAsmOperand::Const { .. }
|
||||
| InlineAsmOperand::SymFn { .. }
|
||||
|
@ -105,7 +105,7 @@ fn get_size_of_ty<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -> Option<
|
||||
if let Some(def_id) = cx.qpath_res(count_func_qpath, count_func.hir_id).opt_def_id();
|
||||
if cx.tcx.is_diagnostic_item(sym::mem_size_of, def_id);
|
||||
then {
|
||||
cx.typeck_results().node_substs(count_func.hir_id).types().next().map(|resolved_ty| (real_ty, resolved_ty))
|
||||
cx.typeck_results().node_substs(count_func.hir_id).types().next().map(|resolved_ty| (*real_ty, resolved_ty))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn body(&self, body_id: &Binding<hir::BodyId>) {
|
||||
let expr = &self.cx.tcx.hir().body(body_id.value).value;
|
||||
let expr = self.cx.tcx.hir().body(body_id.value).value;
|
||||
bind!(self, expr);
|
||||
out!("let {expr} = &cx.tcx.hir().body({body_id}).value;");
|
||||
self.expr(expr);
|
||||
|
@ -337,7 +337,7 @@ pub fn qpath_generic_tys<'tcx>(qpath: &QPath<'tcx>) -> impl Iterator<Item = &'tc
|
||||
.map_or(&[][..], |a| a.args)
|
||||
.iter()
|
||||
.filter_map(|a| match a {
|
||||
hir::GenericArg::Type(ty) => Some(ty),
|
||||
hir::GenericArg::Type(ty) => Some(*ty),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
@ -1812,7 +1812,7 @@ pub fn is_expr_identity_function(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool
|
||||
}
|
||||
};
|
||||
|
||||
let mut expr = &func.value;
|
||||
let mut expr = func.value;
|
||||
loop {
|
||||
match expr.kind {
|
||||
#[rustfmt::skip]
|
||||
|
Loading…
x
Reference in New Issue
Block a user