-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Defer repeat expr Copy
checks to end of type checking
#137045
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 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Copy
check
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,15 @@ fn typeck_with_inspect<'tcx>( | |
fcx.write_ty(id, expected_type); | ||
}; | ||
|
||
// Whether to check repeat exprs before/after inference fallback is somewhat arbitrary of a decision | ||
// as neither option is strictly more permissive than the other. However, we opt to check repeat exprs | ||
// first as errors from not having inferred array lengths yet seem less confusing than errors from inference | ||
// fallback arbitrarily inferring something incompatible with `Copy` inference side effects. | ||
// | ||
// This should also be forwards compatible with moving repeat expr checks to a custom goal kind or using | ||
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. I feel somewhat hesitant to add a custom goal kind for repeat expr checks but I do think it would be "optimal" behaviour-wise as the goals could stall on the repeat count infer var and be deferred ~as long as necessary while also not delaying inference constraints from them any later than is needed. |
||
// marker traits in the future. | ||
fcx.check_repeat_exprs(); | ||
|
||
fcx.type_inference_fallback(); | ||
|
||
// Even though coercion casts provide type hints, we check casts after fallback for | ||
|
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.
There's no
fcx.demand_subtype
for consts yet.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.
You could just
self.at(..).eq(ct, err)
?