rust/compiler
Matthias Krüger 104c4bc808
Rollup merge of #114009 - dvdhrm:pr/transmzst, r=pnkfelix
compiler: allow transmute of ZST arrays with generics

Extend the `SizeSkeleton` evaluator to shortcut zero-sized arrays, thus considering `[T; 0]` to have a compile-time fixed-size of 0.

The existing evaluator already deals with generic arrays under the feature-guard `transmute_const_generics`. However, it merely allows comparing fixed-size types with fixed-size types, and generic types with generic types. For generic types, it merely compares whether their arguments match (ordering them first). Even if their exact sizes are not known at compile time, it can ensure that they will eventually be the same.

This patch extends this by shortcutting the size-evaluation of zero sized arrays and thus allowing size comparisons of `()` with `[T; 0]`, where one contains generics and the other does not.

This code is guarded by `transmute_const_generics` (#109929), even though it is unclear whether it should be. However, this assumes that a separate stabilization PR is required to move this out of the feature guard.

Initially reported in #98104.
2024-03-22 20:31:28 +01:00
..
rustc
rustc_abi Auto merge of #121668 - erikdesjardins:commonprim, r=scottmcm,oli-obk 2024-03-13 15:25:35 +00:00
rustc_arena rename ptr::invalid -> ptr::without_provenance 2024-02-21 20:15:52 +01:00
rustc_ast Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgr 2024-03-22 12:29:42 +00:00
rustc_ast_ir Fix typo in VisitorResult 2024-03-08 23:20:29 -05:00
rustc_ast_lowering Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgr 2024-03-22 12:29:42 +00:00
rustc_ast_passes Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_ast_pretty Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_attr Rename IntoDiagnostic as Diagnostic. 2024-03-11 09:15:09 +11:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #122733 - oli-obk:error_prop, r=compiler-errors 2024-03-21 17:46:49 +01:00
rustc_builtin_macros Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_codegen_cranelift Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix 2024-03-22 16:55:11 +00:00
rustc_codegen_gcc Auto merge of #122055 - compiler-errors:stabilize-atb, r=oli-obk 2024-03-19 00:04:09 +00:00
rustc_codegen_llvm coverage: Clean up marker statements that aren't needed later 2024-03-22 20:20:41 +11:00
rustc_codegen_ssa Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix 2024-03-22 16:55:11 +00:00
rustc_const_eval Rollup merge of #122542 - Zalathar:cleanup, r=oli-obk 2024-03-22 11:37:00 +01:00
rustc_data_structures Auto merge of #122568 - RalfJung:mentioned-items, r=oli-obk 2024-03-21 09:01:18 +00:00
rustc_driver
rustc_driver_impl Rollup merge of #122847 - workingjubilee:suggest-rust-min-stack-workaround-on-overflow, r=TaKO8Ki 2024-03-22 11:37:02 +01:00
rustc_error_codes Auto merge of #122055 - compiler-errors:stabilize-atb, r=oli-obk 2024-03-19 00:04:09 +00:00
rustc_error_messages Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_errors Auto merge of #122754 - Mark-Simulacrum:bootstrap-bump, r=albertlarsan68 2024-03-20 13:43:41 +00:00
rustc_expand Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_feature Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_fluent_macro Rename SubdiagnosticMessage as SubdiagMessage. 2024-03-05 12:14:49 +11:00
rustc_fs_util Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_graphviz Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_hir Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgr 2024-03-22 12:29:42 +00:00
rustc_hir_analysis Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgr 2024-03-22 12:29:42 +00:00
rustc_hir_pretty Implement macro-based deref!() syntax for deref patterns 2024-03-21 11:42:49 -04:00
rustc_hir_typeck Arrange methods on HirTyLowerer more logically 2024-03-22 06:32:51 +01:00
rustc_incremental rename items -> free_items 2024-03-21 14:27:11 +01:00
rustc_index doc: Add better explanation 2024-03-06 16:54:42 +01:00
rustc_index_macros Remove SpecOptionPartialEq 2024-03-19 16:32:01 +00:00
rustc_infer Auto merge of #122824 - oli-obk:no_ord_def_id2, r=estebank,michaelwoerister 2024-03-22 08:10:40 +00:00
rustc_interface Rollup merge of #122847 - workingjubilee:suggest-rust-min-stack-workaround-on-overflow, r=TaKO8Ki 2024-03-22 11:37:02 +01:00
rustc_lexer Invert diagnostic lints. 2024-02-06 13:12:33 +11:00
rustc_lint Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_lint_defs Rollup merge of #121720 - tmandry:split-refining, r=compiler-errors 2024-03-16 23:28:47 +01:00
rustc_llvm Update the minimum external LLVM to 17 2024-03-17 10:11:04 -07:00
rustc_log rustc_log: expose tracing-tree "wraparound" in an env var 2024-03-03 12:33:26 +01:00
rustc_macros Rename diagnostic derive things. 2024-03-11 10:06:34 +11:00
rustc_metadata Auto merge of #121123 - compiler-errors:item-assumptions, r=oli-obk 2024-03-21 06:12:24 +00:00
rustc_middle Rollup merge of #114009 - dvdhrm:pr/transmzst, r=pnkfelix 2024-03-22 20:31:28 +01:00
rustc_mir_build Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_mir_dataflow step cfgs 2024-03-20 08:49:13 -04:00
rustc_mir_transform coverage: Clean up marker statements that aren't needed later 2024-03-22 20:20:41 +11:00
rustc_monomorphize Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix 2024-03-22 16:55:11 +00:00
rustc_next_trait_solver Allow a way to add constructors for rustc_type_ir types 2024-03-04 15:39:59 +00:00
rustc_parse Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_parse_format Extend format arg help for simple tuple index access expression 2024-03-16 22:33:02 +00:00
rustc_passes Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkov 2024-03-22 11:36:58 +01:00
rustc_pattern_analysis Rollup merge of #122644 - Nadrieril:complexity-tests, r=compiler-errors 2024-03-21 17:46:48 +01:00
rustc_privacy rename items -> free_items 2024-03-21 14:27:11 +01:00
rustc_query_impl Verify that query keys result in unique dep nodes 2024-03-12 05:31:41 +01:00
rustc_query_system Rollup merge of #122245 - saethlin:check-dep-graph-size, r=petrochenkov 2024-03-12 09:04:00 -07:00
rustc_resolve Don't suggest deref macro since it's unstable 2024-03-21 11:42:49 -04:00
rustc_serialize Stabilize associated type bounds 2024-03-08 20:56:25 +00:00
rustc_session Rename some target_cfg variables as target. 2024-03-21 11:50:40 +11:00
rustc_smir s/place_debug/place_pretty in SMIR 2024-03-20 18:02:11 -07:00
rustc_span Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgr 2024-03-22 12:29:42 +00:00
rustc_symbol_mangling Rollup merge of #122855 - workingjubilee:mangle-64-bit-chauvinism, r=compiler-errors 2024-03-22 11:37:03 +01:00
rustc_target Rollup merge of #122810 - nnethercote:rm-target_override, r=WaffleLapkin 2024-03-21 17:46:51 +01:00
rustc_trait_selection Update local variables and tracing calls 2024-03-22 06:32:23 +01:00
rustc_traits Merge check_mod_impl_wf and check_mod_type_wf 2024-03-07 06:27:09 +00:00
rustc_transmute Avoid various uses of Option<Span> in favor of using DUMMY_SP in the few cases that used None 2024-03-18 09:34:08 +00:00
rustc_ty_utils Fix ABI for FnMut/Fn impls for async closures 2024-03-19 16:59:24 -04:00
rustc_type_ir Update (doc) comments 2024-03-22 06:31:51 +01:00
stable_mir Rollup merge of #122801 - celinval:smir-pretty, r=compiler-errors 2024-03-21 12:05:08 +01:00