Hacker News new | ask | show | jobs
by steveklabnik 1437 days ago
In that specific case, the inherent impl is preferred, so there’s no ambiguity. however this can still cause a breaking change if the inherent impl has a different type signature than the trait.

And yes, there are tons of things that can subtly break code. That’s why the rust project runs the entire open source ecosystems’ tests as part of the testing process for the compiler. It’s not all of the code in existence, but it’s pretty good at flushing out if something is going to cause disruption or not.

In practice, the experience that the vast majority of users report to us is that they do not experience breakage when upgrading the compiler.

1 comments

> In that specific case, the inherent impl is preferred, so there’s no ambiguity.

That is even worse. It means your code can silently start doing the wrong thing rather than erroring, if the inherent impl does something different from the trait.

> And yes, there are tons of things that can subtly break code.

This isn't some obscure bug in some deep edge case though, it's a completely normal and common way of using the language (implementing your own traits on foreign types) predictably leading to breakage in an obvious way. I am not sure why it should be called "subtle".

Anyway, given this issue, I think the meme that Rust is backwards-compatible is really oversold. It'd be more honest to frame it as "we hope releases are backwards-compatible, but we like adding new functions to the stdlib, so no promises" rather than marketing BC as a major selling point as is done now.

> In practice, the experience that the vast majority of users report to us is that they do not experience breakage when upgrading the compiler.

It's anecdotal for sure, but I'm personally aware of times when the exact situation I'm describing has happened and caused headaches for people.