rust/compiler
bors f2348fb29a Auto merge of #119122 - matthewjasper:if-let-guard-scoping, r=TaKO8Ki
Give temporaries in if let guards correct scopes

Temporaries in if-let guards have scopes that escape the match arm, this causes problems because the drops might be for temporaries that are not storage live. This PR changes the scope of temporaries in if-let guards to be limited to the arm:

```rust
_ if let Some(s) = std::convert::identity(&Some(String::new())) => {}
//                Temporary for Some(String::new()) is dropped here ^
```

We also now deduplicate temporaries between copies of the guard created for or-patterns:

```rust
// Only create a single Some(String::new()) temporary variable
_ | _ if let Some(s) = std::convert::identity(&Some(String::new())) => {}
```

This changes MIR building to pass around `ExprId`s rather than `Expr`s so that we have a way to index different expressions.

cc #51114
Closes #116079
2023-12-25 04:06:58 +00:00
..
rustc
rustc_abi Extract fn layout_of_struct 2023-12-16 02:36:35 -08:00
rustc_arena rustc_arena: add alloc_str 2023-12-05 17:52:51 -08:00
rustc_ast Rollup merge of #119231 - aDotInTheVoid:PatKind-struct-bool-docs, r=compiler-errors 2023-12-23 16:23:54 +01:00
rustc_ast_lowering Rollup merge of #119231 - aDotInTheVoid:PatKind-struct-bool-docs, r=compiler-errors 2023-12-23 16:23:54 +01:00
rustc_ast_passes Auto merge of #118847 - eholk:for-await, r=compiler-errors 2023-12-22 14:17:10 +00:00
rustc_ast_pretty Rollup merge of #119231 - aDotInTheVoid:PatKind-struct-bool-docs, r=compiler-errors 2023-12-23 16:23:54 +01:00
rustc_attr Add level arg to into_diagnostic. 2023-12-19 09:19:25 +11:00
rustc_baked_icu_data Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_borrowck Rollup merge of #119198 - compiler-errors:desugaring, r=eholk 2023-12-22 21:41:04 -05:00
rustc_builtin_macros Remove all uses of DiagnosticBuilder::forget_guarantee(). 2023-12-23 13:23:28 +11:00
rustc_codegen_cranelift Fix borked subtree syncs 2023-12-24 14:38:37 +00:00
rustc_codegen_gcc Add level arg to into_diagnostic. 2023-12-19 09:19:25 +11:00
rustc_codegen_llvm Auto merge of #119139 - michaelwoerister:cleanup-stable-source-file-id, r=cjgillot 2023-12-24 21:58:39 +00:00
rustc_codegen_ssa Rollup merge of #119198 - compiler-errors:desugaring, r=eholk 2023-12-22 21:41:04 -05:00
rustc_const_eval fix ICE when using raw ptr in a pattern 2023-12-24 11:10:38 +01:00
rustc_data_structures update cfg(bootstrap)s 2023-12-22 11:14:11 +01:00
rustc_driver Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_driver_impl Rename EarlyDiagCtxt methods to match DiagCtxt. 2023-12-23 13:23:28 +11:00
rustc_error_codes move rustc_outlives test code from query to dedicated function 2023-12-23 13:59:10 +01:00
rustc_error_messages Remove rustc_error_messages/messages.ftl. 2023-11-26 08:37:27 +11:00
rustc_errors Remove DiagnosticBuilder::forget_guarantee. 2023-12-23 13:23:28 +11:00
rustc_expand Rollup merge of #119231 - aDotInTheVoid:PatKind-struct-bool-docs, r=compiler-errors 2023-12-23 16:23:54 +01:00
rustc_feature Auto merge of #119211 - rust-lang:pa-master-1.77, r=Mark-Simulacrum 2023-12-23 00:26:47 +00:00
rustc_fluent_macro Add a useful comment. 2023-11-26 08:38:02 +11:00
rustc_fs_util
rustc_graphviz remove unused pub fn 2023-11-23 14:11:02 +03:00
rustc_hir Rollup merge of #119222 - eholk:into-async-iterator, r=compiler-errors,dtolnay 2023-12-22 21:41:04 -05:00
rustc_hir_analysis Auto merge of #119122 - matthewjasper:if-let-guard-scoping, r=TaKO8Ki 2023-12-25 04:06:58 +00:00
rustc_hir_pretty Rid the AST & HIR pretty printers of syntactic cruft 2023-12-22 14:32:40 +01:00
rustc_hir_typeck Rollup merge of #119198 - compiler-errors:desugaring, r=eholk 2023-12-22 21:41:04 -05:00
rustc_incremental Move some methods from tcx.hir() to tcx 2023-12-12 06:40:29 -08:00
rustc_index Mention the relevant tracking issue next to my bit_set hack 2023-12-23 00:04:20 +01:00
rustc_index_macros Put backticks around some attributes in doc comments. 2023-11-27 09:37:01 +11:00
rustc_infer Give DiagnosticBuilder a default type. 2023-12-23 13:23:10 +11:00
rustc_interface Rename EarlyDiagCtxt methods to match DiagCtxt. 2023-12-23 13:23:28 +11:00
rustc_lexer Rename some unescaping functions. 2023-12-13 14:17:50 +11:00
rustc_lint Auto merge of #119211 - rust-lang:pa-master-1.77, r=Mark-Simulacrum 2023-12-23 00:26:47 +00:00
rustc_lint_defs Remove the lint outright 2023-12-16 01:28:06 +00:00
rustc_llvm Rollup merge of #118941 - krasimirgg:llvm-cov, r=nikic 2023-12-18 17:03:11 +01:00
rustc_log rustc_log: provide a way to init logging based on the values, not names, of the env vars 2023-11-11 15:24:33 +01:00
rustc_macros Add level arg to into_diagnostic. 2023-12-19 09:19:25 +11:00
rustc_metadata Auto merge of #119139 - michaelwoerister:cleanup-stable-source-file-id, r=cjgillot 2023-12-24 21:58:39 +00:00
rustc_middle Auto merge of #119139 - michaelwoerister:cleanup-stable-source-file-id, r=cjgillot 2023-12-24 21:58:39 +00:00
rustc_mir_build Auto merge of #119122 - matthewjasper:if-let-guard-scoping, r=TaKO8Ki 2023-12-25 04:06:58 +00:00
rustc_mir_dataflow Don't require owned data in MaybeStorageDead 2023-12-21 12:58:39 +01:00
rustc_mir_transform Rollup merge of #119198 - compiler-errors:desugaring, r=eholk 2023-12-22 21:41:04 -05:00
rustc_monomorphize Add level arg to into_diagnostic. 2023-12-19 09:19:25 +11:00
rustc_next_trait_solver Opportunistically resolve region var in canonicalizer 2023-12-15 05:02:37 +00:00
rustc_parse Rollup merge of #119231 - aDotInTheVoid:PatKind-struct-bool-docs, r=compiler-errors 2023-12-23 16:23:54 +01:00
rustc_parse_format Auto merge of #117819 - fmease:rustc_parse_format-stable-rustc, r=Nilstrieb 2023-11-15 14:55:35 +00:00
rustc_passes Auto merge of #119097 - nnethercote:fix-EmissionGuarantee, r=compiler-errors 2023-12-22 00:03:57 +00:00
rustc_pattern_analysis Auto merge of #118796 - Nadrieril:fix-exponential-id-match-2, r=cjgillot 2023-12-24 14:40:36 +00:00
rustc_privacy resolve: Eagerly feed closure visibilities 2023-12-20 13:42:58 +03:00
rustc_query_impl QueryContext: rename try_collect_active_jobs -> collect_active_jobs and change it's return type from Option<QueryMap> to QueryMap 2023-11-27 18:13:15 +03:00
rustc_query_system Auto merge of #119139 - michaelwoerister:cleanup-stable-source-file-id, r=cjgillot 2023-12-24 21:58:39 +00:00
rustc_resolve Improve some names. 2023-12-23 13:23:28 +11:00
rustc_serialize Call FileEncoder::finish in rmeta encoding 2023-11-22 22:49:22 -05:00
rustc_session Rollup merge of #119171 - nnethercote:cleanup-errors-4, r=compiler-errors 2023-12-22 21:41:03 -05:00
rustc_smir Split coroutine desugaring kind from source 2023-12-22 23:58:29 +00:00
rustc_span Auto merge of #119139 - michaelwoerister:cleanup-stable-source-file-id, r=cjgillot 2023-12-24 21:58:39 +00:00
rustc_symbol_mangling Add level arg to into_diagnostic. 2023-12-19 09:19:25 +11:00
rustc_target Rollup merge of #112936 - Toasterson:illumos-aarch64-target, r=jackh726 2023-12-23 20:02:27 +01:00
rustc_trait_selection Rollup merge of #119198 - compiler-errors:desugaring, r=eholk 2023-12-22 21:41:04 -05:00
rustc_traits add unused NormalizesTo predicate 2023-12-07 17:52:51 +01:00
rustc_transmute Update itertools to 0.11. 2023-11-22 08:13:21 +11:00
rustc_ty_utils Split coroutine desugaring kind from source 2023-12-22 23:58:29 +00:00
rustc_type_ir Auto merge of #118970 - aliemjay:rollup-or33al2, r=aliemjay 2023-12-15 08:51:00 +00:00
stable_mir Split coroutine desugaring kind from source 2023-12-22 23:58:29 +00:00