Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Trait items in definition changes are too restrictive #3

Open
scrabsha opened this issue Jul 6, 2021 · 0 comments
Open

Trait items in definition changes are too restrictive #3

scrabsha opened this issue Jul 6, 2021 · 0 comments

Comments

@scrabsha
Copy link
Contributor

scrabsha commented Jul 6, 2021

API extracted from trait definition are a near-verbatim of the original AST. As a result, any change in the AST of the trait impl block is detected as a breaking change. See an example of incorrectly-detect breaking change at the end of the issue.

To fix this, we must reduce the amount of data we take "as is" from the AST. For instance, instead of taking a full TraitItemMethod, we should store the method signature and wheter if it is provided or not. Most of the changes should be done in the public_api::trait_defs module, particularly in the fields of TraitDefMetadata.

Example of incorrect breaking change

Initial code
pub trait T {
    fn f() { 42 }
}
Modified code
pub trait T {
    fn f() { 101 }
}
Diagnosis from cargo-breaking

≠ T::f

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant