Skip to content

Conversation

@saethlin
Copy link
Member

@saethlin saethlin commented Oct 25, 2025

In #148104, we found the panic message here rather confusing, and (if I'm reading the tea leaves right) that's because the intended audience for either side of the phrase is very different. I think this is more clear if/when this is encountered by users.

I expect this ICE to be hit in practice by people calling the size_of and align_of intrinsics, so it's now kind of helpful for those users too.

The original effort to stop backends from needing to support nullary intrinsics added a note to all these const-only intrinsics, but when #147793 ported two more the paragraph wasn't added. I've added it.

@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@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 Oct 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2025

r? @dianqk

rustbot has assigned @dianqk.
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

@rust-log-analyzer

This comment has been minimized.

@folkertdev
Copy link
Contributor

I expect this ICE to be hit in practice by people calling the size_of and align_of intrinsics. Maybe we should also add specific guidance for those users?

In this particular case it would have been helpful to know that the problem is calling the intrinsic directly. I did not consider that that might be happening (and core::mem::size_of logically calls the intrinsic, so the error talking about intrinsics didn't surprise me).

So yeah some note about how directly calling these intrinsics is discouraged (or some stronger word: it just does not work) would have helped.

Copy link
Member

@Noratrieb Noratrieb 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 after reflowing, this sounds good

View changes since this review

@saethlin saethlin force-pushed the nullary-intrinsic-check-bug-msg branch from d890b26 to 07f144e Compare October 25, 2025 22:41
@saethlin
Copy link
Member Author

@bors r=Noratrieb rollup

@bors
Copy link
Collaborator

bors commented Oct 25, 2025

📌 Commit 07f144e has been approved by Noratrieb

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 25, 2025
Copy link
Member

@dianqk dianqk left a comment

Choose a reason for hiding this comment

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

Should we leave a comment stating that this can only be called at compile time? I can see this comment in some intrinsics (like needs_drop), but not in align_of. When I see Nullary intrinsic align_of must be called in a const block, I don't understand why this must be called in a const block.

View changes since this review

@saethlin
Copy link
Member Author

I'll come back to that.
@bors r-

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 26, 2025
@saethlin saethlin force-pushed the nullary-intrinsic-check-bug-msg branch from 07f144e to 7a0d9c8 Compare October 26, 2025 01:32
@rustbot
Copy link
Collaborator

rustbot commented Oct 26, 2025

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

@saethlin
Copy link
Member Author

I see what you meant. #142839 added a paragraph to the docs for all affected intrinsics then #147793 added size_of and align_of to this list of const-only intrinsics, but didn't add the paragraph for them.

Copy link
Member

@dianqk dianqk left a comment

Choose a reason for hiding this comment

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

@dianqk
Copy link
Member

dianqk commented Oct 26, 2025

@bors r=Noratrieb,dianqk

@bors
Copy link
Collaborator

bors commented Oct 26, 2025

📌 Commit 7a0d9c8 has been approved by Noratrieb,dianqk

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 26, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 26, 2025
…ug-msg, r=Noratrieb,dianqk

Improve the ICE message for invalid nullary intrinsic calls

In rust-lang#148104, we found the panic message here rather confusing, and (if I'm reading the tea leaves right) that's because the intended audience for either side of the phrase is very different. I think this is more clear if/when this is encountered by users.

I expect this ICE to be hit in practice by people calling the `size_of` and `align_of` intrinsics, so it's now _kind of_ helpful for those users too.

The original effort to stop backends from needing to support nullary intrinsics added a note to all these const-only intrinsics, but when rust-lang#147793 ported two more the paragraph wasn't added. I've added it.
bors added a commit that referenced this pull request Oct 26, 2025
Rollup of 4 pull requests

Successful merges:

 - #145665 (Don't require `T: RefUnwindSafe` for `vec::IntoIter<T>: UnwindSafe`)
 - #147728 (tests: activate misspelled `gdb-check` in `function-arg-initialization.rs`)
 - #148097 (tests/debuginfo/closures.rs: Activate misspelled `cdb-check`)
 - #148118 (Improve the ICE message for invalid nullary intrinsic calls)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 26, 2025
…ug-msg, r=Noratrieb,dianqk

Improve the ICE message for invalid nullary intrinsic calls

In rust-lang#148104, we found the panic message here rather confusing, and (if I'm reading the tea leaves right) that's because the intended audience for either side of the phrase is very different. I think this is more clear if/when this is encountered by users.

I expect this ICE to be hit in practice by people calling the `size_of` and `align_of` intrinsics, so it's now _kind of_ helpful for those users too.

The original effort to stop backends from needing to support nullary intrinsics added a note to all these const-only intrinsics, but when rust-lang#147793 ported two more the paragraph wasn't added. I've added it.
bors added a commit that referenced this pull request Oct 26, 2025
Rollup of 2 pull requests

Successful merges:

 - #148097 (tests/debuginfo/closures.rs: Activate misspelled `cdb-check`)
 - #148118 (Improve the ICE message for invalid nullary intrinsic calls)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Oct 26, 2025
Rollup of 2 pull requests

Successful merges:

 - #148118 (Improve the ICE message for invalid nullary intrinsic calls)
 - #148134 (Add myself as a windows-msvc maintainer)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3bf838d into rust-lang:master Oct 26, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Oct 26, 2025
rust-timer added a commit that referenced this pull request Oct 26, 2025
Rollup merge of #148118 - saethlin:nullary-intrinsic-check-bug-msg, r=Noratrieb,dianqk

Improve the ICE message for invalid nullary intrinsic calls

In #148104, we found the panic message here rather confusing, and (if I'm reading the tea leaves right) that's because the intended audience for either side of the phrase is very different. I think this is more clear if/when this is encountered by users.

I expect this ICE to be hit in practice by people calling the `size_of` and `align_of` intrinsics, so it's now _kind of_ helpful for those users too.

The original effort to stop backends from needing to support nullary intrinsics added a note to all these const-only intrinsics, but when #147793 ported two more the paragraph wasn't added. I've added it.
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