-
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
Fix inference issues with unconstrained base expr in type_changing_struct_update
#97705
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
r? rust-lang/compiler (do we have an alias for the types team?) |
inspired by rust-lang/rust#97705 (comment) > (do we have an alias for the types team?) cc @rust-lang/types -- I only added the members of t-types who are already on the reviewer rotation, specifically excluding @nikomatsakis and @spastorino since they aren't currently on the rotation. also add myself to diagnostics since i am a member of that wg, and move @cjgillot to the compiler team from the compiler team contributors grouping.
r? @lcnr I'm r=me, but adding someone on the types team. |
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.
lgtm r=me
there's one optional improvement i found, if you're interested in implementing that
self.tcx.mk_adt(*adt, fresh_substs), | ||
|_| {}, | ||
); | ||
let base_ty = self.shallow_resolve(base_ty); | ||
match base_ty.kind() { | ||
ty::Adt(base_adt, base_subs) if adt == base_adt => { |
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.
can you now bug!
if that isn#t the case? or at least delay_span_bug
if it's ty::Error
? would safe us 8 columns of indentation ^^
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.
ironically, I don't think check_expr_has_type_or_error
actually returns ty::Error
when the expected type != the checked type of the input expr, hence us (still) needing to call report_mismatched_types
on line before:1605/after:1624. I can easily check, though.
I will see if I can simplify this, though. It can at least be changed to a let-chain :)
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.
also, while you're in that file, can you change https://github.com/rust-lang/rust/blob/ac33d2b3e1359930a02653f0c61a124947912ed8/compiler/rustc_typeck/src/check/expr.rs#L1538 to not do a string comparison 😆
ac33d2b
to
b524ba4
Compare
f4ec06e
to
5052911
Compare
I was able to turn the redundant @bors r=lcnr |
wake up bors @bors r=lcnr |
📌 Commit 5052911 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (e652caa): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
…_update_is_probably_complete, r=oli-obk Make `type_changing_struct_update` no longer an incomplete feature After rust-lang#97705, I don't see what would make it incomplete anymore. `check_expr_struct_fields` seems to now implement the RFC to the letter. r? `@nikomatsakis` cc `@rust-lang/types`
…_update_is_probably_complete, r=oli-obk Make `type_changing_struct_update` no longer an incomplete feature After rust-lang#97705, I don't see what would make it incomplete anymore. `check_expr_struct_fields` seems to now implement the RFC to the letter. r? ``@nikomatsakis`` cc ``@rust-lang/types``
…_update_is_probably_complete, r=oli-obk Make `type_changing_struct_update` no longer an incomplete feature After rust-lang#97705, I don't see what would make it incomplete anymore. `check_expr_struct_fields` seems to now implement the RFC to the letter. r? ```@nikomatsakis``` cc ```@rust-lang/types```
…_update_is_probably_complete, r=oli-obk Make `type_changing_struct_update` no longer an incomplete feature After rust-lang#97705, I don't see what would make it incomplete anymore. `check_expr_struct_fields` seems to now implement the RFC to the letter. r? ````@nikomatsakis```` cc ````@rust-lang/types````
…_update_is_probably_complete, r=oli-obk Make `type_changing_struct_update` no longer an incomplete feature After rust-lang#97705, I don't see what would make it incomplete anymore. `check_expr_struct_fields` seems to now implement the RFC to the letter. r? `````@nikomatsakis````` cc `````@rust-lang/types`````
…_update_is_probably_complete, r=oli-obk Make `type_changing_struct_update` no longer an incomplete feature After rust-lang#97705, I don't see what would make it incomplete anymore. `check_expr_struct_fields` seems to now implement the RFC to the letter. r? ``````@nikomatsakis`````` cc ``````@rust-lang/types``````
Use fresh infer vars to guide inference along in
type_changing_struct_update
.Fixes #96878