3

Implement `core::ptr::Unique` on top of `NonNull` by eduardosm · Pull Request #9...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/96010
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Copy link

Contributor

@eduardosm eduardosm commented 9 days ago

Removes the use rustc_layout_scalar_valid_range_start and some unsafe blocks.

rustbot

added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label

9 days ago

Copy link

Collaborator

rust-highfive commented 9 days ago

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with r? rust-lang/libs-api @rustbot label +T-libs-api to request review from a libs-api team reviewer. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • a stabilization of a library feature
  • introducing new or changes existing unstable library APIs
  • changes to public documentation in ways that create new stability guarantees

Copy link

Collaborator

rust-highfive commented 9 days ago

r? @thomcc

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

rust-highfive

added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label

9 days ago

This comment has been hidden.

eduardosm

changed the title Implement core::ptr::Unique on top of NonNull

[Help wanted] Implement core::ptr::Unique on top of NonNull

9 days ago

Copy link

Contributor

tmiasko commented 9 days ago

You probably need to change the code generation by adding one additional extract_field / project_field when dereferencing a box (those correspond to the first field Box, the first field of Unique, and now in addition to that the first field of NonNull):

if cg_base.layout.ty.is_box() && !cg_base.layout.field(cx, 1).is_zst() {

let ptr = cg_base.extract_field(bx, 0).extract_field(bx, 0);

ptr.deref(bx.cx())

} else {

// a box with a non-zst allocator should not be directly dereferenced

if cg_base.layout.ty.is_box() && !cg_base.layout.field(cx, 1).is_zst() {

let ptr = cg_base.project_field(bx, 0).project_field(bx, 0);

bx.load_operand(ptr).deref(bx.cx())

eduardosm reacted with thumbs up emoji

This comment has been minimized.

This comment has been minimized.

Copy link

Contributor

Author

eduardosm commented 9 days ago

You probably need to change the code generation by adding one additional extract_field / project_field when dereferencing a box (those correspond to the first field Box, the first field of Unique, and now in addition to that the first field of NonNull):

Thanks for the tip

This comment has been hidden.

eduardosm

changed the title [Help wanted] Implement core::ptr::Unique on top of NonNull

Implement core::ptr::Unique on top of NonNull

9 days ago

eduardosm

marked this pull request as ready for review

9 days ago

Copy link

Contributor

thomcc commented 9 days ago

Hmm, yeah, never really did understand what the deal with Unique was, so I'm gonna to punt this to someone else. Naïvely, it looks fine.

r? rust-lang/libs

Copy link

Member

m-ou-se commented 9 days ago

@bors r+

Copy link

Contributor

bors commented 9 days ago

pushpin Commit a22a9a9 has been approved by m-ou-se

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

9 days ago

Copy link

Contributor

tmiasko commented 8 days ago

FYI: @antoyo, @bjorn3 this pull request modifies Box, in case mini_core or other backends need matching changes.

Copy link

Contributor

Author

eduardosm commented 8 days ago

Can we run MSVC CI on this PR to test CDB without waiting for rollup?

Copy link

Member

m-ou-se commented 8 days ago

edited

Can we run MSVC CI on this PR to test CDB without waiting for rollup?

It's possible, but there's no bot command or something to do that. You'd have to temporarily modify src/ci/github-actions/ci.yml in this PR to include that test runner in the ones that run on PRs. (And run ./x.py run src/tools/expand-yaml-anchors/ to update .github/workflows/ci.yml.)

eduardosm reacted with thumbs up emoji

eduardosm

changed the title Implement core::ptr::Unique on top of NonNull

[Do not merge yet] Implement core::ptr::Unique on top of NonNull

8 days ago

eduardosm

marked this pull request as draft

8 days ago

eduardosm

changed the title [Do not merge yet] Implement core::ptr::Unique on top of NonNull

Implement core::ptr::Unique on top of NonNull

8 days ago

eduardosm

marked this pull request as ready for review

8 days ago

Copy link

Contributor

Author

eduardosm commented 8 days ago

MSVC tests have finally passed, reverted PR CI changes

Copy link

Contributor

klensy commented 8 days ago

MSVC tests have finally passed, reverted PR CI changes

You can squash commits a little, instead of having unrelated ones in history.

Copy link

Contributor

Author

eduardosm commented 8 days ago

You can squash commits a little, instead of having unrelated ones in history.

Copy link

Contributor

Author

eduardosm commented 7 days ago

@rustbot label -S-waiting-on-bors +S-waiting-on-review

rustbot

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

7 days ago

Copy link

Contributor

tmiasko commented 6 days ago

@bors r=m-ou-se,tmiasko rollup=never

Copy link

Contributor

bors commented 6 days ago

pushpin Commit 7ba0292 has been approved by m-ou-se,tmiasko

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

6 days ago

Copy link

Contributor

bors commented 6 days ago

hourglass Testing commit 7ba0292 with merge ac8b118...

Copy link

Contributor

bors commented 5 days ago

sunny Test successful - checks-actions
Approved by: m-ou-se,tmiasko
Pushing ac8b118 to master...

Copy link

Collaborator

rust-timer commented 5 days ago

Finished benchmarking commit (ac8b118): comparison url.

Summary:

  • Primary benchmarks: crying_cat_face relevant regressions found
  • Secondary benchmarks: mixed results

Regressions crying_cat_face
(primary) Regressions crying_cat_face
(secondary) Improvements tada
(primary) Improvements tada
(secondary) All crying_cat_facetada
(primary)

count1 20 10 0 6 20

mean2 0.6% 1.3% N/A -0.4% 0.6%

max 1.2% 2.5% N/A -0.5% 1.2%

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

rustbot

added the perf-regression Performance regressions label

5 days ago

eduardosm

deleted the Unique-on-top-of-NonNull branch

5 days ago

Copy link

Member

pnkfelix commented 2 days ago

  • This seems like it introduced a regression into the compilation times for a lot of important crates.
  • I'm not clear on what its buying us, it seems like internal code cleanup? That doesn't justify a >=1% compile-time regression to webrender and syn.

@eduardosm or @m-ou-se , do either of you have time to look into the cause of this? I'm tempted to suggest we revert it, unless someone can present an argument for why we need it.

pnkfelix

added the I-libs-nominated Indicates that an issue has been nominated for discussion during a libs team meeting. label

2 days ago

Copy link

Member

pnkfelix commented 2 days ago

nominating for attention from T-libs, in the hopes that someone can address my concerns above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

m-ou-se

Labels

I-libs-nominated Indicates that an issue has been nominated for discussion during a libs team meeting. merged-by-bors This PR was explicitly merged by bors perf-regression Performance regressions 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

Milestone

1.62.0

Development

Successfully merging this pull request may close these issues.

None yet

11 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK