-
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
Encoder/decoder cleanups #110927
Encoder/decoder cleanups #110927
Conversation
It's unnecessary. Note that `MemDecoder::read_raw_bytes` how has a `&'a [u8]` return type, the same as what `read_raw_bytes_inherent` had.
Because I was wondering about it, and this may save a future person from also wondering.
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.
Looks good! I can't say I really know when all those types ought to have the derives, but since it compiles and the tests pass without them, removing them seems perfectly reasonable.
r=me with or without the one suggestion above.
Checking that `read_raw_bytes(len)` changes the position by `len` is a reasonable thing for a test, but isn't much use in just one of the zillion `Decodable` impls.
The methods for `i8`, `bool`, `char`, `str` are the same for all impls, because they layered on top of other methods.
It's just a synonym for `read_u8`.
I was curious about how many `Encodable`/`Decodable` derives we have. Some grepping revealed that it's over 500 of each, but the number of `Encodable` ones was higher, which was weird. Most of the `Encodable`-only ones were in `hir.rs`. This commit removes them all, plus some other unnecessary derives in that file and others that I found via trial and error.
cf46f6f
to
23e91d4
Compare
I don't expect this will affect perf, but encoding/decoding is hot enough that's it's worth checking. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 23e91d4 with merge 38cf30d597ab89d758b80c23de286297c28000fb... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (38cf30d597ab89d758b80c23de286297c28000fb): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
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.
|
@bors r=scottmcm rollup |
⌛ Testing commit 23e91d4 with merge c0c44e74e7f78d07738228323651c1533f26e709... |
💔 Test failed - checks-actions |
@bors retry python setuptools issue |
…ps, r=scottmcm Encoder/decoder cleanups Best reviewed one commit at a time. r? `@scottmcm`
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#110877 (Provide better type hints when a type doesn't support a binary operator) - rust-lang#110917 (only error combining +whole-archive and +bundle for rlibs) - rust-lang#110921 (Use `NonNull::new_unchecked` and `NonNull::len` in `rustc_arena`.) - rust-lang#110927 (Encoder/decoder cleanups) - rust-lang#110944 (share BinOp::Offset between CTFE and Miri) - rust-lang#110948 (run-make test: using single quotes to not trigger the shell) - rust-lang#110957 (Fix an ICE in conflict error diagnostics) - rust-lang#110960 (fix false negative for `unused_mut`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
In rust-lang#110927 the encode/decode methods for `i8`, `char`, `bool`, and `str` were made inherent. This commit removes some unnecessary implementations of these methods that were missed in that PR.
Best reviewed one commit at a time.
r? @scottmcm