Skip to content

Conversation

Qelxiros
Copy link
Contributor

@Qelxiros Qelxiros commented Sep 12, 2025

Tracking issue: #95383

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 12, 2025

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@Qelxiros
Copy link
Contributor Author

r? libs
(not sure if this is the right team, feel free to reroll)

@rustbot rustbot assigned tgross35 and unassigned scottmcm Sep 30, 2025
@tgross35
Copy link
Contributor

Per rust-lang/libs-team#292 (comment), this should come with a compiler error if attempting to use with a concrete type that isn't a ZST.

@Qelxiros
Copy link
Contributor Author

Qelxiros commented Oct 2, 2025

How should that be implemented? Should I make conjure_zst a lang item and check against it in the compiler, or is there another way to specify the behavior when it's called with a concrete type?

@tgross35
Copy link
Contributor

tgross35 commented Oct 2, 2025

It would probably be good to find an existing lint that fires on concrete types but ignores generics (the behavior specified in the ACP), and then basically mirror this logic. Think this should just need a diagnostic item, which is more lightweight than lang items. But I also don't know this area all that well, asking on Zulip t-compiler/help may be a good idea.

I'm still planning to review this as-is, it's easier to have the lint in a separate PR anyway. Just wanted to make sure it's on the radar.

@clarfonthey
Copy link
Contributor

clarfonthey commented Oct 2, 2025

Presumably the best method would be to just have an intrinsic assert_zero_sized like assert_inhabited or assert_zero_valid and then just call that directly in the function. That way you have the simplest implementation on the compiler side and the library side.

From my understanding, these effectively boil down to a panic when the type is invalid, which means that in the concrete case it'll throw an unconditional panic warning and in the generic case it'll just panic at runtime instead.

@scottmcm
Copy link
Member

scottmcm commented Oct 2, 2025

I think that stabilization might need to wait for such a lint, but I'd still encourage that we do it over multiple PRs. We can add the API first, then any linting after.

@scottmcm
Copy link
Member

scottmcm commented Oct 2, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Oct 2, 2025

📌 Commit 2dec553 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 Oct 2, 2025
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

I did have a couple small things here

View changes since this review

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 2, 2025
@tgross35
Copy link
Contributor

tgross35 commented Oct 2, 2025

@bors r-

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 2, 2025
@tgross35
Copy link
Contributor

tgross35 commented Oct 3, 2025

Thanks!

@bors r=scottmcm,tgross35 rollup

@bors
Copy link
Collaborator

bors commented Oct 3, 2025

📌 Commit a9ab29c has been approved by scottmcm,tgross35

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 3, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
bors added a commit that referenced this pull request Oct 4, 2025
Rollup of 14 pull requests

Successful merges:

 - #142670 (Document fully-qualified syntax in `as`' keyword doc)
 - #144908 (Fix doctest output json)
 - #145685 (add CloneFromCell and Cell::get_cloned)
 - #146330 (Bump unicode_data and printables to version 17.0.0)
 - #146451 (Fix atan2 inaccuracy in documentation)
 - #146479 (add mem::conjure_zst)
 - #147190 (std: `sys::net` cleanups)
 - #147245 (only replace the intended comma in pattern suggestions)
 - #147251 (Do not assert that a change in global cache only happens when concurrent)
 - #147269 (Add regression test for 123953)
 - #147277 (Extract common logic for iterating over features)
 - #147280 (Return to needs-llvm-components being info-only)
 - #147292 (Respect `-Z` unstable options in `rustdoc --test`)
 - #147300 (Add xtensa arch to object file creation)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
bors added a commit that referenced this pull request Oct 4, 2025
Rollup of 14 pull requests

Successful merges:

 - #142670 (Document fully-qualified syntax in `as`' keyword doc)
 - #145685 (add CloneFromCell and Cell::get_cloned)
 - #146330 (Bump unicode_data and printables to version 17.0.0)
 - #146451 (Fix atan2 inaccuracy in documentation)
 - #146479 (add mem::conjure_zst)
 - #146874 (compiler: Hint at multiple crate versions if trait impl is for wrong ADT )
 - #147117 (interpret `#[used]` as `#[used(compiler)]` on illumos)
 - #147190 (std: `sys::net` cleanups)
 - #147251 (Do not assert that a change in global cache only happens when concurrent)
 - #147280 (Return to needs-llvm-components being info-only)
 - #147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting)
 - #147309 (Add documentation about unwinding to wasm targets)
 - #147315 (bless autodiff batching test)
 - #147323 (Fix top level ui tests check in tidy)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 4, 2025
bors added a commit that referenced this pull request Oct 4, 2025
Rollup of 11 pull requests

Successful merges:

 - #142670 (Document fully-qualified syntax in `as`' keyword doc)
 - #145685 (add CloneFromCell and Cell::get_cloned)
 - #146330 (Bump unicode_data and printables to version 17.0.0)
 - #146451 (Fix atan2 inaccuracy in documentation)
 - #146479 (add mem::conjure_zst)
 - #147117 (interpret `#[used]` as `#[used(compiler)]` on illumos)
 - #147190 (std: `sys::net` cleanups)
 - #147251 (Do not assert that a change in global cache only happens when concurrent)
 - #147280 (Return to needs-llvm-components being info-only)
 - #147288 (compiletest: Make `DirectiveLine` responsible for name/value splitting)
 - #147315 (bless autodiff batching test)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 4, 2025
bors added a commit that referenced this pull request Oct 4, 2025
Rollup of 10 pull requests

Successful merges:

 - #142670 (Document fully-qualified syntax in `as`' keyword doc)
 - #145685 (add CloneFromCell and Cell::get_cloned)
 - #146330 (Bump unicode_data and printables to version 17.0.0)
 - #146451 (Fix atan2 inaccuracy in documentation)
 - #146479 (add mem::conjure_zst)
 - #147117 (interpret `#[used]` as `#[used(compiler)]` on illumos)
 - #147190 (std: `sys::net` cleanups)
 - #147251 (Do not assert that a change in global cache only happens when concurrent)
 - #147280 (Return to needs-llvm-components being info-only)
 - #147315 (bless autodiff batching test)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 18388b8 into rust-lang:master Oct 4, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 4, 2025
rust-timer added a commit that referenced this pull request Oct 4, 2025
Rollup merge of #146479 - Qelxiros:mem_conjure_zst, r=scottmcm,tgross35

add mem::conjure_zst

Tracking issue: #95383
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. 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.

7 participants