| ▲ | GolDDranks 8 months ago | ||||||||||||||||
I think that for a guarantee as central as non-panicking, there ought to be eventually some kind of support in the core language. (Just throwing ideas here, but there could be `#[never_panic]` for simple cases where the compiler can clearly see that panic is not possible, or error otherwise, and `#[unsafe(never_panic)]` for more involved cases, that could be proven with 3rd party tools or by reasoning by the developer like normal unsafe blocks.) For more complicated guarantees, it's harder to see if there's enough common ground for these tools to have some kind of common ground. | |||||||||||||||||
| ▲ | hmry 8 months ago | parent | next [-] | ||||||||||||||||
I think the current plan is to integrate never-panic into the upcoming effect system (formerly keyword generics), along with const and async. So all these function annotations can share the same behavior and syntax, and higher order functions can be generic over them (e.g. "iterator.map(f) is never-panic if f is never-panic" etc) | |||||||||||||||||
| |||||||||||||||||
| ▲ | noxer 8 months ago | parent | prev | next [-] | ||||||||||||||||
Normal rust can already do this. For example #[no_panic] attribute is implemented in https://github.com/dtolnay/no-panic crate. | |||||||||||||||||
| |||||||||||||||||
| ▲ | 8 months ago | parent | prev [-] | ||||||||||||||||
| [deleted] | |||||||||||||||||