Auto merge of #81057 - GuillaumeGomez:rollup-yl2kqst, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - #77693 (Add test for #59352) - #80515 (Improve JS performance by storing length before comparing to it in loops) - #81030 (Update mdbook) - #81033 (Remove useless `clean::Variant` struct) - #81049 (inline: Round word-size cost estimates up) - #81054 (Drop a few unneeded borrows) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
6c869d34ae
15 changed files with 231 additions and 112 deletions
|
@ -382,7 +382,7 @@ impl Inliner<'tcx> {
|
|||
// Cost of the var is the size in machine-words, if we know
|
||||
// it.
|
||||
if let Some(size) = type_size_of(tcx, self.param_env, ty) {
|
||||
cost += (size / ptr_size) as usize;
|
||||
cost += ((size + ptr_size - 1) / ptr_size) as usize;
|
||||
} else {
|
||||
cost += UNKNOWN_SIZE_COST;
|
||||
}
|
||||
|
|
|
@ -813,10 +813,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
if ty.is_never() {
|
||||
None
|
||||
} else {
|
||||
Some(match &elem.kind {
|
||||
Some(match elem.kind {
|
||||
// Point at the tail expression when possible.
|
||||
hir::ExprKind::Block(block, _) => {
|
||||
block.expr.as_ref().map_or(block.span, |e| e.span)
|
||||
block.expr.map_or(block.span, |e| e.span)
|
||||
}
|
||||
_ => elem.span,
|
||||
})
|
||||
|
@ -824,14 +824,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
})
|
||||
};
|
||||
|
||||
if let hir::ExprKind::If(_, _, Some(el)) = &expr.kind {
|
||||
if let hir::ExprKind::If(_, _, Some(el)) = expr.kind {
|
||||
if let Some(rslt) = check_in_progress(el) {
|
||||
return rslt;
|
||||
}
|
||||
}
|
||||
|
||||
if let hir::ExprKind::Match(_, arms, _) = &expr.kind {
|
||||
let mut iter = arms.iter().filter_map(|arm| check_in_progress(&arm.body));
|
||||
if let hir::ExprKind::Match(_, arms, _) = expr.kind {
|
||||
let mut iter = arms.iter().filter_map(|arm| check_in_progress(arm.body));
|
||||
if let Some(span) = iter.next() {
|
||||
if iter.next().is_none() {
|
||||
return span;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue