4

Avoid panicking unnecessarily on startup by ChrisDenton · Pull Request #123389 ·...

 1 week ago
source link: https://github.com/rust-lang/rust/pull/123389
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation

Contributor

On Windows, in lang_start we add an exception handler to catch stack overflows and we also reserve some stack space for the handler. Both of these are useful but they're not strictly necessary. The standard library has to work without them (e.g. if Rust is used from a foreign entry point) and the negative effect of not doing them is limited (i.e. you don't get the friendly stack overflow message).

As we really don't want to panic pre-main unless absolutely necessary, it now won't panic on failure. I've added some debug assertions so as to avoid programmer error.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK