-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: Port call expr type checking and closure upvar inference from rustc #22101
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
Changes from all commits
993b436
271cf3e
317f4f9
c6e5e8c
3d6be00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -675,6 +675,9 @@ impl ExpressionStore { | |
| f(*expr); | ||
| arms.iter().for_each(|arm| { | ||
| f(arm.expr); | ||
| if let Some(guard) = arm.guard { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In these kinds of functions we should really enforce restructuring patterns to catch things 😅
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, but it's better to leave that to another PR. |
||
| f(guard); | ||
| } | ||
| self.walk_exprs_in_pat(arm.pat, &mut f); | ||
| }); | ||
| } | ||
|
|
@@ -926,6 +929,13 @@ impl ExpressionStore { | |
| // We keep the async closure exactly one expr before. | ||
| ExprId::from_raw(la_arena::RawIdx::from_u32(coroutine_closure.into_raw().into_u32() - 1)) | ||
| } | ||
|
|
||
| /// The opposite of [`Self::coroutine_for_closure()`]. | ||
| #[inline] | ||
| pub fn closure_for_coroutine(coroutine: ExprId) -> ExprId { | ||
| // We keep the async closure exactly one expr before. | ||
| ExprId::from_raw(la_arena::RawIdx::from_u32(coroutine.into_raw().into_u32() + 1)) | ||
| } | ||
| } | ||
|
|
||
| impl Index<ExprId> for ExpressionStore { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Curious where we panic without language items, ideally that wouldn't happen (even if in practice no one will ever write a no_core rust program without the fn traits ...). Just looks a bit odd to add a mini core directive here haha
View changes since the review
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 wonder if we should add this directive as enabled by default for tests now
Uh oh!
There was an error while loading. Please reload this page.
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 panicked in the past as
Expected to find a suitable `Fn`/`FnMut`/`FnOnce` implementation for ...in callee.rs, this was copied from rustc and I preferred not to change it. But I was forced to, because it panicked in the sysroot run in CI (it doesn't have a proper sysroot configured), and there I could not inject a minicore 😅