Skip to content

Do not fail evaluation in const blocks #92892

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

compiler-errors
Copy link
Member

Evaluate const blocks with a const param-env, so we properly check ~const trait bounds.

Fixes #92713
(I will fix the poor diagnostics in #92713 and #92712 in a separate PR)

cc @nbdd0121 who wrote the code this PR touches in #89561

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 14, 2022
@rust-highfive
Copy link
Contributor

r? @nagisa

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 14, 2022
Copy link
Contributor

@nbdd0121 nbdd0121 left a comment

Choose a reason for hiding this comment

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

The fix LGTM but I think this needs a test.

@fee1-dead
Copy link
Member

r? @fee1-dead

@rustbot author: please add a ui test for the issue, in src/test/ui/consts, or in src/test/ui/rfc-2632-const-trait-impl, after that the changes LGTM.

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2022

Error: Parsing shortcut command in comment failed: ...'bot author' | error: expected end of command at >| ': please a'...

Please let @rust-lang/release know if you're having trouble with this bot.

@rust-highfive rust-highfive assigned fee1-dead and unassigned nagisa Jan 14, 2022
@fee1-dead fee1-dead 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 14, 2022
@compiler-errors compiler-errors force-pushed the const-param-env-for-const-block branch from 7ced82c to b9a3c32 Compare January 14, 2022 21:05
@compiler-errors
Copy link
Member Author

@rustbot ready

Hah, sorry, added a test last night then forgot to commit it.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 14, 2022
@fee1-dead
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jan 15, 2022

📌 Commit b9a3c32 has been approved by fee1-dead

@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 Jan 15, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 15, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#92747 (Simplification of BigNum::bit_length)
 - rust-lang#92767 (Use the new language identifier for Rust in the PDB debug format)
 - rust-lang#92775 (Inline std::os::unix::ffi::OsStringExt methods)
 - rust-lang#92863 (Remove `&mut` from `io::read_to_string` signature)
 - rust-lang#92865 (Ignore static lifetimes for GATs outlives lint)
 - rust-lang#92873 (Generate more precise generator names)
 - rust-lang#92879 (Add Sync bound to allocator parameter in vec::IntoIter)
 - rust-lang#92892 (Do not fail evaluation in const blocks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 539175c into rust-lang:master Jan 15, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 15, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 18, 2022
Add `~const` bound test for negative impls

Resolves rust-lang#92114 which has been fixed in rust-lang#92892.
@compiler-errors compiler-errors deleted the const-param-env-for-const-block branch April 7, 2022 04:34
# for free to join this conversation on GitHub. Already have an account? # 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.

Poor diagnostic when passing T: Drop (nonconst only) to a function that takes ~const Drop in an inline const
7 participants