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.
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 thepublic_api::trait_defs
module, particularly in the fields ofTraitDefMetadata
.Example of incorrect breaking change
Initial code
Modified code
Diagnosis from
cargo-breaking
≠ T::f