-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find a way to detect API breakage. #17152
Comments
We had an extensive discussion at the last work week about what exactly should count as a breaking change. I hope to write this up in a more formal way and propose it as official guidelines for semver/stability attributes. Automating these checks via a tool would be amazing. |
Adding a public field. |
Adding a private field is also a breaking change if it had no private fields before. Adding a public field is only a breakage change if it had no private fields before. |
Has anything happened here? Another one:
|
@mahkoh That affects ABI ( |
You cannot call panicking functions in destructors if your program depends on destructors running. |
This might also cause UB if you previously counted on a function not panicking while writing unsafe code. |
A reliable program cannot depend on destructors running. E.g. the operating system can just kill it outright due to OOM, at essentially any time. |
This is correct but some people do rely on it. See for example this thread #19245 Those who defend unwinding sometimes argue that it is essential for certain programs such as Servo which relies on unwinding. But the process will simply abort if destructors fail during unwinding. |
It's actually worse than that. Changing a function from non-panicking to panicking can cause UB in previously completely safe code. Consider the following module written in rust and called from C code: #[no_mangle]
pub extern fn hello_rust() -> *const u8 {
"Hello, world!\0".as_ptr()
} If as_ptr introduces a panicking case, then this will cause UB without having to use unsafe. |
@mahkoh I think the plan is to catch unwinding and abort at |
The more common case is unwinding in unsafe code. rust/src/libcollections/vec.rs Line 262 in f3d71be
Changing the conditions under which a function can panic has to be considered a breaking change. |
rust-lang/rfcs#757 addresses
|
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#759 |
I believe this should stay here at least until it has been decided what is considered breaking the API. |
Given that the current rust ecosystem tries very hard to force everyone to use semver, and given that rust code breaks the API easily, this is very important.
Some easy but surprising ways to break the API:
Therefore rustc needs to have something like this:
stores api information in out.json
Checks if the new api is compatible with the old one.
The text was updated successfully, but these errors were encountered: