Repository navigation
Suggest adding a comma when () followed by a closure is parsed as bitor - #165455
raushan728 wants to merge 2 commits into
Conversation
|
The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
I'm sorry but you can't modify the stable Rust grammar like that. That'd be a breaking change. Moreover, the change is ad hoc & complicates the grammar to an unreasonable degree just to improve diagnostics in a niche scenario likely preventing real world use cases in the process. Thus, it's highly unlikely that this would ever get accepted by T-lang.
|
Reminder, once the PR becomes ready for a review, use |
|
Thanks! changing the grammar for this isn't the right approach Would a diagnostic only change be acceptable instead? For example,when E0061 fires and the only argument is a BitOr chain rooted atliteral Or should I close this PR and move on? |
Yes, that would be acceptable. Feel free to update this PR or to close it and open a new one. |
|
Thanks, I'll update this. |
…s parsed as bitor
85e2367 to
4aa7bd8
Compare
() followed by a closure is parsed as bitor
|
I don't think the issue should be closed when this is merged, because the name resolution errors (which are a lot more confusing that the wrong help note) are still emitted. |
|
The issue should stay open. The parse as bitor is correct, so the E0425 noise would likely need a separate resolve side diagnostic. This PR only adds the comma suggestion. |
|
What's the reason you're doing this specifically after a |
|
|
|
I didn't encounter this with |
|
Thanks, Could you share the code where you hit this, or at least the type of the leading argument? That would help judge whether the suggestion should be broader than |
|
@raushan728 You mentioned elsewhere that you use LLMs. Have you read the LLM policy? Are you following the policy? If so, could you please elaborate more on your LLM usage in more detail, and not just "learn the codebase and move faster"? |
|
Here is how I use LLMs in more detail. English is not my first language, so I use AI in the browser to understand issue text, translation and technical wording, and to explain code that I do not understand. I also use it to discussion because there is a lot things I don't know, so for its discussion... I use it as an assistant. In my IDE I use free models (in opencode) only, because I do not have a paid subscription of claude code, codex etc. The rust codebase is very large, so I use them to find where something is implemented. I can explain the code in my PRs. If you have a question about a specific change or decision, please ask |
Part of #165386.
When
t(() |c| c)is parsed as(() | c) | cand an argument is missing, suggest adding a comma after().