Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
sans-seraph
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
sans-seraph
2y ago
> Ability to temporarily borrow exclusively owned objects as either shared or exclusive-mutable adds enough flexibility. Rust quietly has several other features in order to improve the quality-of-life of its ownership model. Two examples
2.
▲
by
sans-seraph
2y ago
> I do wish not handling a Result was a hard error, and not just a warning via `must_use` It is possible to turn any Rust warning into an error with the use of the `deny` attribute. In addition it is now possible to configure the behavio
3.
▲
by
sans-seraph
2y ago
I have been aware of this proposed initiative for some time and I find it interesting that it is now becoming public. It is a very ambitious proposal and I agree that this level of ambition is appropriate for DARPA's mission and I wish
4.
▲
by
sans-seraph
2y ago
> Most serious programs will use write() and then check the return value. Similarly in Rust, serious programs will use writeln rather than println, and will receive the standard compiler warning if the Result produced by writeln is ignor
5.
▲
by
sans-seraph
2y ago
Let us be clear that the notion of "change" being referred to here is forward compatibility, not backward compatibility. The user is commenting on the fact that Rust library authors make use of new features as they become availabl
6.
▲
by
sans-seraph
2y ago
This was my initial mindset as someone whose background lies in untyped languages, but after time with Rust I no longer feel that way. My feeling now is that seeing a Rust codebase typecheck gives me more confidence than seeing a Python or
7.
▲
by
sans-seraph
2y ago
In the case of Rust the fast feedback loop is facilitated by the `cargo check` command which halts compilation after typechecking. Unlike in Swift the typechecking phase in Rust is not a significant contributor to compilation times and so s
8.
▲
by
sans-seraph
2y ago
The +=1 in the above code is defined behavior. Unlike in C, the Rust compiler is not allowed to assume that overflow does not happen, and must restrict its optimizations accordingly. The undefined behavior in this code would be a result of
9.
▲
by
sans-seraph
2y ago
Rust's linting tool, Clippy, provides a lint that will produce a warning when a function pointer is cast to any integral type: https://rust-lang.github.io/rust-clippy/master/index.html#/f... The broader
10.
▲
by
sans-seraph
2y ago
No, Rust does not allow safe conversions from integers to function pointers. The code `main as usize as fn()` will result in a "non-primitive cast" error. In order to convert from an integer or raw pointer to a function pointer, t
11.
▲
by
sans-seraph
2y ago
> Question: are there any opportunities to rewrite this logic in a more "structured" style, or to make any other optimizations? Because A and C only jump to B it is possible to structure this using only loops and one boolean. L