10

Constier maybe uninit by usbalbin · Pull Request #79621 · rust-lang/rust · GitHu...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/79621
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Contributor

usbalbin commented 18 days ago

I was playing around trying to make [T; N]::zip() in #79451 be const fn. One of the things I bumped into was MaybeUninit::assume_init. Is there any reason for the intrinsic assert_inhabited<T>() and therefore MaybeUninit::assume_init not being const?


I have as best as I could tried to follow the instruction in library/core/src/intrinsics.rs. I have no idea what I am doing but it seems to compile after some slight changes after the copy paste. Is this anywhere near how this should be done?

Also any ideas for name of the feature gate? I guess const_maybe_assume_init is quite misleading since I have added some more methods. Should I add test? If so what should be tested?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK