Skip to content
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. #759

Closed
steveklabnik opened this issue Jan 29, 2015 · 6 comments
Closed

Find a way to detect API breakage. #759

steveklabnik opened this issue Jan 29, 2015 · 6 comments
Labels
T-dev-tools Relevant to the development tools team, which will review and decide on the RFC.

Comments

@steveklabnik
Copy link
Member

Issue by mahkoh
Wednesday Sep 10, 2014 at 20:36 GMT

For earlier discussion, see rust-lang/rust#17152

This issue was labelled with: in the Rust repository


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:

  • Adding a field to a struct.
  • Changing a struct from Copy to NoCopy (same with Send, Sync, etc.)
  • Adding a variant to an enum.
  • Adding a public method to a type (consider extension traits)
  • Adding a method to a trait (consider #17151)

Therefore rustc needs to have something like this:

rustc --record-api out.json lib_old.rs

stores api information in out.json

rustc --compare-api out.json lib_new.rs

Checks if the new api is compatible with the old one.

@sinistersnare
Copy link

I feel like if a cargo add-on could do this it would be perfect. something like

$ cargo breakage record
$ cargo breakage compare

@nikomatsakis
Copy link
Contributor

The general plan was to tie this analysis to publishing a new version.

@sinistersnare
Copy link

Does rustc have knowledge about 'versions' though?

@Kimundi
Copy link
Member

Kimundi commented Jan 29, 2015

We also need an actual definition of what is considered rusts API in regard to semver.

@Manishearth
Copy link
Member

As a way to solve this problem specifically for rustc:

Write a script that detects if a test (rpass, cfail, etc) that has no #![feature] markers was changed in the PR. If the PR has no [breaking-change] markers, complain about it on the PR (via highfive).

@alexcrichton alexcrichton added the T-dev-tools Relevant to the development tools team, which will review and decide on the RFC. label May 18, 2015
@Centril
Copy link
Contributor

Centril commented Oct 7, 2018

Closing in favor of https://github.com/rust-lang-nursery/rust-semverver.

@Centril Centril closed this as completed Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-dev-tools Relevant to the development tools team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

8 participants