-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Adding Copy impl to type causes lifetime errors #24085
Comments
An interesting quirk is that if you replace |
@bkoropoff are you saying this used to work? Just curious what the original was. |
(Also it seems difficult if not impossible to satisfy the combination of |
Yes, this used to work. This bug is affecting https://github.com/bkoropoff/rust-jlens |
This also changes selectors to pass JsonPath by reference instead of value to work around rust-lang/rust#24085
It looks like this may have been introduced in 83ef304. Prior to this, checking for |
Perform trait selection for builtin traits with a throw-away inference context, restoring the behavior prior to 83ef304. This prevents unwanted region constraints that lead to later errors.
@bkoropoff hmm good catch, sorry I let this slip through last week :( I'll try to pay it some attention now. The current code does not seem entirely wrong to me, though. I have to think this through a bit. |
Insert an inference variable before performing trait selection for builtin traits. This prevents overly-restrictive region constraints that lead to later inference failures.
stores relationships like `'c <= '0` (where `'c` is a free region and `'0` is an inference variable) that are derived from closure arguments. These are (rather hackily) ignored for purposes of inference, preventing spurious errors. The current code did not handle transitive cases like `'c <= '0` and `'0 <= '1`. Fixes rust-lang#24085.
Expand the "givens" set to cover transitive relations. The givens array stores relationships like `'c <= '0` (where `'c` is a free region and `'0` is an inference variable) that are derived from closure arguments. These are (rather hackily) ignored for purposes of inference, preventing spurious errors. The current code did not handle transitive cases like `'c <= '0` and `'0 <= '1`. Fixes #24085. r? @pnkfelix cc @bkoropoff *But* I am not sure whether this fix will have a compile-time hit. I'd like to push to try branch observe cycle times.
stores relationships like `'c <= '0` (where `'c` is a free region and `'0` is an inference variable) that are derived from closure arguments. These are (rather hackily) ignored for purposes of inference, preventing spurious errors. The current code did not handle transitive cases like `'c <= '0` and `'0 <= '1`. Fixes rust-lang#24085.
Expand the "givens" set to cover transitive relations. The givens array stores relationships like `'c <= '0` (where `'c` is a free region and `'0` is an inference variable) that are derived from closure arguments. These are (rather hackily) ignored for purposes of inference, preventing spurious errors. The current code did not handle transitive cases like `'c <= '0` and `'0 <= '1`. Fixes #24085. r? @pnkfelix cc @bkoropoff *But* I am not sure whether this fix will have a compile-time hit. I'd like to push to try branch observe cycle times.
Code
Playpen link
Error
Analysis
Notably, this does not occur with a trait like:
This smells like a bug to me, unless a language change introduced special treatment of
Copy
with regard to lifetimes.The text was updated successfully, but these errors were encountered: