-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
checker: fix nested struct reference type field initialized check. (fix: #15741) #15752
Conversation
9a8c731
to
3ff9456
Compare
30580e9
to
4fd218f
Compare
It may be necessary that references in the structure are not initialized by default and must be initialized when used. |
Oh, may be. sdl/examples, ui module, and many other references have not been initialized. |
@shove70 You did a good work! There are some rules to be clarified here. |
Thank you for your encouragement! :) |
dd52364
to
767d1ec
Compare
Wouldn't it be better to make |
39ee5bd
to
f9a20cd
Compare
Please help me review these three PRs, because they will affect the CI check of this PR. Thank you very much. |
It looks good to me, but it effectively requires, that all struct fields of a reference type, require that |
I'm personally fine with it. I agree it's a big change though. |
@shove70 can you make it a warning for now, for a transitionary period? 3 months later we'll make it an error. |
OK, this is better. I'll deal with it. :) |
96b3f92
to
e14ce4e
Compare
@shove70 great job! I just found this edge case - where I think it's reporting the wrong result: module main
struct Ref {}
struct EmbedStruct {
ref &Ref
}
struct Struct {
EmbedStruct
}
fn main() {
ref := &Ref{}
_ := Struct{
ref: ref
}
} Outputs:
Which is wrong IMO, since the ref field of the embedded struct is being initialized. |
output: