Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
Clippy
A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
The tricky part, which Rust does not do, is to ensure that this can always be done 100% of the time. This is basically the same problem as guaranteed RVO/NRVO or "(Named) Return Value Optimization" and "placement new" (see e.g. this old tracking issue). Because blocks support basically anything in their body, there are some cases where a temporary (or at least a move) is necessary. Further, carving out a precise specification of when the result can be created directly in place is both a) difficult and b) would be annoying for users to learn and pay attention to.
A case that was recently caught by miri (now that it can run on doctests) and fixed in std docs was where AtomicPtr::new(p: *mut T) -> AtomicPtr was used like AtomicPtr::new(&mut 10).
I recently had this https://github.com/Morganamilo/paru/issues/392 bug reported to me.
Then I figured out what wrong: https://github.com/archlinux/alpm.rs/commit/5253d6
I created an issue to deny such errors: https://github.com/rust-lang/rust-clippy/issues/7311