rust/compiler
Nicholas Nethercote 10144e29af Handle tags better.
Currently, for the enums and comparison traits we always check the tag
for equality before doing anything else. This is a bit clumsy. This
commit changes things so that the tags are handled very much like a
zeroth field in the enum.

For `eq`/ne` this makes the code slightly cleaner.

For `partial_cmp` and `cmp` it's a more notable change: in the case
where the tags aren't equal, instead of having a tag equality check
followed by a tag comparison, it just does a single tag comparison.

The commit also improves how `Hash` works for enums: instead of having
duplicated code to hash the tag for every arm within the match, we do
it just once before the match.

All this required replacing the `EnumNonMatchingCollapsed` value with a
new `EnumTag` value.

For fieldless enums the new code is particularly improved. All the code
now produced is close to optimal, being very similar to what you'd write
by hand.
2022-07-11 16:58:32 +10:00
..
rustc
rustc_apfloat
rustc_arena Rollup merge of #97711 - Nilstrieb:rustc-arena-ub, r=wesleywiser 2022-07-07 18:06:49 +05:30
rustc_ast Auto merge of #98758 - nnethercote:more-derive-output-improvements, r=Mark-Simulacrum 2022-07-08 12:44:14 +00:00
rustc_ast_lowering Auto merge of #95573 - cjgillot:lower-query, r=michaelwoerister 2022-07-07 18:14:44 +00:00
rustc_ast_passes Suggest using block for extern "abi" fn with no body 2022-07-06 13:27:53 +01:00
rustc_ast_pretty ast: Add span to Extern 2022-07-02 23:30:03 +01:00
rustc_attr
rustc_borrowck Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk 2022-07-10 11:52:17 +02:00
rustc_builtin_macros Handle tags better. 2022-07-11 16:58:32 +10:00
rustc_codegen_cranelift Partially stabilize const_slice_from_raw_parts 2022-07-09 23:20:02 +02:00
rustc_codegen_gcc fix cranelift and gcc backends 2022-07-09 07:27:29 -04:00
rustc_codegen_llvm don't allow ZST in ScalarInt 2022-07-09 07:27:29 -04:00
rustc_codegen_ssa tweak names and output and bless 2022-07-09 07:43:56 -04:00
rustc_const_eval Auto merge of #98957 - RalfJung:zst-are-different, r=lcnr,oli-obk 2022-07-09 17:16:00 +00:00
rustc_data_structures Allow to create definitions inside the query system. 2022-07-06 22:50:55 +02:00
rustc_driver Fix bug in rustdoc -Whelp 2022-07-02 02:11:49 -05:00
rustc_error_codes Rollup merge of #97423 - m-ou-se:memory-ordering-intrinsics, r=tmiasko 2022-06-29 10:28:18 +05:30
rustc_error_messages simplify plurals in fluent messages using hir::ConstContext 2022-07-08 03:48:10 +00:00
rustc_errors Rollup merge of #98657 - compiler-errors:rustc-const-eval-session-diagnostic-1, r=davidtwco 2022-07-08 18:25:50 +05:30
rustc_expand Auto merge of #98463 - mystor:expand_expr_bool, r=eddyb 2022-07-10 14:02:45 +00:00
rustc_feature
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #99043 - compiler-errors:derive-nit, r=cjgillot 2022-07-09 11:28:07 +05:30
rustc_hir_pretty clean up the borrowing in rustc_hir_pretty 2022-07-03 18:51:14 +02:00
rustc_incremental Rollup merge of #98844 - cjgillot:deep-visit, r=jyn514 2022-07-07 20:33:24 +02:00
rustc_index Use a bitset instead of a hash map in HIR ID validator 2022-07-04 08:30:13 +02:00
rustc_infer Auto merge of #99056 - lcnr:higher_ranked_sub, r=oli-obk 2022-07-09 19:57:13 +00:00
rustc_interface Implement support for DWARF version 5. 2022-07-08 11:31:08 -07:00
rustc_lexer
rustc_lint Auto merge of #95573 - cjgillot:lower-query, r=michaelwoerister 2022-07-07 18:14:44 +00:00
rustc_lint_defs Rollup merge of #98507 - xFrednet:rfc-2383-manual-expectation-magic, r=wesleywiser 2022-07-07 18:06:50 +05:30
rustc_llvm llvm-wrapper: adapt for LLVMConstExtractValue removal 2022-06-30 12:47:34 +00:00
rustc_log
rustc_macros Use dashes instead of underscores in fluent names 2022-07-08 03:37:36 +00:00
rustc_metadata Auto merge of #99024 - matthiaskrgr:rollup-8ygpcpg, r=matthiaskrgr 2022-07-07 20:55:34 +00:00
rustc_middle Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk 2022-07-10 11:52:17 +02:00
rustc_mir_build tweak names and output and bless 2022-07-09 07:43:56 -04:00
rustc_mir_dataflow Rollup merge of #99022 - pierwill:always-storage-live-locals, r=pierwill 2022-07-09 12:52:50 +02:00
rustc_mir_transform Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk 2022-07-10 11:52:17 +02:00
rustc_monomorphize Update TypeVisitor paths 2022-07-06 06:41:53 +01:00
rustc_parse Auto merge of #98638 - bjorn3:less_string_interning, r=tmiasko 2022-07-08 10:03:27 +00:00
rustc_parse_format
rustc_passes Reword comments and rename HIR visiting methods. 2022-07-07 16:01:43 +02:00
rustc_plugin_impl
rustc_privacy Rollup merge of #98881 - cjgillot:q-def-kind, r=fee1-dead 2022-07-06 14:49:08 +05:30
rustc_query_impl Use a dedicated DepKind for the forever-red node. 2022-07-06 23:20:12 +02:00
rustc_query_system Auto merge of #99028 - tmiasko:inline, r=estebank 2022-07-09 04:34:51 +00:00
rustc_resolve Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk 2022-07-10 11:52:17 +02:00
rustc_save_analysis Factor out hir::Node::Binding 2022-07-01 10:04:19 -05:00
rustc_serialize
rustc_session Implement support for DWARF version 5. 2022-07-08 11:31:08 -07:00
rustc_smir
rustc_span Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk 2022-07-10 11:52:17 +02:00
rustc_symbol_mangling Allow to create definitions inside the query system. 2022-07-06 22:50:55 +02:00
rustc_target Rollup merge of #99043 - compiler-errors:derive-nit, r=cjgillot 2022-07-09 11:28:07 +05:30
rustc_trait_selection Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obk 2022-07-10 11:52:17 +02:00
rustc_traits Update TypeVisitor paths 2022-07-06 06:41:53 +01:00
rustc_ty_utils Update TypeVisitor paths 2022-07-06 06:41:53 +01:00
rustc_type_ir Auto merge of #98614 - oli-obk:take_unsound_opaque_types, r=wesleywiser 2022-07-08 17:55:26 +00:00
rustc_typeck Auto merge of #98785 - compiler-errors:no-check-expr-in-check-compatible, r=estebank 2022-07-10 16:45:17 +00:00