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

layout_of: T: Thin implies sizeof(&T) == sizeof(usize) #104376

Merged

Conversation

compiler-errors
Copy link
Member

Use the <T as Pointee>::Metadata associated type to calculate the layout of a pointee's metadata, instead of hard-coding rules about certain types.

Maybe this approach is overkill -- we could instead hard-code this approach as a fallback, with the matching on Slice/Dynamic/etc. happening first

Fixes this issue here #104338 (comment) .. But is also useful with transmutes, for example, given the UI test I added below.

@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2022

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@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 Nov 13, 2022
@compiler-errors
Copy link
Member Author

@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 Nov 13, 2022
@bors
Copy link
Contributor

bors commented Nov 13, 2022

⌛ Trying commit 7e7fefe1829e2a101bcf1ea405fe54ea28cf25fe with merge ab804231e1a8be74b6d8bf87c2500ec91374b892...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 13, 2022

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ab804231e1a8be74b6d8bf87c2500ec91374b892): 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-review -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)
3.4% [0.9%, 6.0%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 13, 2022
@compiler-errors compiler-errors force-pushed the thin-metadata-implies-thin-ptr branch from 517d98a to 88d6176 Compare December 27, 2022 18:02
@rust-log-analyzer

This comment has been minimized.

@compiler-errors compiler-errors force-pushed the thin-metadata-implies-thin-ptr branch from 88d6176 to 1f87162 Compare December 27, 2022 18:20
Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with nit

compiler/rustc_middle/src/ty/layout.rs Outdated Show resolved Hide resolved
@compiler-errors compiler-errors force-pushed the thin-metadata-implies-thin-ptr branch from 1f87162 to a5d39cf Compare January 4, 2023 01:03
@compiler-errors
Copy link
Member Author

@bors r=wesleywiser

@bors
Copy link
Contributor

bors commented Jan 4, 2023

📌 Commit a5d39cf has been approved by wesleywiser

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 Jan 4, 2023
@compiler-errors
Copy link
Member Author

Ended up not being perf sensitive anyways, @bors rollup-

@bors
Copy link
Contributor

bors commented Jan 4, 2023

⌛ Testing commit a5d39cf with merge 16db584a73dcbee32144101bf20483303098cb2f...

@compiler-errors
Copy link
Member Author

Let's let the rollup try again

@bors retry

@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)

@bors
Copy link
Contributor

bors commented Jan 4, 2023

⌛ Testing commit a5d39cf with merge ddad1e1...

@bors
Copy link
Contributor

bors commented Jan 4, 2023

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing ddad1e1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 4, 2023
@bors bors merged commit ddad1e1 into rust-lang:master Jan 4, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 4, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ddad1e1): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -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.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.1%, -2.1%] 1
All ❌✅ (primary) - - 0

Cycles

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

@compiler-errors compiler-errors deleted the thin-metadata-implies-thin-ptr branch August 11, 2023 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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-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.

6 participants