-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make some newtype_index!
derived impls opt-in instead of opt-out
#118125
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Best reviewed one commit at a time. |
This comment was marked as resolved.
This comment was marked as resolved.
93cc392
to
531f4c2
Compare
newtype_index!
derived impls opt-out instead of opt-innewtype_index!
derived impls opt-in instead of opt-out
Could not assign reviewer from: |
☔ The latest upstream changes (presumably #117580) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after rebased
531f4c2
to
e55e28b
Compare
I rebased. @bors r=compiler-errors |
☔ The latest upstream changes (presumably #117582) made this pull request unmergeable. Please resolve the merge conflicts. |
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
e55e28b
to
0991374
Compare
I rebased again. @bors r=compiler-errors |
☀️ Test successful - checks-actions |
Finished benchmarking commit (5a9e0e8): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 677.73s -> 676.065s (-0.25%) |
/// - #[encodable]: derives `Encodable`/`Decodable`. | ||
/// - #[orderable]: derives `PartialOrd`/`Ord`, plus step-related methods. | ||
/// - #[debug_format = "Foo({})"]: derives `Debug` with particular output. | ||
/// - #[max = 0xFFFF_FFFD]: specifies the max value, which allows niche | ||
/// optimizations. The default max value is 0xFFFF_FF00. | ||
/// - #[gate_rustc_only]: makes parts of the generated code nightly-only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/rust-lang-ci/rust/actions/runs/6990882559/job/19020846394#step:26:27071
warning: unresolved link to `encodable`
--> compiler/rustc_index_macros/src/lib.rs:28:9
|
28 | /// - #[encodable]: derives `Encodable`/`Decodable`.
| ^^^^^^^^^ no item named `encodable` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
warning: unresolved link to `orderable`
--> compiler/rustc_index_macros/src/lib.rs:29:9
|
29 | /// - #[orderable]: derives `PartialOrd`/`Ord`, plus step-related methods.
| ^^^^^^^^^ no item named `orderable` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
warning: unresolved link to `gate_rustc_only`
--> compiler/rustc_index_macros/src/lib.rs:33:9
|
33 | /// - #[gate_rustc_only]: makes parts of the generated code nightly-only.
| ^^^^^^^^^^^^^^^ no item named `gate_rustc_only` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed by #118338.
How did you notice this? I never notice warnings buried deep within CI runs like this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading logs from time to time. It's nice to have github action to automate log diffing and grepping to notice interesting stuff.
Opt-in is the standard Rust way of doing things, and avoids some unnecessary dependencies on the
rustc_serialize
crate.r? @lcnr