Skip to content
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 new mem::uninitialized API #806

Merged
merged 1 commit into from Jul 9, 2019

Conversation

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jul 6, 2019

Fixes #770.

cc @sdroege @EPashkin

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 6, 2019

An example of the result: gtk-rs/pango#155

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Jul 6, 2019

See comments there, invalid usage of MaybeUninit :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 6, 2019

More like lazy usage but yes. ;) I'll update the PR later on.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Jul 6, 2019

Not lazy, it's undefined behaviour just like with mem::uninitialized now. It's wrong :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 6, 2019

I wanted to mean that my implementation was lazy. :)

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Jul 6, 2019

Oh that's possible :) Changing the code generator to use MaybeUninit correctly is probably quite some work

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:new-mem-uninitialized branch 3 times, most recently from c664d93 to 3599ded Jul 7, 2019
@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 7, 2019

This is finally done. T_T

.map(|param| {
let kind = type_mem_mode(env, param);
;
(param, kind)

This comment has been minimized.

Copy link
@EPashkin

EPashkin Jul 7, 2019

Member

Unneeded debug change?

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Jul 7, 2019

Author Member

Indeed, good catch.

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:new-mem-uninitialized branch 2 times, most recently from 414a3ef to 25028ca Jul 7, 2019
@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Jul 7, 2019

Thanks, look good for me, it still need cargo fmt run

if name == "error" {
format!(", {} as usize", name)
} else {
format!(", {{ let {0} = {0}.assume_init(); {0} as usize }})", name)

This comment has been minimized.

Copy link
@EPashkin

EPashkin Jul 7, 2019

Member

Seems this can be just format!(", {}.assume_init() as usize)", name) without "error" branch

This comment has been minimized.

Copy link
@EPashkin

EPashkin Jul 8, 2019

Member

@GuillaumeGomez If you don't want this one-liner, please, merge this PR yourself.

This comment has been minimized.

Copy link
@EPashkin

EPashkin Jul 8, 2019

Member

Oh, error branch still needed.
Can you tell me which function?

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Jul 8, 2019

Author Member

I updated it to a one-liner. However, I don't understand your last comment. What error?

This comment has been minimized.

Copy link
@EPashkin

EPashkin Jul 8, 2019

Member

I meant branch if name == "error", I suspect that it never reached:
note that it not ends with ')',
and I updated it to produce bad code, but gtk-rs crates still builds fine after regen.

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Jul 9, 2019

Author Member

I'll remove this check and see the result.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Jul 7, 2019

Can you regenerate the pango PR so we can also check the results? :)

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:new-mem-uninitialized branch from 25028ca to 564fd26 Jul 7, 2019
@EPashkin EPashkin mentioned this pull request Jul 7, 2019
@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:new-mem-uninitialized branch from 564fd26 to 3cffab8 Jul 7, 2019
@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:new-mem-uninitialized branch from 3cffab8 to d2c0909 Jul 9, 2019
@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 9, 2019

@EPashkin You were right: the condition was completely useless so I removed it.

@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Jul 9, 2019

@EPashkin EPashkin merged commit fb0b31c into gtk-rs:master Jul 9, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Jul 9, 2019

I'll send the PRs soon then!

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:new-mem-uninitialized branch Jul 9, 2019
This was referenced Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.