Stream: rust-toolchain

Topic: Rust RFC 3729: Hierarchy of Sized Traits


view this post on Zulip Yoshua Wuyts (Nov 18 2024 at 15:06):

FYI Rust RFC 3729 is up. Oli (Scherer) was telling me about this, and how it will make it possible to teach the Rust compiler about externrefs, which should be useful for our Rust bindgen.

All of Rust's types are either sized, which implement the Sized trait and have a statically known size during compilation, or unsized, which do not implement the Sized trait and are assumed to ...

view this post on Zulip Yoshua Wuyts (Nov 18 2024 at 15:10):

Raising it here since this seems relevant for us. Want to make sure that at least @Alex Crichton, @Dan Gohman, and @fitzgen (he/him) have seen this.

view this post on Zulip Yoshua Wuyts (Nov 18 2024 at 15:11):

This might also be relevant to the way Rust interacts with Wasm GC types I believe.

view this post on Zulip Alex Crichton (Nov 18 2024 at 16:24):

I suspect that this certainly doesn't hurt the future externref story for Rust but I also don't think it will necessarily trivially unlock it. For example it's possible to have an externref function parameter or local variable but it's not possible to take the address of it (without further language/codegen changes). Basically the fact that externref effectively lives in a different address space makes it particularly problematic.

If it's possible to use this RFC to statically have a type that can be used in function parameters, function locals, and returns, but NOT be able to use it in structs/enums then that'd be perfect for externref. Effectively externref won't work for now in structs/enums because it can't live in memory and it basically doesn't make sense to even construct a value of those types. As a primitive though it can possibly be useful

view this post on Zulip Yoshua Wuyts (Nov 19 2024 at 17:00):

I seeeee - ty for looking into this and sharing your analysis!


Last updated: Nov 22 2024 at 16:03 UTC