Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Check for changes in auto-impls of Send and Sync #48

Open
Aaron1011 opened this issue Feb 17, 2018 · 5 comments
Open

Check for changes in auto-impls of Send and Sync #48

Aaron1011 opened this issue Feb 17, 2018 · 5 comments

Comments

@Aaron1011
Copy link
Member

Once rust-lang/rust#47833 lands, it should be possible to make use of it to compute the bounds for auto-trait impls, and check them for backwards-incompatible changes.

It will probably be necessary to PR some minor adjustments to rustc (e.g. moving AutoTraitFinder from librustdoc to librustc), but all of the core logic already exists.

@ibabushkin
Copy link
Contributor

ibabushkin commented Feb 17, 2018 via email

@ibabushkin
Copy link
Contributor

ibabushkin commented Mar 4, 2018

I've taken a look at the merged changes. Some observations:

  • I'm not sure whether it will make sense to reuse the implementation to the full extend (quite possibly, but I'm currently not sure as to how I'd implement the new checks).
  • A naive implementation relying on type changes and the presence of explicit negative implementations wouldn't work, because of field privacy.

@Aaron1011
Copy link
Member Author

@ibabushkin: Some refactoring of the code in rustc would certainly need to happen, but I don't think that it would be too difficult.

In particular, check_bounds_error in semverer takes a ParamEnv to check against. This is computed in my code here. It should be fairly simple to modify AutoTraitFinder to expose the calculated ParamEnv. Lifetimes will probably require special handling, however.

@ibabushkin
Copy link
Contributor

Hm, a quick question regarding AutoTraitFinder::evaluate_predicates, which is arguably the core bit of code I need: why is the inference context passed to it mutably borrowed? The mutability is not used. I assume there is some internal mutability going on somewhere, but I'd like to hear your reasoning. The background is that currently, I'm having troubles fitting the AutoTraitFinder functionality into the overall framework of semverver, for various reasons.

@Aaron1011
Copy link
Member Author

@ibabushkin: I think that mutable borrow may be completely unecessary - though I don't have a rustc workspace setup atm to check. It might have been necessary in an earlier iteration of the code, but it can probably be changed to an immutable borrow now.

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

2 participants