Simplify Encodable derives - #161137
Conversation
|
I don't expect much, maybe some little changes in bootstrap. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Simplify Encodable derives
|
@rust-timer build ba8d592 |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (ba8d592): 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)Results (primary -0.8%, secondary -0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 3.6%)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: 462.121s -> 459.222s (-0.63%) |
|
It would be helpful to add and bless a Here's an example of what that might look like: //@ edition: 2024
//@ check-pass
//@ compile-flags: -Zunpretty=expanded
#![crate_type = "rlib"]
#![feature(rustc_private)]
extern crate rustc_macros;
extern crate rustc_serialize;
extern crate rustc_span;
use rustc_macros::Encodable;
#[derive(Encodable)]
struct UnitStruct;
#[derive(Encodable)]
struct EmptyStruct {}
#[derive(Encodable)]
enum EmptyEnum {}
#[derive(Encodable)]
enum SingleFieldlessEnum {
A,
}
#[derive(Encodable)]
enum SingleEnum {
A(u32),
}
#[derive(Encodable)]
enum FieldlessEnum {
A,
B,
}
#[derive(Encodable)]
enum PartlyFieldlessEnum {
A,
B(u32),
} |
That's a good idea, I will do that. I was thinking of posting the diff here to make the changes more visible for the review, but this is much better. ❤️ Thanks a lot for writing down the example, it would probably take me a lot longer to figure out myself. |
|
Yeah, I figured it would be a bit mean to just say “please write a ui-fulldeps test”, and from past experience I already had a pretty good idea of what it needs to look like. 😅 |
4d4cda4 to
ca338a7
Compare
|
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. |
|
I added the test based on your comment. Not sure if you checked it before posting, but it was actually 100% right, I didn't need to change or debug anything about it 👍 I re-blessed it with each edit to make it clear what it does. The test also made it clear that I didn't handle all unit-like types so I added a case to cover that in the last commit. |
ca338a7 to
93510b8
Compare
|
@rustbot ready |
|
Error: Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip. |
View all comments
Few cleanups I found when investigating encoding code.
This is not super impactful but it makes the expanded code simpler, which is nice when you look at it for debugging purposes.
Best reviewed commit by commit
r? nnethercote
(I believe you've looked into this code quite a bit before)