TWiR quote of the week

It's better to do:

unsafe fn extend_lifetime<'a, 'b>(r: R<'a>) -> R<'b>

Because it works better with generics (and you can always return to the above signature by specifying 'b == 'static.

1 Like

No need to discuss the API, this quote is all about the unholy diacritics on the identifier.

3 Likes

I needed to double check but apparently, this identifier is actually literally valid.

Well, it gives a warning at least

warning: identifier contains uncommon Unicode codepoints
11 Likes

This one by @m51.

4 Likes

Linux Fortune: (full text)

What they say:                  What they mean:
Meets Tough Quality Standards   It compiles without errors.

Ok this was not about Rust. It was a joke about languages like C. But with Rust, it's true!

4 Likes

Shameless self-nomination:

When a panic has a payload that's an object which needs Drops,
And the panic hits a catch_unwind for unexpected stops
Before if its Drop panicked we'd just crash to your desktops,
Now the payload gets forgotten, and you'd better grab some mops!

-- https://twitter.com/josh_triplett/status/1407776002973986819

5 Likes
4 Likes

11 posts were split to a new topic: Rust, sloppiness, and gatekeeping

Seems worthy enough of a self-nomination.

4 Likes

By @Ethindp.

10 Likes

Beginning Rust: Uh why does the compiler stop me from doing things this is horrible

Advanced Rust: Ugh why doesn't the compiler stop me from doing things this is horrible

qDot on Twitter

30 Likes

The nasty thing about UB is that it does not guarantee that things will go horribly wrong. UB likes to lure you into thinking that you are fine... until it suddenly pulls the floor out from underneath of you and you plummet into the pit where all your code has been arranged in a nice set of spikes.

RalfJung on IRLO

15 Likes

Just replace the "Advanced Rust" with "Beginner C" (or "Advanced C", for that matter) and this will be perfect :grinning_face_with_smiling_eyes:

Lol I came here because I considered self-nominating, but you people are too quick and exceedingly well informed. :wink:

10 Likes

First of all, it seems like Pin might actually be Unpin . This might sound surprising, but really what Unpin means is that the "pinned" and "not-pinned" typestates of a type are the same

-- ralfj

Source: https://github.com/rust-lang/rust/pull/81363#discussion_r650561252

3 Likes

If I can get around ownership issues by cloning first I will absolutely do it, because I see removing clones as an optimization step. […] go and actually measure your performance to see if you actually need to remove the clones. Sometimes you don’t and sometimes you do.

-- Jonathan "JT" Turner in a Rust stream

7 Likes

Tip: whenever you wonder if Pin could be the solution, it isn't

10 Likes

One of the hardest parts of design is the way it interacts with everything. A good abstraction can sometimes cut through that tangled mess and make some parts orthogonal.

@Eh2406 on internals

4 Likes

"Four years had passed since then and the future was now; two years have passed since the future was now and the future is now past."

-- bstrie in Scoped threads in the standard library, take 2 by bstrie · Pull Request #3151 · rust-lang/rfcs · GitHub

7 Likes

We were able to verify the safety of Rust's type system and thus show how Rust automatically and reliably prevents entire classes of programming errors

Ralf Jung in Computer Scientist proves safety claims of the programming language Rust | EurekAlert! Science News

8 Likes