-
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
Use proper HirId for async track_caller attribute check #105180
Conversation
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
@@ -1012,6 +1013,7 @@ impl<'hir> LoweringContext<'_, 'hir> { | |||
|
|||
let async_body = this.make_async_expr( |
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.
Async closures should probably also support #[track_caller]
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.
It currently doesn't, so that's why I haven't changed it in this PR.
It isn't difficult change to make, but it does require lifting the attribute lowering up from after ExprKind
lowering to before it. Do you happen to know why we currently lower ID and attributes after ExprKind
?
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.
I don't think there's a particular reason why we do it -- it shouldn't matter to change the lowering order. I guess if you're not keen to make the change, can you at least add a FIXME? Thanks!
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.
Added. I then changed Option<HirId>
to HirId
to simplify code. We don't need to special case async blocks as #[track_caller]
is not legal on async block. But I added a test anyway to avoid accidentally allow this on normal async block.
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.
I know the reason now, because paren expr is special 😅
PTAL
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.
Given the incremental issues, maybe we can revert the last change and go with Option<HirId>
? Or are those test failures unrelated to the last change?
r? @compiler-errors @bors delegate+ Thanks, r=me with or without my comment. cc @bryangarza, you will need to rebase your PR. |
✌️ @nbdd0121 can now approve this pull request |
I'll review the changes in a bit |
Not sure why making this change cause incr-comp test to fail. Maybe different HirId ordering causes the typeck result happens to match? Might need some incr-comp expert to take a look @rust-lang/wg-incr-comp |
This comment has been minimized.
This comment has been minimized.
You can just bless the incremental tests. The change is in the right direction: stuff that were dirty are now clean. |
Thanks, @cjgillot! I thought that they were there to ensure that the results are dirty. So these are more like status-quo checks instead to catch accidental changes? |
Pretty much, yes. |
📌 Commit 76ee06b330ab37588cc380a61f05ef5a56ea4d3c has been approved by It is now in the queue for this repository. |
⌛ Testing commit 76ee06b330ab37588cc380a61f05ef5a56ea4d3c with merge a3c1e064379c6c903f1d52530d1847e1bb130e50... |
💔 Test failed - checks-actions |
76ee06b
to
34c3773
Compare
Given that #105134 is a critical regression and thus we want it to be fixed soon, I think it's best to split the async closure support (with HIR attribute lowering changes) into a separate PR. I have added a FIXME note and reverted the PR to the pre @bors r=compiler-errors |
This comment has been minimized.
This comment has been minimized.
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#104912 (PartialEq: PERs are homogeneous) - rust-lang#104952 (Streamline the user experience for `x.py setup`) - rust-lang#104953 (Ensure required submodules at the same time as updating existing submodules) - rust-lang#105180 (Use proper HirId for async track_caller attribute check) - rust-lang#105222 (std update libc version and freebsd image build dependencies) - rust-lang#105223 (suggest parenthesis around ExprWithBlock BinOp ExprWithBlock) - rust-lang#105230 (Skip recording resolution for duplicated generic params.) - rust-lang#105301 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Support #[track_caller] on async closures Follow up on rust-lang#105180 r? `@compiler-errors` cc `@cjgillot`
Support #[track_caller] on async closures Follow up on rust-lang#105180 r? ``@compiler-errors`` cc ``@cjgillot``
Support #[track_caller] on async closures Follow up on rust-lang#105180 r? ```@compiler-errors``` cc ```@cjgillot```
…piler-errors Use proper HirId for async track_caller attribute check Fix rust-lang#105134
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#104912 (PartialEq: PERs are homogeneous) - rust-lang#104952 (Streamline the user experience for `x.py setup`) - rust-lang#104953 (Ensure required submodules at the same time as updating existing submodules) - rust-lang#105180 (Use proper HirId for async track_caller attribute check) - rust-lang#105222 (std update libc version and freebsd image build dependencies) - rust-lang#105223 (suggest parenthesis around ExprWithBlock BinOp ExprWithBlock) - rust-lang#105230 (Skip recording resolution for duplicated generic params.) - rust-lang#105301 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fix #105134