-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Add a failing UI test for multiple loops of all kinds in a const
#66096
Conversation
These errors are suboptimal, but they will be fixed by the new `check_consts` pass.
(rust_highfive has picked a reviewer for you, use r? to override) |
x += 1; | ||
} | ||
|
||
while x < 8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the checker stop before reaching here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The current one does. The new one can give much better errors on code like this but enabling it is blocked on #65949.
For background, I was using this file as a test case while working on improving diagnostics for the new checker, and figured it could be merged upstream separately.
r? @Centril |
@bors r+ rollup |
📌 Commit c8ae281 has been approved by |
…entril Add a failing UI test for multiple loops of all kinds in a `const` This simply demonstrates the current behavior and ensures we don't allow anything by accident. The new const checker will be able to improve the diagnostics here. While working on it, I didn't see very many tests with non-`while` loops in a `const`, and there were no tests with multiple loops.
Rollup of 10 pull requests Successful merges: - #65136 (Update codegen option documentation.) - #65574 (docs: improve disclaimer regarding LinkedList) - #65720 (Add FFI bindings for LLVM's Module::getInstructionCount()) - #65905 ([doc] fixes for unix/vxworks `OpenOptionsExt::mode`) - #65962 (Fix logic in example.) - #66019 (Improved std::iter::Chain documentation) - #66038 (doc(str): show example of chars().count() under len()) - #66042 (Suggest correct code when encountering an incorrect trait bound referencing the current trait) - #66073 (Do not needlessly write-lock) - #66096 (Add a failing UI test for multiple loops of all kinds in a `const`) Failed merges: r? @ghost
This simply demonstrates the current behavior and ensures we don't allow anything by accident.
The new const checker will be able to improve the diagnostics here. While working on it, I didn't see very many tests with non-
while
loops in aconst
, and there were no tests with multiple loops.