-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Use a trait to enforce field validity for union fields + unsafe fields + unsafe<> binder types
#136660
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 a trait to enforce field validity for union fields + unsafe fields + unsafe<> binder types
#136660
Conversation
|
changes to the core type system |
| @@ -1,40 +1,40 @@ | |||
| //@ known-bug: unknown | |||
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 a lot of random fixes in this file to make it compile lol
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (0a914ae): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 1.1%, secondary 2.2%)This 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 780.473s -> 780.252s (-0.03%) |
lcnr
left a comment
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.
nit, otherwise r=me
|
Regarding the codegen tests (which has a surprising number of |
885f835 to
86cc322
Compare
This comment has been minimized.
This comment has been minimized.
86cc322 to
4c17921
Compare
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in compiler/rustc_codegen_gcc |
This comment has been minimized.
This comment has been minimized.
4c17921 to
5c67cfa
Compare
|
@bors r=lcnr |
|
@bors rollup=maybe perf neutral |
5c67cfa to
d0564fd
Compare
|
@bors r=lcnr rollup=maybe |
This PR introduces a new, internal-only trait called
BikeshedGuaranteedNoDrop1 to faithfully model the field check that used to be implemented manually byallowed_union_or_unsafe_field.rust/compiler/rustc_hir_analysis/src/check/check.rs
Lines 84 to 115 in 942db67
Copying over the doc comment from the trait:
As far as I am aware, there's no new behavior being guaranteed by this trait, since it operates the same as the manually implemented check. We could easily rip out this trait and go back to using the manually implemented check for union fields, however using a trait means that this code can be shared by WF for
unsafe<>binders too. See the last commit.The only diagnostic changes are that this now fires false-negatives for fields that are ill-formed. I don't consider that to be much of a problem though.
r? oli-obk
Footnotes
Please let's not bikeshed this name lol. There's no good name for
ValidForUnsafeFieldsUnsafeBindersAndUnionFields. ↩