Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> For example `-> impl Trait` return types famously leak the `Send`/`Sync`-ness of the type,

Doesn't that mean that the return type isn't actually fully specified? That sounds wild to me. How did they end up there?



I'm not defending it (or claiming to really understand anything here), but this is where that came from:

https://rust-lang.github.io/rfcs/1522-conservative-impl-trai...

(OIBIT = auto trait, like Send/Sync)


Two reasons:

- It would have been very annoying if it didn't work like this

- Auto-traits also leak through private fields, so you would have the same issue if you e.g. wrapped the concrete return type in a new type and returned that one instead.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: