|
|
Subscribe / Log in / New account

Rust 1.81.0 released

Version 1.81.0 of the Rust language has been released. Changes include the stabilization of the Error trait in core, some new sort algorithms, some linting improvements, and more.

to post comments

It's about time!

Posted Sep 5, 2024 18:52 UTC (Thu) by python (guest, #171317) [Link] (4 responses)

Error support on no-std platforms has been a headache for me. Glad to see error types entering into core. My recollection is that this has something to do with improving #[panic_handler] error output on nostd.

It's about time!

Posted Sep 5, 2024 19:35 UTC (Thu) by proski (subscriber, #104) [Link] (1 responses)

I agree. 1.81 is one on the most important releases, comparable to 1.75 that allowed async in traits. Error handling is one of the main selling points of Rust, and not having the Error trait in no_std was a major limitation.

It's about time!

Posted Sep 5, 2024 21:28 UTC (Thu) by Vorpal (guest, #136011) [Link]

The next release (1.82) looks to be a big one too, with floating point in const, raw pointer syntax (instead of addr_of macro) and new_uninit for box/rc/arc getting stabilised (assuming no last minute revert during the beta).

A big one for unsafe code. (Also several other things.)

It's about time!

Posted Sep 7, 2024 7:58 UTC (Sat) by beagnach (guest, #32987) [Link] (1 responses)

Why was Error not in core?

It's about time!

Posted Sep 7, 2024 10:54 UTC (Sat) by excors (subscriber, #95769) [Link]

Old versions of the code say: (https://doc.rust-lang.org/1.64.0/src/std/error.rs.html#143)

> Originally, the `Error` trait was defined in libcore, and the impls were scattered about. However, coherence objected to this arrangement, because to create the blanket impls for `Box` required knowing that `&str: !Error`, and we have no means to deal with that sort of conflict just now. Therefore, for the time being, we have moved the `Error` trait into libstd. As we evolve a sol'n to the coherence challenge (e.g., specialization, neg impls, etc) we can reconsider what crate these items belong in.

i.e. some fiddly technical reason.

As far as I can see, another issue was the (experimental, nightly-only) error.backtrace() API that gave an OS-specific Backtrace object. OS-specific types have to go in std (because core is designed to be used when you don't even have an OS), and core cannot depend on std, so Error had to go in std.

Rust 1.64 replaced the backtrace() method with a generic provide<T>() method that can return backtraces (or other things), and moved some Box<dyn Error> stuff from the Error code to the Box code, which let them move Error from std to core (in 1.65, with an unstable feature flag). And now they're confident enough in the design to declare it as stable and let people start relying on it.


Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds