Skip to content

Require rustc_comptime fns to also be const#157671

Open
oli-obk wants to merge 1 commit into
rust-lang:mainfrom
oli-obk:ralfification
Open

Require rustc_comptime fns to also be const#157671
oli-obk wants to merge 1 commit into
rust-lang:mainfrom
oli-obk:ralfification

Conversation

@oli-obk

@oli-obk oli-obk commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

r? @RalfJung

as per #157647 (comment)

I think I only did that because it was easier to produce a diagnostic suggestion for removing const than for adding const 😆

@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 Jun 9, 2026
@rustbot

rustbot commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

#[rustc_comptime]
fn conditionally_const<T: [const] Trait>() {
//~^ ERROR: `[const]` is not allowed here
const fn conditionally_const<T: [const] Trait>() {

@fee1-dead fee1-dead Jun 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We still need this error though.. because comptime isn't conditionally const

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yea that's not possible, this check happens on ast xD now that you remind me of this, that probably was another reason I did it this way

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants