-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[rustc_parse] Forbid let
s in certain places
#97295
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
Sorry for taking so long to review. I don't think this should be implemented like this. I think we should be explicitly adding code to allow let-chains in Even if this is the right approach, I think this current implementation is missing a lot of positions where we'd accidentally stabilize parsing #[cfg(ignore)]
fn foo() {
let _ = f(let y = 1);
|x| let 1 = 2;
array[let x = y];
} |
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.
(whoops, should've left comment here)
7f23fe1
to
76b20e0
Compare
Done. Thanks for the review |
src/test/ui/rfc-2497-if-let-chains/invalid-let-in-a-valid-let-context.rs
Show resolved
Hide resolved
☔ The latest upstream changes (presumably #97474) made this pull request unmergeable. Please resolve the merge conflicts. |
862b590
to
5eeb48d
Compare
@rustbot label +S-waiting-on-review -S-waiting-on-author If possible, I would like to tackle https://github.com/rust-lang/rust/pull/97295/files#diff-52ef6fde627bdaac8e79bcf67beac39ef4cd9a2a0bd0ff7e3ec69dd0ce74af94 and duplicated diagnostics in a following PR. |
This comment has been minimized.
This comment has been minimized.
Alright, this is a good first step then. @bors r+ |
📌 Commit 1c460819c4dbd77dd22df0292a5b6052347245ef has been approved by |
☔ The latest upstream changes (presumably #98447) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r- please fix the issues then i can re-approve |
1c46081
to
7475867
Compare
…ompiler-errors [rustc_parse] Forbid `let`s in certain places Currently only forbids in locals to resolve rust-lang#94927 (comment) but feel free to point any other places.
…ompiler-errors [rustc_parse] Forbid `let`s in certain places Currently only forbids in locals to resolve rust-lang#94927 (comment) but feel free to point any other places.
…ompiler-errors [rustc_parse] Forbid `let`s in certain places Currently only forbids in locals to resolve rust-lang#94927 (comment) but feel free to point any other places.
…ompiler-errors [rustc_parse] Forbid `let`s in certain places Currently only forbids in locals to resolve rust-lang#94927 (comment) but feel free to point any other places.
…ompiler-errors [rustc_parse] Forbid `let`s in certain places Currently only forbids in locals to resolve rust-lang#94927 (comment) but feel free to point any other places.
…ompiler-errors [rustc_parse] Forbid `let`s in certain places Currently only forbids in locals to resolve rust-lang#94927 (comment) but feel free to point any other places.
…askrgr Rollup of 11 pull requests Successful merges: - rust-lang#97140 (std: use an event-flag-based thread parker on SOLID) - rust-lang#97295 ([rustc_parse] Forbid `let`s in certain places) - rust-lang#97743 (make const_err show up in future breakage reports) - rust-lang#97908 (Stabilize NonZero* checked operations constness.) - rust-lang#98297 (Transform help popup into a pocket menu) - rust-lang#98428 (macros: use typed identifiers in diag and subdiag derive) - rust-lang#98528 (Respect --color when building rustbuild itself) - rust-lang#98535 (Add regression test for generic const in rustdoc) - rust-lang#98538 (Add a ui test for issue rust-lang#91883) - rust-lang#98540 (Add regression test for rust-lang#87558) - rust-lang#98541 (Update `std::alloc::System` doc example code style) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…compiler-errors Additional tests to ensure let is rejected during parsing In the original stabilization PR, @ `compiler-errors` has [pointed out](rust-lang#94927 (comment)) that rust-lang#97295 wasn't enough to address the concerns about having `let` in expressions being rejected at parsing time, instead of later. Thankfully, since then the situation has been greatly improved by rust-lang#115677. This PR adds some additional tests to `disallowed-positions.rs`, and adds two additional revisions to the "normal" case which is now given the `feature` name: * `no_feature`: Added to incorporate `disallowed-positions-without-feature-gate.rs` into the file, reducing duplication. * `nothing`: like feature, but all functions are cfg'd out. Ensures that the errors are really emitted during parsing. cc tracking issue rust-lang#53667
Rollup merge of rust-lang#132828 - est31:let_chains_parsing_tests, r=compiler-errors Additional tests to ensure let is rejected during parsing In the original stabilization PR, @ `compiler-errors` has [pointed out](rust-lang#94927 (comment)) that rust-lang#97295 wasn't enough to address the concerns about having `let` in expressions being rejected at parsing time, instead of later. Thankfully, since then the situation has been greatly improved by rust-lang#115677. This PR adds some additional tests to `disallowed-positions.rs`, and adds two additional revisions to the "normal" case which is now given the `feature` name: * `no_feature`: Added to incorporate `disallowed-positions-without-feature-gate.rs` into the file, reducing duplication. * `nothing`: like feature, but all functions are cfg'd out. Ensures that the errors are really emitted during parsing. cc tracking issue rust-lang#53667
…compiler-errors Additional tests to ensure let is rejected during parsing In the original stabilization PR, @ `compiler-errors` has [pointed out](rust-lang#94927 (comment)) that rust-lang#97295 wasn't enough to address the concerns about having `let` in expressions being rejected at parsing time, instead of later. Thankfully, since then the situation has been greatly improved by rust-lang#115677. This PR adds some additional tests to `disallowed-positions.rs`, and adds two additional revisions to the "normal" case which is now given the `feature` name: * `no_feature`: Added to incorporate `disallowed-positions-without-feature-gate.rs` into the file, reducing duplication. * `nothing`: like feature, but all functions are cfg'd out. Ensures that the errors are really emitted during parsing. cc tracking issue rust-lang#53667
Currently only forbids in locals to resolve #94927 (comment) but feel free to point any other places.