-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Lowering unnamed fields and anonymous adt #115367
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
c0f0f46
to
d9347ee
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
424439f
to
fa89812
Compare
This comment has been minimized.
This comment has been minimized.
fa89812
to
3440d65
Compare
This comment has been minimized.
This comment has been minimized.
3440d65
to
1df9b8a
Compare
This comment has been minimized.
This comment has been minimized.
compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
1df9b8a
to
2b57f9f
Compare
This comment has been minimized.
This comment has been minimized.
2b57f9f
to
a8b76fc
Compare
This comment has been minimized.
This comment has been minimized.
a8b76fc
to
043ed32
Compare
This comment was marked as resolved.
This comment was marked as resolved.
3dce559
to
bf6482b
Compare
Finished benchmarking commit (bdc1592): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 661.706s -> 662.09s (0.06%) |
There seems to be a big regression here on this benchmark, which has a struct with many fields. Should this have affected performance of non-anonymous fields? |
The query Is this problem serious? I'm going to do some refactoring work on this query (to implement struct patterns and struct expressions of unnamed fields), but I'm afraid I won't have much time till next week. |
It would be nice to improve it eventually, it's probably not that rare to have structs with many fields, e.g. generated by macros. But there's no immediate rush :) |
Oh, I only now noticed that it's a tuple struct. Yeah, so tuple structs with many fields are probably quite rare. In any case, if you find any wins here in the future, that would be great! |
No problem, I'll look into this benchmark in the next step of implementation. |
find_field does not need to be a query. The current implementation is quadratic in the number of nested fields. r? `@davidtwco` as you reviewed rust-lang#115367 Fixes rust-lang#121755
find_field does not need to be a query. The current implementation is quadratic in the number of nested fields. r? `@davidtwco` as you reviewed rust-lang#115367 Fixes rust-lang#121755
find_field does not need to be a query. The current implementation is quadratic in the number of nested fields. r? `@davidtwco` as you reviewed rust-lang/rust#115367 Fixes rust-lang/rust#121755
…s, r=wesleywiser Retire the `unnamed_fields` feature for now `#![feature(unnamed_fields)]` was implemented in part in rust-lang#115131 and rust-lang#115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature. However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly. Fixes rust-lang#117942 Fixes rust-lang#121161 Fixes rust-lang#121263 Fixes rust-lang#121299 Fixes rust-lang#121722 Fixes rust-lang#121799 Fixes rust-lang#126969 Fixes rust-lang#131041 Tracking: * rust-lang#49804 [^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields [^2]: rust-lang#49804 (comment)
…s, r=wesleywiser Retire the `unnamed_fields` feature for now `#![feature(unnamed_fields)]` was implemented in part in rust-lang#115131 and rust-lang#115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature. However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly. Fixes rust-lang#117942 Fixes rust-lang#121161 Fixes rust-lang#121263 Fixes rust-lang#121299 Fixes rust-lang#121722 Fixes rust-lang#121799 Fixes rust-lang#126969 Fixes rust-lang#131041 Tracking: * rust-lang#49804 [^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields [^2]: rust-lang#49804 (comment)
…s, r=wesleywiser Retire the `unnamed_fields` feature for now `#![feature(unnamed_fields)]` was implemented in part in rust-lang#115131 and rust-lang#115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature. However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly. Fixes rust-lang#117942 Fixes rust-lang#121161 Fixes rust-lang#121263 Fixes rust-lang#121299 Fixes rust-lang#121722 Fixes rust-lang#121799 Fixes rust-lang#126969 Fixes rust-lang#131041 Tracking: * rust-lang#49804 [^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields [^2]: rust-lang#49804 (comment)
Empty idents are also disambiguated. This was added in rust-lang#115367.
Empty idents are also disambiguated. This was added in rust-lang#115367.
It was added in rust-lang#115367 for anonymous ADTs. Those changes were then reverted in rust-lang#131045, but `empty_disambiguator` was left behind, perhaps by mistake. It seems to be unnecessary.
This implements #49804.
Goals:
#[repr(C)]
check of the anonymous ADTsNon-Goals (will be in the next PRs)