this post was submitted on 20 Dec 2023
198 points (96.7% liked)

Programmer Humor

32061 readers
1019 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] lseif@sopuli.xyz 1 points 8 months ago (1 children)

is that valid syntax in any context? i dont think it is

[–] Ephera@lemmy.ml 4 points 8 months ago (1 children)

Pretty sure, it's not. That's why I included the error highlighting.

To make it a valid struct field, you'd need to throw in a Box+dyn:

pub pint: Box

For a function parameter, you need an impl and can't have the pub:

pint: impl Sized

Obviously, you could define your own struct or generic that also happens to be called Sized, but yeah, that's cheating.

[–] lseif@sopuli.xyz 2 points 8 months ago

thats what i figured. thanks :-)