Live data from Hacker News

No-Panic Rust: A Nice Technique for Systems Programming

blog.reverberate.org

21–30 of 143 posts

Re: No-Panic Rust: A Nice Technique for Systems Programming

#21
post #18
post #11

I've had an unpleasant amount of crashes with Rust software because people are way too quick to grab `panic!` as an out. This was most shocking to me in some of the Rust code Mozilla had integrated into Firefox (the CSS styling code). There was some font cache shenanigans that was causing their font loading to work only semi-consistently, and that would outright crash this subsystem, and tofu-ify CJK text entirely as…

At least sources of panic! are easily greppable. Cutting corners on error handling is usually pretty obvious

I mean... rust modules aren't typically in your CWD, no? they're not in some node_modules that you can grep, but in a cargo folder with /all of the libraries you ever used/, not just the ones you have for this one project.

Re: No-Panic Rust: A Nice Technique for Systems Programming

#22
post #6
post #2

This website makes by browser freeze... No idea why. Not able to read the article.

Author here -- that is surprising. What browser/OS are you on? I haven't had anyone else report this problem before.

Same issue on Android using Brave.

Re: No-Panic Rust: A Nice Technique for Systems Programming

#23
post #18

Earlier quoted context omitted.

At least sources of panic! are easily greppable. Cutting corners on error handling is usually pretty obvious

I mean... rust modules aren't typically in your CWD, no? they're not in some node_modules that you can grep, but in a cargo folder with /all of the libraries you ever used/, not just the ones you have for this one project.

Putting them all in the project root takes just a single `cargo vendor` command.

But I would assume that for mozilla their entire CSS subsystem is pulled in as a git (hg?) submodule or something anyways.

Re: No-Panic Rust: A Nice Technique for Systems Programming

#24
post #18

Earlier quoted context omitted.

At least sources of panic! are easily greppable. Cutting corners on error handling is usually pretty obvious

I mean... rust modules aren't typically in your CWD, no? they're not in some node_modules that you can grep, but in a cargo folder with /all of the libraries you ever used/, not just the ones you have for this one project.

If you run cargo vendor, they end up in a neat directory.

Re: No-Panic Rust: A Nice Technique for Systems Programming

#25
post #11

I've had an unpleasant amount of crashes with Rust software because people are way too quick to grab `panic!` as an out. This was most shocking to me in some of the Rust code Mozilla had integrated into Firefox (the CSS styling code). There was some font cache shenanigans that was causing their font loading to work only semi-consistently, and that would outright crash this subsystem, and tofu-ify CJK text entirely as…

Sometimes the program is in an invalid state. You don't want to keep running the program. Better to fail spectacularly and clearly then to fail silently and try to hobble along.

Re: No-Panic Rust: A Nice Technique for Systems Programming

#27
post #5

Does anyone know if there's an obvious reason that adding a `no_panic` crate attribute wouldn't be feasible? It certainly seems like an "obvious" thing to add so I'm hesitant to take the obvious nerd snipe bait.

You could do it, but I would prefer guarantees on a per-call chain basis using a sanitizer. It should be quite easy to write.

Re: No-Panic Rust: A Nice Technique for Systems Programming

#28
post #23

Earlier quoted context omitted.

I mean... rust modules aren't typically in your CWD, no? they're not in some node_modules that you can grep, but in a cargo folder with /all of the libraries you ever used/, not just the ones you have for this one project.

Putting them all in the project root takes just a single `cargo vendor` command. But I would assume that for mozilla their entire CSS subsystem is pulled in as a git (hg?) submodule or something anyways.

not sure how the CSS subsystem is included (I remember it is shared with Servo?), but in general all of the Rust dependencies in mozilla-central is vendored, so nothing is in your ~/.cargo directory.

Re: No-Panic Rust: A Nice Technique for Systems Programming

#29
> Protocol Buffers

Instead of serializing data (to disk, not the network), it would be much faster if Rust allowed us to allocate datastructures directly in an mmapped file, and allowed us to read back the data (basically patching the pointers so they become valid if the base address changed).

Re: No-Panic Rust: A Nice Technique for Systems Programming

#30
post #11

I've had an unpleasant amount of crashes with Rust software because people are way too quick to grab `panic!` as an out. This was most shocking to me in some of the Rust code Mozilla had integrated into Firefox (the CSS styling code). There was some font cache shenanigans that was causing their font loading to work only semi-consistently, and that would outright crash this subsystem, and tofu-ify CJK text entirely as…

[deleted]
Post reply on HN