about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-02-12 20:30:55 +0100
committerGitHub <noreply@github.com>2025-02-12 20:30:55 +0100
commit27dc222fb43c36590a6deb1f4d529de59ed82f21 (patch)
tree751cae6defa815c9531d3969a99fb435c34ddec8 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent269d784dd5999d8a9686d784794f538b22d8183e (diff)
parentf8570e8ac504324031c3ab41393ffb6a199b0479 (diff)
downloadrust-27dc222fb43c36590a6deb1f4d529de59ed82f21.tar.gz
rust-27dc222fb43c36590a6deb1f4d529de59ed82f21.zip
Rollup merge of #136901 - workingjubilee:stabilize-externabi-hashing-forever, r=compiler-errors
compiler: give `ExternAbi` truly stable `Hash` and `Ord`

Currently, `ExternAbi` has a bunch of code to handle the reality that, as an enum, adding more variants to it will risk it hashing differently. It forces all of those variants to be added in a fixed order, except this means that the order of the variants doesn't correspond to any logical order except "historical accident". This is all to avoid having to rebless two tests. Perhaps there were more, once upon a time? But then we invented normalization in our test suite to handle exactly this sort of issue in a more general way.

There are two options here:
- Get rid of all the logical overhead and shrug, embracing blessing a couple of tests sometimes
- Change `ExternAbi` to have an ordering and hash that doesn't depend on the number of variants

As `ExternAbi` is essentially a strongly-typed string, and thus no two strings can be identical, this implements the second of the two by hand-implementing `Ord` and `Hash` to make the hashing and comparison based on the string! This will diff the current hashes, but they will diff no more after this.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions