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

Fix inline_const with interpolated block #113803

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

compiler-errors
Copy link
Member

Interpolation already worked when we had a const $block that wasn't a statement expr:

fn foo() {
  let _ = const $block;
}

But it was failing when the const block was in statement expr position:

fn foo() {
  const $block;
}

... because of a bug in a check for const items. This fixes that.


cc #112953 (comment), though I don't think this requires an FCP since it's already supported in exprs and seems to me to be fully a parser bug.

@rustbot
Copy link
Collaborator

rustbot commented Jul 17, 2023

r? @fee1-dead

(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 Jul 17, 2023
@rust-log-analyzer

This comment has been minimized.

@rust-cloud-vms rust-cloud-vms bot force-pushed the const-interp-block branch from dabb144 to 79997b0 Compare July 17, 2023 19:37
}
}

// This already worked
Copy link
Member

@fee1-dead fee1-dead Jul 18, 2023

Choose a reason for hiding this comment

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

worked when? please add an issue link so this is clear to future readers and then r=me

Copy link
Member

Choose a reason for hiding this comment

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

hmm actually there isn't an issue to link to 🤣 then idk if this comment would be useful

Copy link
Member

Choose a reason for hiding this comment

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

maybe you could include a mention of this in your commit message so git archaeologists will still be able to find this info

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry, what I meant was "this has worked since const {} was implemented", to contrast it with the specific case that const {} is used in a statement position.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can add a comment tho.

Copy link
Member

@WaffleLapkin WaffleLapkin Jul 19, 2023

Choose a reason for hiding this comment

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

Yeah, I think a comment describing what this test does would be nice (so that the context is not lost with time...)

@rust-cloud-vms rust-cloud-vms bot force-pushed the const-interp-block branch from 79997b0 to 7197979 Compare July 19, 2023 16:26
@compiler-errors
Copy link
Member Author

@bors r=fee1-dead

@bors
Copy link
Contributor

bors commented Jul 19, 2023

📌 Commit 7197979 has been approved by fee1-dead

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 Jul 19, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 19, 2023
Rollup of 7 pull requests

Successful merges:

 - rust-lang#113444 (add tests for alias bound preference)
 - rust-lang#113716 (Add the `no-builtins` attribute to functions when `no_builtins` is applied at the crate level.)
 - rust-lang#113754 (Simplify native_libs query)
 - rust-lang#113765 (Make it clearer that edition functions are `>=`, not `==`)
 - rust-lang#113774 (Improve error message when closing bracket interpreted as formatting fill character)
 - rust-lang#113785 (Fix invalid display of inlined re-export when both local and foreign items are inlined)
 - rust-lang#113803 (Fix inline_const with interpolated block)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6c3cbcd into rust-lang:master Jul 19, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 19, 2023
@compiler-errors compiler-errors deleted the const-interp-block branch August 11, 2023 19:57
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.

6 participants