-
Notifications
You must be signed in to change notification settings - Fork 13.3k
we find a issue, I don't konw is there a bug? #49865
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
Comments
{true} && {true} the code will be parse two expressions by rustc parser:
the follwing code can work: true && {true} or (true) && {true} or ( {true} && {true} ) I don't think it's a Bug |
So, I think I found where the problem is: rust/src/libsyntax/parse/parser.rs Lines 2890 to 2911 in 88ebd97
In particular, it's the call to |
Yep, this is expected behavior. if cond {
stmts;
}
*ptr = val; // Not multiplication! Yes, there are false positives, but the opposite disambiguation has even more false positives. |
I think you didn't understand what I mean. let foo = { true }; // it means foo is bool
let foo = { true; }; // it means foo is ()
``
so why `{ true } && true` is &&bool |
@driftluo // Statement 1
{
true
}
// Statement 2
&&true // Take address of address of `true`, the result has type `&&bool` |
This means that if there is a braces block, it will be interpreted as a single statement regardless of what follows. |
@petrochenkov while the decision is understandable, the diagnostics is far from satisfying... Any chance to improve it somehow? |
@crlf0710 Agree |
This issue has been discussed in #29071. |
the function like this is ok:
but when is become this, there is an error:
the error is:
The text was updated successfully, but these errors were encountered: