1
Fork 0

Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth

Rollup of 5 pull requests

Successful merges:

 - #111741 (Use `ObligationCtxt` in custom type ops)
 - #111840 (Expose more information in `get_body_with_borrowck_facts`)
 - #111876 (Roll compiler_builtins to 0.1.92)
 - #111912 (Use `Option::is_some_and` and `Result::is_ok_and` in the compiler  )
 - #111915 (libtest: Improve error when missing `-Zunstable-options`)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2023-05-25 00:33:43 +00:00
commit 7664dfe433
115 changed files with 417 additions and 378 deletions

View file

@ -351,7 +351,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
let popped = this.block_context.pop();
assert!(popped.map_or(false, |bf| bf.is_statement()));
assert!(popped.is_some_and(|bf| bf.is_statement()));
}
// Then, the block may have an optional trailing expression which is a “return” value
@ -367,7 +367,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
unpack!(block = this.expr_into_dest(destination, block, expr));
let popped = this.block_context.pop();
assert!(popped.map_or(false, |bf| bf.is_tail_expr()));
assert!(popped.is_some_and(|bf| bf.is_tail_expr()));
} else {
// If a block has no trailing expression, then it is given an implicit return type.
// This return type is usually `()`, unless the block is diverging, in which case the

View file

@ -325,10 +325,10 @@ impl DropTree {
entry_points.sort();
for (drop_idx, drop_data) in self.drops.iter_enumerated().rev() {
if entry_points.last().map_or(false, |entry_point| entry_point.0 == drop_idx) {
if entry_points.last().is_some_and(|entry_point| entry_point.0 == drop_idx) {
let block = *blocks[drop_idx].get_or_insert_with(|| T::make_block(cfg));
needs_block[drop_idx] = Block::Own;
while entry_points.last().map_or(false, |entry_point| entry_point.0 == drop_idx) {
while entry_points.last().is_some_and(|entry_point| entry_point.0 == drop_idx) {
let entry_block = entry_points.pop().unwrap().1;
T::add_entry(cfg, entry_block, block);
}
@ -731,7 +731,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
fn leave_top_scope(&mut self, block: BasicBlock) -> BasicBlock {
// If we are emitting a `drop` statement, we need to have the cached
// diverge cleanup pads ready in case that drop panics.
let needs_cleanup = self.scopes.scopes.last().map_or(false, |scope| scope.needs_cleanup());
let needs_cleanup = self.scopes.scopes.last().is_some_and(|scope| scope.needs_cleanup());
let is_generator = self.generator_kind.is_some();
let unwind_to = if needs_cleanup { self.diverge_cleanup() } else { DropIdx::MAX };

View file

@ -333,7 +333,7 @@ impl<'tcx> Cx<'tcx> {
} else if let Some(box_item) = tcx.lang_items().owned_box() {
if let hir::ExprKind::Path(hir::QPath::TypeRelative(ty, fn_path)) = fun.kind
&& let hir::TyKind::Path(hir::QPath::Resolved(_, path)) = ty.kind
&& path.res.opt_def_id().map_or(false, |did| did == box_item)
&& path.res.opt_def_id().is_some_and(|did| did == box_item)
&& fn_path.ident.name == sym::new
&& let [value] = args
{
@ -956,7 +956,7 @@ impl<'tcx> Cx<'tcx> {
let is_upvar = self
.tcx
.upvars_mentioned(self.body_owner)
.map_or(false, |upvars| upvars.contains_key(&var_hir_id));
.is_some_and(|upvars| upvars.contains_key(&var_hir_id));
debug!(
"convert_var({:?}): is_upvar={}, body_owner={:?}",