rust/compiler
Nicholas Nethercote d4a5b034b7 Don't derive PartialEq::ne.
Currently we skip deriving `PartialEq::ne` for C-like (fieldless) enums
and empty structs, thus reyling on the default `ne`. This behaviour is
unnecessarily conservative, because the `PartialEq` docs say this:

> Implementations must ensure that eq and ne are consistent with each other:
>
> `a != b` if and only if `!(a == b)` (ensured by the default
> implementation).

This means that the default implementation (`!(a == b)`) is always good
enough. So this commit changes things such that `ne` is never derived.

The motivation for this change is that not deriving `ne` reduces compile
times and binary sizes.

Observable behaviour may change if a user has defined a type `A` with an
inconsistent `PartialEq` and then defines a type `B` that contains an
`A` and also derives `PartialEq`. Such code is already buggy and
preserving bug-for-bug compatibility isn't necessary.

Two side-effects of the change:
- There is only one error message produced for types where `PartialEq`
  cannot be derived, instead of two.
- For coverage reports, some warnings about generated `ne` methods not
  being executed have disappeared.

Both side-effects seem fine, and possibly preferable.
2022-08-01 08:01:58 +10:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov 2022-07-30 14:50:05 +00:00
rustc_ast_lowering Replace LifetimeRes::Anonymous by LifetimeRes::Infer. 2022-07-26 19:00:31 +02:00
rustc_ast_passes Remove visit_name from the AST visitor. 2022-07-29 15:28:32 +10:00
rustc_ast_pretty Remove TreeAndSpacing. 2022-07-29 15:52:15 +10:00
rustc_attr avoid embedding StabilityLevel::Unstable reason string into metadata multiple times 2022-07-21 22:53:02 +03:00
rustc_borrowck Change enclosing_body_owner to return LocalDefId 2022-07-29 18:26:10 -04:00
rustc_builtin_macros Don't derive PartialEq::ne. 2022-08-01 08:01:58 +10:00
rustc_codegen_cranelift Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26 2022-07-26 18:53:46 +02:00
rustc_codegen_gcc Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoerister 2022-07-26 01:47:34 +00:00
rustc_codegen_llvm Add elementtype attributes for llvm.arm.ldrex/strex intrinsics 2022-07-27 16:19:07 +02:00
rustc_codegen_ssa Auto merge of #99467 - BelovDV:add_option_link_arg, r=petrochenkov 2022-07-29 15:36:52 +00:00
rustc_const_eval Rollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-generics, r=oli-obk 2022-07-27 17:55:04 +02:00
rustc_data_structures remove some manual hash stable impls 2022-07-29 12:48:28 +02:00
rustc_driver Rename local_did to def_id 2022-07-29 18:26:10 -04:00
rustc_error_codes region_outlives_predicate no snapshot 2022-07-21 13:09:01 +02:00
rustc_error_messages lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_errors Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa 2022-07-20 22:19:30 +00:00
rustc_expand Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov 2022-07-30 14:50:05 +00:00
rustc_feature lint: add bad opt access internal lint 2022-07-27 11:24:27 +01:00
rustc_fs_util
rustc_graphviz
rustc_hir Replace LifetimeRes::Anonymous by LifetimeRes::Infer. 2022-07-26 19:00:31 +02:00
rustc_hir_pretty use rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when rendering path 2022-07-17 04:58:38 +00:00
rustc_incremental Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_index Edit rustc_index::vec::IndexVec::pick3_mut docs 2022-07-21 08:52:18 -05:00
rustc_infer Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot 2022-07-30 20:39:46 +05:30
rustc_interface proc_macro: use crossbeam channels for the proc_macro cross-thread bridge 2022-07-29 17:38:12 -04:00
rustc_lexer
rustc_lint Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov 2022-07-30 14:50:05 +00:00
rustc_lint_defs Generate correct suggestion with named arguments used positionally 2022-07-25 00:00:27 -06:00
rustc_llvm Add elementtype attributes for llvm.arm.ldrex/strex intrinsics 2022-07-27 16:19:07 +02:00
rustc_log
rustc_macros clippy::perf fixes 2022-07-20 11:48:11 +02:00
rustc_metadata Rename local_did to def_id 2022-07-29 18:26:10 -04:00
rustc_middle Rollup merge of #99900 - lcnr:hash-stable-fun, r=cjgillot 2022-07-30 20:39:49 +05:30
rustc_mir_build Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot 2022-07-30 20:39:46 +05:30
rustc_mir_dataflow Auto merge of #99667 - ouz-a:some_branch, r=oli-obk 2022-07-29 07:11:50 +00:00
rustc_mir_transform Change maybe_body_owned_by to take local def id 2022-07-29 18:25:58 -04:00
rustc_monomorphize Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiser 2022-07-22 11:53:40 +05:30
rustc_parse Auto merge of #99948 - Dylan-DPC:rollup-ed5136t, r=Dylan-DPC 2022-07-30 17:30:50 +00:00
rustc_parse_format Generate correct suggestion with named arguments used positionally 2022-07-25 00:00:27 -06:00
rustc_passes Rename local_did to def_id 2022-07-29 18:26:10 -04:00
rustc_plugin_impl
rustc_privacy clippy::perf fixes 2022-07-20 11:48:11 +02:00
rustc_query_impl consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
rustc_query_system consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
rustc_resolve change the type of note field to Option<String> 2022-07-28 18:17:55 +09:00
rustc_save_analysis
rustc_serialize Upgrade indexmap and thorin-dwp to use hashbrown 0.12 2022-07-17 07:05:58 -07:00
rustc_session Auto merge of #99123 - mystor:crossbeam_bridge, r=eddyb 2022-07-30 04:05:28 +00:00
rustc_smir
rustc_span Use line numbers relative to function in mir opt tests 2022-07-28 11:59:54 +02:00
rustc_symbol_mangling Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisa 2022-07-24 01:22:36 +00:00
rustc_target Rollup merge of #99227 - Lokathor:fix-thumbv4t-none-eabi-frame-pointer, r=davidtwco 2022-07-30 07:39:48 +09:00
rustc_trait_selection Rollup merge of #99862 - WaffleLapkin:type_mismatch_fix, r=compiler-errors 2022-07-30 20:39:47 +05:30
rustc_traits Rollup merge of #99714 - ouz-a:issue_57961, r=oli-obk 2022-07-28 16:38:30 +05:30
rustc_ty_utils Rename local_did to def_id 2022-07-29 18:26:10 -04:00
rustc_type_ir Inline DebruijnIndex methods 2022-07-22 17:00:49 +02:00
rustc_typeck Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot 2022-07-30 20:39:46 +05:30