Skip to content

Fix invalid trait object slice example - #1232

Open
CryptAm wants to merge 1 commit into
0xMiden:nextfrom
CryptAm:patch-2
Open

Fix invalid trait object slice example#1232
CryptAm wants to merge 1 commit into
0xMiden:nextfrom
CryptAm:patch-2

Conversation

@CryptAm

@CryptAm CryptAm commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The Rust example uses &[dyn Foo], which does not compile because trait objects (dyn Foo) are unsized and cannot be used directly as slice elements.

Updated the function signature to use references to trait objects (&[&dyn Foo]), keeping the example behavior while making the snippet valid Rust.

The Rust example uses `&[dyn Foo]`, which does not compile because trait objects (`dyn Foo`) are unsized and cannot be used directly as slice elements.

Updated the function signature to use references to trait objects (`&[&dyn Foo]`), keeping the example behavior while making the snippet valid Rust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant