Turn off lifetime elision

I think it would be great as a learning and teaching tool if we could turn off lifetime elision. What do you guys think and do you think that could be a realistic compiler feature?

One thing that does exist at least is a feature of rust-analyzer do display some sort of desugaring of elided lifetimes as an optional inlay hint.

"Turn off lifetime elision" does not sound like a particularly useful compiler feature. Probably most one could expect is some restriction lint in Clippy that one can turn on to turn instances of lifetime elision into compiler errors. (AFAIK such a Clippy lint does not exist at the moment.)

1 Like

Ah I didn't know that. Thanks for the tip.

1 Like

I don't think there is such a feature, but at least we have

#![deny(elided_lifetimes_in_paths)]

https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#elided-lifetimes-in-paths

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.