Extending the unsafe keyword

I'm sorry, but that is not a concrete example or use case. With that I meant maybe a small code example or at least specifics of the situation involved. It is very hard to discuss sensibly when we are just talking in the abstract.

1 Like

Sorry, I meant to say that I do not have such a concrete example.

i'm not sure that's the fault of a single pair of curly brackets. indeed, i'm confused what you could be doing where you need so many unsafe blocks, as that implies that you are calling lots of functions with unchecked preconditions, but those functions themselves don't have any unsafe preconditions, otherwise they should be marked unsafe, and thus you wouldn't need unsafe blocks inside of them.

From edition 2024 you are required (strongly encouraged) to use unsafe blocks inside unsafe fn.

1 Like

FWIW I've so far been holding the line on that not being a hard error. It's not obvious to me yet that that's a universal good. It might be that letting it be allowed for certain modules will remain the best answer.

It does seem plausibly good in large functions with low unsafe density, but in short unsafe helpers it can feel pretty bad.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.