rust/compiler
bors 2de2456fb7 Auto merge of #143376 - dianne:guard-scope, r=matthewjasper
add a scope for `if let` guard temporaries and bindings

This fixes my concern with `if let` guard drop order, namely that the guard's bindings and temporaries were being dropped after their arm's pattern's bindings, instead of before (https://github.com/rust-lang/rust/pull/141295#issuecomment-2968975596). The guard's bindings and temporaries now live in a new scope, which extends until (but not past) the end of the arm, guaranteeing they're dropped before the arm's pattern's bindings.

This only introduces a new scope for match arms with guards. Perf results (https://github.com/rust-lang/rust/pull/143376#issuecomment-3034922617) seemed to indicate there wasn't a significant hit to introduce a new scope on all match arms, but guard patterns (rust-lang/rust#129967) will likely benefit from only adding new scopes when necessary (with some patterns requiring multiple nested scopes).

Tracking issue for `if_let_guard`: rust-lang/rust#51114

Tests are adapted from examples by `@traviscross,` `@est31,` and myself on rust-lang/rust#141295.
2025-08-09 03:19:26 +00:00
..
rustc rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
rustc_abi Reuse sign_extend helper 2025-07-29 14:17:48 +00:00
rustc_arena Introduce Arena::try_alloc_from_iter. 2025-04-19 01:13:18 +00:00
rustc_ast Deduplicate IntTy/UintTy/FloatTy. 2025-07-31 19:56:11 +10:00
rustc_ast_ir Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_ast_lowering Port #[coroutine] to the new attribute system 2025-08-04 18:37:40 +02:00
rustc_ast_passes Rollup merge of #137831 - estebank:auto-trait-err, r=compiler-errors 2025-08-07 20:49:36 +10:00
rustc_ast_pretty use let chains in ast, borrowck, codegen, const_eval 2025-07-28 06:08:48 +05:00
rustc_attr_parsing Revert "Port #[allow_internal_unsafe] to the new attribute system" 2025-08-08 11:54:20 +02:00
rustc_baked_icu_data Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_borrowck move type_check out of compute_regions 2025-08-07 14:04:59 +02:00
rustc_builtin_macros Port #[should_panic] to the new attribute parsing infrastructure 2025-08-06 21:37:51 +02:00
rustc_codegen_cranelift Rollup merge of #144192 - RalfJung:atomicrmw-ptr, r=nikic 2025-08-08 14:22:44 -05:00
rustc_codegen_gcc Rollup merge of #144192 - RalfJung:atomicrmw-ptr, r=nikic 2025-08-08 14:22:44 -05:00
rustc_codegen_llvm Rollup merge of #144987 - tgross35:llvm21-f16-f128, r=nikic 2025-08-08 14:22:47 -05:00
rustc_codegen_ssa Rollup merge of #144192 - RalfJung:atomicrmw-ptr, r=nikic 2025-08-08 14:22:44 -05:00
rustc_const_eval Rollup merge of #145033 - nnethercote:fix-144994, r=fmease 2025-08-07 20:49:48 +10:00
rustc_data_structures Allow pretty printing paths with -Zself-profile-events=args 2025-07-25 22:24:21 +02:00
rustc_driver Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_driver_impl Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_error_codes Update E0562 to account for the new impl trait positions 2025-08-02 11:29:04 +02:00
rustc_error_messages Remove unused feature gates 2025-06-28 23:36:46 +00:00
rustc_errors Rollup merge of #144579 - joshtriplett:mbe-attr, r=petrochenkov 2025-08-08 14:22:45 -05:00
rustc_expand Auto merge of #145086 - jdonszelmann:revert-allow-internal-unsafe, r=Kobzol 2025-08-09 00:04:35 +00:00
rustc_feature mbe: Parse macro attribute rules 2025-08-08 11:00:54 -07:00
rustc_fluent_macro Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
rustc_fs_util Retry if creating temp fails with access denied 2025-04-25 11:28:36 +00:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir Revert "Port #[allow_internal_unsafe] to the new attribute system" 2025-08-08 11:54:20 +02:00
rustc_hir_analysis Auto merge of #143376 - dianne:guard-scope, r=matthewjasper 2025-08-09 03:19:26 +00:00
rustc_hir_pretty remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
rustc_hir_typeck Rollup merge of #144649 - estebank:issue-144602, r=lcnr 2025-08-08 14:22:46 -05:00
rustc_incremental Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obk 2025-05-07 12:39:54 +00:00
rustc_index Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_index_macros Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_infer Auto merge of #144677 - nnethercote:bound-const-handling, r=lcnr 2025-08-03 05:26:43 +00:00
rustc_interface coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
rustc_lexer test(lexer): Add frontmatter unit test 2025-07-10 10:25:29 -05:00
rustc_lint Revert "Port #[allow_internal_unsafe] to the new attribute system" 2025-08-08 11:54:20 +02:00
rustc_lint_defs Rollup merge of #144369 - joshtriplett:mbe-expr-semi-deny-by-default, r=petrochenkov 2025-08-07 20:49:43 +10:00
rustc_llvm Auto merge of #145077 - Zalathar:rollup-0k4194x, r=Zalathar 2025-08-08 05:59:00 +00:00
rustc_log Add documentation for init_logger_with_additional_layer 2025-06-12 12:11:15 +02:00
rustc_macros remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
rustc_metadata Add target_env = "macabi" and target_env = "sim" 2025-08-08 13:29:46 +02:00
rustc_middle Auto merge of #143376 - dianne:guard-scope, r=matthewjasper 2025-08-09 03:19:26 +00:00
rustc_mir_build Auto merge of #143376 - dianne:guard-scope, r=matthewjasper 2025-08-09 03:19:26 +00:00
rustc_mir_dataflow Rollup merge of #144478 - joshtriplett:doc-code-formatting-prep, r=Amanieu 2025-08-02 11:24:24 +02:00
rustc_mir_transform Rollup merge of #145030 - cjgillot:gvn-no-flatten-index, r=saethlin 2025-08-08 12:52:55 +10:00
rustc_monomorphize Add support for shortening Instance and use it 2025-08-06 22:21:49 +00:00
rustc_next_trait_solver we only merge candidates for trait and normalizes-to goals 2025-08-05 14:57:37 +02:00
rustc_parse Rollup merge of #144956 - fmease:gate-const-trait-syntax, r=BoxyUwU 2025-08-06 21:29:30 +02:00
rustc_parse_format update to literal-escaper-0.0.5 2025-07-08 10:16:44 +00:00
rustc_passes Revert "Port #[allow_internal_unsafe] to the new attribute system" 2025-08-08 11:54:20 +02:00
rustc_pattern_analysis Rollup merge of #144545 - ChayimFriedman2:bool-witness-order, r=Nadrieril 2025-08-08 14:22:44 -05:00
rustc_privacy Auto merge of #144554 - cjgillot:no-hir-eff-vis, r=petrochenkov 2025-08-02 09:23:36 +00:00
rustc_proc_macro Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_public derive hash for placeholder automatically 2025-08-07 09:13:02 -07:00
rustc_public_bridge Remove useless lifetime parameter. 2025-07-23 23:54:37 +00:00
rustc_query_impl Remove unused allow attrs 2025-07-07 12:58:16 +00:00
rustc_query_system remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
rustc_resolve Rollup merge of #144579 - joshtriplett:mbe-attr, r=petrochenkov 2025-08-08 14:22:45 -05:00
rustc_sanitizers Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_serialize use div_ceil instead of manual logic 2025-07-05 10:55:42 +02:00
rustc_session coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
rustc_span mbe: Parse macro attribute rules 2025-08-08 11:00:54 -07:00
rustc_symbol_mangling Reimplement print_region in type_name.rs. 2025-08-07 12:46:33 +10:00
rustc_target Add target_env = "macabi" and target_env = "sim" 2025-08-08 13:29:46 +02:00
rustc_thread_pool Drop rust-version from rustc_thread_pool 2025-08-04 15:03:49 -07:00
rustc_trait_selection Use tcx.short_string() in more diagnostics 2025-08-07 21:18:00 +00:00
rustc_traits Auto merge of #144446 - nnethercote:opt-region-constraints, r=lcnr 2025-08-01 04:06:21 +00:00
rustc_transmute Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_ty_utils Extract borrowck coroutine drop-liveness hack 2025-07-31 17:38:28 +00:00
rustc_type_ir Rollup merge of #144775 - lcnr:skip_binder-comment, r=BoxyUwU 2025-08-08 14:22:47 -05:00
rustc_type_ir_macros Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00