-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
borrowck treatment of struct-tuple more liberal than struct with fields #10902
Comments
I wonder if this is an artifact of our need to use the type-checker to resolve the ambiguity as to whether (Or it could be a red-herring. Seems more likely that its a red herring, since I do not see what it would mean to attempt to "more eagerly resolve P" in the expression |
cc me |
Code snippets now compiles.
Can close. |
New lint [`needless_return_with_try`] Closes rust-lang#10902 Rather than having a config option, this will just suggest removing the "return"; if `try_err` is used as well, then it'll be added again but without the `?`. changelog: New lint [`needless_return_with_try`]
Forked off of #10766
A question in #rust regarding a borrow checker error led me on the following exploration.
The four variants are labelled
one
,tup
,two_tuple
, andtwo_fields
one
is just repeating the test case from the description (of Should&'a Value as &'a Trait
work? #10766). Its a sanity check that the old error message and behavior still persists.two_fields
is closest to what achin described in his bug report. The problem that the borrow checker reports for that code is interesting, and it is replicated by the more minimal test case at the end of this comment.two_fields
that I made while trying to make as minimal a test case as possible.The interesting thing is that
two_tuple
(and likewisetup
) do not exhibit that error, even though they are completely analogous code. This is probably representative of a bug somewhere in the borrow checker since it really should be treating a struct-tuple here the same as a struct with named fields. (Plus, you know, these borrows look okay to me... but I have not yet dived in and tried to understand what the problem is that they are trying to flag.)The code:
This is a slightly reduced test from the original one above (that was originally a comment on #10766).
And here are the results:
The text was updated successfully, but these errors were encountered: