Repository navigation
Avoid Hash::hash when stable-hashing various types - #165578
Conversation
|
Some changes occurred in compiler/rustc_attr_ir |
|
r? @adwinwhite rustbot has assigned @adwinwhite. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Neutral perf run from the previous incarnation of this PR: #165218 (comment) (Earlier drafts had perf impact due to Span changes, which were extracted to #165381.) |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Avoid `Hash::hash` when stable-hashing various types
This comment has been minimized.
This comment has been minimized.
|
Sorry, missed your comment on perf. |
|
Try build cancelled. Cancelled workflows: Hint: if you want to run another try build, you do not need to manually cancel the previous one. Just run |
LangItem might eventually be the type that forces us to support `#[derive(StableHash)]` for enums with more than 256 variants.
This commit also removes `#[derive(Hash)]` from the affected types, since it is no longer used. If these types need a plain Hash impl is needed in the future, it could potentially share the `stable_hash_inner` implementation.
By moving away from the old `impl_stable_traits_for_trivial_type!` macro, this commit has the side-effect of removing unused StableOrd impls for some types. Those impls could potentially be re-added if they are ever needed.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Since I rebased and made some minor tweaks, might as well another perf run just to double-check. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Avoid `Hash::hash` when stable-hashing various types
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (5154534): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesResults (secondary 1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 482.775s -> 481.658s (-0.23%) |
|
@bors r+ rollup |
Avoid `Hash::hash` when stable-hashing various types This PR makes StableHash independent of stdlib-dependent Hash impls for several types, to avoid potential inconsistency in stable hashing between stage1 and stage2 compilers. This covers all of the StableHash impls that I'm aware of. However, there are still various other places in the compiler where we rely on `Hash::hash` for hashes that probably should be made consistent between compiler stages.
Rollup of 6 pull requests Successful merges: - #165778 (Bump stage0 to 1.101.0-beta.1) - #163077 (feat: support nested functions with `#[offload_kernel]`) - #165578 (Avoid `Hash::hash` when stable-hashing various types) - #165729 (tests: Add regression test for infinite recursive dereference) - #165819 (Avoid redundant scans when extracting stage0 archives) - #165822 (Remove unused compiler modules and types)
Avoid `Hash::hash` when stable-hashing various types This PR makes StableHash independent of stdlib-dependent Hash impls for several types, to avoid potential inconsistency in stable hashing between stage1 and stage2 compilers. This covers all of the StableHash impls that I'm aware of. However, there are still various other places in the compiler where we rely on `Hash::hash` for hashes that probably should be made consistent between compiler stages.
Rollup of 12 pull requests Successful merges: - #165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - #165778 (Bump stage0 to 1.101.0-beta.1) - #165412 (Implement `core::ops::FnAddr`) - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - #165818 (do not lint `redundant_lifetimes` on items from external macros) - #163077 (feat: support nested functions with `#[offload_kernel]`) - #164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - #165578 (Avoid `Hash::hash` when stable-hashing various types) - #165729 (tests: Add regression test for infinite recursive dereference) - #165819 (Avoid redundant scans when extracting stage0 archives) - #165822 (Remove unused compiler modules and types) - #165824 (Add regression test for HRTB projection bound with TryFrom error)
Rollup of 11 pull requests Successful merges: - #165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - #165778 (Bump stage0 to 1.101.0-beta.1) - #165412 (Implement `core::ops::FnAddr`) - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - #165818 (do not lint `redundant_lifetimes` on items from external macros) - #163077 (feat: support nested functions with `#[offload_kernel]`) - #164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - #165578 (Avoid `Hash::hash` when stable-hashing various types) - #165729 (tests: Add regression test for infinite recursive dereference) - #165822 (Remove unused compiler modules and types) - #165824 (Add regression test for HRTB projection bound with TryFrom error)
Rollup merge of #165578 - Zalathar:hash, r=adwinwhite Avoid `Hash::hash` when stable-hashing various types This PR makes StableHash independent of stdlib-dependent Hash impls for several types, to avoid potential inconsistency in stable hashing between stage1 and stage2 compilers. This covers all of the StableHash impls that I'm aware of. However, there are still various other places in the compiler where we rely on `Hash::hash` for hashes that probably should be made consistent between compiler stages.
Rollup of 11 pull requests Successful merges: - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1) - rust-lang/rust#165412 (Implement `core::ops::FnAddr`) - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros) - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`) - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types) - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference) - rust-lang/rust#165822 (Remove unused compiler modules and types) - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
Rollup of 11 pull requests Successful merges: - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1) - rust-lang/rust#165412 (Implement `core::ops::FnAddr`) - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros) - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`) - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types) - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference) - rust-lang/rust#165822 (Remove unused compiler modules and types) - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
Rollup of 11 pull requests Successful merges: - rust-lang/rust#165804 (cg_llvm: Use an invariant lifetime brand for LLVM values) - rust-lang/rust#165778 (Bump stage0 to 1.101.0-beta.1) - rust-lang/rust#165412 (Implement `core::ops::FnAddr`) - rust-lang/rust#165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - rust-lang/rust#165818 (do not lint `redundant_lifetimes` on items from external macros) - rust-lang/rust#163077 (feat: support nested functions with `#[offload_kernel]`) - rust-lang/rust#164795 (Extend support of lint `explicit_outlives_requirements` to checked type aliases) - rust-lang/rust#165578 (Avoid `Hash::hash` when stable-hashing various types) - rust-lang/rust#165729 (tests: Add regression test for infinite recursive dereference) - rust-lang/rust#165822 (Remove unused compiler modules and types) - rust-lang/rust#165824 (Add regression test for HRTB projection bound with TryFrom error)
Hash::hashwhen stable-hashing Span #165381Hash::hashwhen stable-hashing various types (old) #165218This PR makes StableHash independent of stdlib-dependent Hash impls for several types, to avoid potential inconsistency in stable hashing between stage1 and stage2 compilers.
This covers all of the StableHash impls that I'm aware of. However, there are still various other places in the compiler where we rely on
Hash::hashfor hashes that probably should be made consistent between compiler stages.