this post was submitted on 13 Jun 2024
78 points (98.8% liked)

Rust

5890 readers
33 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] BatmanAoD@programming.dev 10 points 4 months ago* (last edited 4 months ago)

How does the const { None } example type-inference work? The size of the option type can't be known without knowing the type of the Somevariant.

Edit: aha, it doesn't work as-is. It needs to infer the type of elements of foo from usage. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=05a95c592626b6935ae812527aa6bbc6