diff options
| author | Alan Egerton <eggyal@gmail.com> | 2024-06-22 07:11:42 +0100 |
|---|---|---|
| committer | Alan Egerton <eggyal@gmail.com> | 2024-06-22 07:17:02 +0100 |
| commit | 0e73e7095ae7aa7ead69c4ba7ba002560ef118fa (patch) | |
| tree | 53404cdeb87fe3cc5dee1ebc7688c5c1947017fa /compiler/rustc_session | |
| parent | 114dd2061e0bfa6bc1353d0265389cfaa04d8858 (diff) | |
Ensure careful consideration is given by impls
Added an associated `const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED` to the `StableOrd` trait to ensure that implementors carefully consider whether the trait's contract is upheld, as incorrect implementations can cause miscompilations.
Diffstat (limited to 'compiler/rustc_session')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index d5428df0329..f4fd9dee02e 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -491,9 +491,11 @@ pub enum OutputType { DepInfo, } -// Trivial C-Style enums have a stable sort order across compilation sessions. impl StableOrd for OutputType { const CAN_USE_UNSTABLE_SORT: bool = true; + + // Trivial C-Style enums have a stable sort order across compilation sessions. + const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); } impl<HCX: HashStableContext> ToStableHashKey<HCX> for OutputType { |
