Registry Mirror
Skip to content

Conversation

@scottmcm

@scottmcm scottmcm commented Sep 23, 2022 •

Copy link
Copy Markdown
Member

View all comments

There's a bunch of these checks because of special handing for ZSTs in various unsafe implementations of stuff.

This lets them be T::IS_ZST instead of mem::size_of::<T>() == 0 every time, making them both more readable and more terse.

Not proposed for stabilization. Would be pub(crate) except alloc wants to use it too.

(And while it doesn't matter now, if we ever get something like #85836 making it a const can help codegen be simpler.)

There's a bunch of these checks because of special handing for ZSTs in various unsafe implementations of stuff.

This lets them be `T::IS_ZST` instead of `mem::size_of::<T>() == 0` every time, making them both more readable and more terse.

*Not* proposed for stabilization at this time.  Would be `pub(crate)` except `alloc` wants to use it too.

(And while it doesn't matter now, if we ever get something like 85836 making it a const can help codegen be simpler.)
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 23, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @thomcc

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot

This comment was marked as resolved.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 23, 2022
@thomcc

thomcc commented Sep 23, 2022

Copy link
Copy Markdown
Member

Hm, neat. I know you said it shouldn't impact codegen at all, but I'm a little curious.

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 23, 2022
@bors

bors commented Sep 23, 2022

Copy link
Copy Markdown
Contributor

⌛ Trying commit cbbcd9f with merge 62c55795633b779a3a1d8085381e862b9104bf4d...

@scottmcm

scottmcm commented Sep 23, 2022 •

Copy link
Copy Markdown
Member Author

I know you said it shouldn't impact codegen at all

All I meant by that was that there's currently no special handling for switchInt on a constant in cg_llvm.

I agree this should have a perf run, but was waiting on the PR build because I'm too good at under-testing locally. Looks like when I fixed some of the warnings(-as-errors) about unused imports I broke the docs 🤦

@bors

bors commented Sep 23, 2022

Copy link
Copy Markdown
Contributor

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 23, 2022
@scottmcm

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@bors

bors commented Sep 23, 2022

Copy link
Copy Markdown
Contributor

⌛ Trying commit 96314f9cfb3a489b83e05ce70a48ef045aca6d62 with merge 20e3190ff975b91b5b541a7f5b264084b94ace56...

@bors

bors commented Sep 23, 2022

Copy link
Copy Markdown
Contributor

☀️ Try build successful - checks-actions
Build commit: 20e3190ff975b91b5b541a7f5b264084b94ace56 (20e3190ff975b91b5b541a7f5b264084b94ace56)

@rust-timer

Copy link
Copy Markdown

Queued 20e3190ff975b91b5b541a7f5b264084b94ace56 with parent 77e7e88, future comparison URL.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (20e3190ff975b91b5b541a7f5b264084b94ace56): comparison URL.

Overall result: ❌ regressions - 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-review -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.0% [-5.0%, -5.0%] 1
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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
11.9% [11.9%, 11.9%] 1
Improvements ✅
(primary)
-2.6% [-2.6%, -2.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.6% [-2.6%, -2.6%] 1

Footnotes

  1. the arithmetic mean of the percent change ↩ ↩2 ↩3

  2. number of relevant changes ↩ ↩2 ↩3

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 23, 2022
@scottmcm

Copy link
Copy Markdown
Member Author

Hmm, that's a weird build failure. RustDoc handled it fine, but now it's a linkchecker error?

Local repro time, I guess -- x.py doc library/std was clean :(

@scottmcm

Copy link
Copy Markdown
Member Author

Ok, filed #102221 for the weird failure when I tried to use cfg(doc), and fixed it with just using an #[allow].

Should be good to go now 🤞

@rustbot ready

@rust-log-analyzer

This comment has been minimized.

Comment thread library/core/src/mem/mod.rs Resolved
@thomcc

thomcc commented Sep 24, 2022

Copy link
Copy Markdown
Member

Thank you.

@bors r+

@bors

bors commented Sep 24, 2022

Copy link
Copy Markdown
Contributor

📌 Commit ed16dbf has been approved by thomcc

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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 24, 2022
@bors

bors commented Sep 25, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit ed16dbf with merge e58621a...

@bors

bors commented Sep 25, 2022

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-actions
Approved by: thomcc
Pushing e58621a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 25, 2022
@bors
bors merged commit e58621a into rust-lang:master Sep 25, 2022
@rustbot rustbot added this to the 1.66.0 milestone Sep 25, 2022
@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (e58621a): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.0% [0.4%, 2.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.2% [2.4%, 4.1%] 2
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.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.2% [3.2%, 7.9%] 4
Improvements ✅
(primary)
-2.3% [-2.7%, -2.1%] 3
Improvements ✅
(secondary)
-2.8% [-2.8%, -2.8%] 1
All ❌✅ (primary) -2.3% [-2.7%, -2.1%] 3

Footnotes

  1. the arithmetic mean of the percent change ↩ ↩2 ↩3

  2. number of relevant changes ↩ ↩2 ↩3

@scottmcm
scottmcm deleted the constify-some-conditions branch September 25, 2022 16:45
@clarfonthey clarfonthey added the A-slice-vec Area: `[T]` and `Vec<T>` label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-slice-vec Area: `[T]` and `Vec<T>` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants