Very interesting finds for sure. But taking the "trusting user-provided code" as an example: isn't this just a case of malicious code being malicious? I understand the point that the malicious act comes through memory unsafety, and it's a big gotcha that safe Rust (i.e. Rust without `unsafe`) can trigger memory unsafe behavior. But the code doing it is still acting maliciously (by having an `AsRef` implementation that returns different slices at different times). And the code being abused (the one that does the unsafe indexing) does have `unsafe` – so this is a case of the user writing unsafe Rust that interacts with malicious safe Rust.
I don't know if it's ever been in Rust's threat model to handle malicious code.
Sufficiently deniable malice is indistinguishable from incompetence. If a condition can be triggered "maliciously", then it can probably be also triggered inadvertently. There's no point in saying "that's malicious so it doesn't count".
When I write such an explanation it will probably use Comte as an example. Comte implements ExactSizeIterator which is a safe trait for claiming your iterator gives accurate information about how many items are left. It's lying (but equally a safe implementer might just be mistaken), and Comte is not in fact giving accurate size information. However, if you need to rely on a promise that the iterator length is correct Rust has an unsafe trait for such promises named TrustedLen.
Unlike Comte, mis-implementing TrustedLen could cause Memory Unsafety, but you would need to write the `unsafe` keyword and be lying or mistaken, which is what Rust promised you will happen.
To give a concrete example, if I tell Rust I want to put the results from this iterator over Goose into an array [Goose; 6] in usual cases it will emit code to check for overflow and panic if the Iterator makes the wrong number of Goose, even if the iterator implements ExactSizeIterator and claims to have six Goose, that panic check happens. But if it implements TrustedLen and makes the same claim, the compiler will believe it and skip the check. If it was wrong about having six Goose, your program is nonsense and anything might happen.
Only JavaScript partially supports this, based on the domain where the code originated from, so your website code is not infected by the Javascript run by an ad you embed.
Thank you for your work, it's always interesting to read your take.
Forgive the naive question on something that's probably been discussed many times over, but could there be a middle ground when it comes to a stable ABI and generics? Something where the person building the library for dynamic linking chooses which explicit monomorphizations they'd like to provide for each public generic function (and type), and the compiler stamps out all combinations of those concrete instances? Could the way these are named and stamped out be standardized so that this could be treated as a stable ABI for non-generics?
It seems to me that it would at least cover distros: they could make a pass over all their Rust code and determine which monomorphizations are needed throughout the distro.
Well yes, but then your interface is a C ABI. That's fantastic if the side using my library is any language where C is the only common ground. When the application side is Rust though, it leaves a lot to be desired. It would be delicious to actually interface in a way that respects Rust!
Hell, even if all exposed functions and types would need to be fully monomorphized at the interface, it would be a lot nicer to pass a `&'a [i64]` rather than a `const * int64_t` together with a `size_t n` and have to marshall the slice on both sides.
How on earth can you possibly bring yourself to using the words "hand written" in your GH about section? Please, I'm losing my mind here. Words mean something.
A lot of AI fans are behaving awfully lot like cult members.
Standard note for the people in said cult who take every criticism of anything related to AI as a claim that AI is useless in every way: that is not what I'm saying.
Calling AI useless is being kind. I personally think AI is worse then useless. It is consumer hostile and damaging technology, and that humanity would be better off without it. AI is useful in the same way Cigarettes or Amphetamines are useful.
I'd go with "Obsessive devotion to or veneration for a person, principle, or thing."
That's how we get these endless superficial questioning of everything except LLM, like asking how you define $commonly_used_word, or this constant "I know you are, but what are LLM?" stuff, such as Is there any evidence that you yourself are more than a 'next action predictor with a multi-modal context window'?. Apparently no self-awareness, no accountability, and there is barely a conversation where people can simply say something trivially true about LLM, that anyone working on them, even an LLM, could explain to you, that doesn't garner such knee-jerk responses.
Come on! They're selling you books in the $20 range and using free (if slightly tedious) videos to promote said books in a polite and non-pushy way. I can't believe this upsets people!
reply