Skip to content
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

Merged
merged 6 commits into from
Apr 29, 2023
Merged

Conversation

nnethercote
Copy link
Contributor

Best reviewed one commit at a time.

r? @scottmcm

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.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 28, 2023
Copy link
Member

@scottmcm scottmcm left a 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.
@nnethercote
Copy link
Contributor Author

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

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 28, 2023
@bors
Copy link
Contributor

bors commented Apr 28, 2023

⌛ Trying commit 23e91d4 with merge 38cf30d597ab89d758b80c23de286297c28000fb...

@bors
Copy link
Contributor

bors commented Apr 28, 2023

☀️ Try build successful - checks-actions
Build commit: 38cf30d597ab89d758b80c23de286297c28000fb (38cf30d597ab89d758b80c23de286297c28000fb)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (38cf30d597ab89d758b80c23de286297c28000fb): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking 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
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results

This 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.

mean range count
Regressions ❌
(primary)
1.0% [1.0%, 1.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.0% [1.0%, 1.0%] 1

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 28, 2023
@nnethercote
Copy link
Contributor Author

@bors r=scottmcm rollup

@bors
Copy link
Contributor

bors commented Apr 28, 2023

📌 Commit 23e91d4 has been approved by scottmcm

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2023
@bors
Copy link
Contributor

bors commented Apr 28, 2023

⌛ Testing commit 23e91d4 with merge c0c44e74e7f78d07738228323651c1533f26e709...

@bors
Copy link
Contributor

bors commented Apr 28, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 28, 2023
@ehuss
Copy link
Contributor

ehuss commented Apr 28, 2023

@bors retry

python setuptools issue

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2023
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 28, 2023
…ps, r=scottmcm

Encoder/decoder cleanups

Best reviewed one commit at a time.

r? `@scottmcm`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2023
…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
@bors bors merged commit 37076eb into rust-lang:master Apr 29, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 29, 2023
@nnethercote nnethercote deleted the Encoder-Decoder-cleanups branch May 1, 2023 03:26
nnethercote added a commit to nnethercote/rust that referenced this pull request May 4, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants