Uh oh!
There was an error while loading. Please reload this page.
Extend E0623 for LateBound and EarlyBound Regions - #44079
Conversation
rust-highfive
commented
Aug 25, 2017
(rust_highfive has picked a reviewer for you, use r? to override) |
5823310 to
3665a7fComparebors
commented
Aug 25, 2017
☔ The latest upstream changes (presumably #43700) made this pull request unmergeable. Please resolve the merge conflicts. |
shepmaster
commented
Aug 25, 2017
Based on this and the merge conflicts, I'm going to treat this as a kind of WIP. |
gaurikholkar-zz
commented
Aug 26, 2017
@shepmaster the first commit was #43700 itself which just got merged. I'll fix the merge conflicts and the compile - tests now |
1c9d960 to
b8559a5Compare6cdae88 to
a944650Compare@arielb1 can you review this please. The error code works fine for LateBound, not working yet for EarlyBound. |
gaurikholkar-zz
commented
Aug 28, 2017
@nikomatsakis can you please review the compile-fail tests? |
There was a problem hiding this comment.
style: you could do a
match(self.infcx.tcx.named_region_map.defs.get(&lifetime.id),self.bound_region){(Some(&rl::Region::LateBoundAnon(debruijn_index, anon_index)),
ty::BrAnon(br_index)) => {// ..}// ..}There was a problem hiding this comment.
style: no newline at end of file
There was a problem hiding this comment.
style:
let is_impl_item = matchself.tcx.hir.find(node_id){Some(hir_map::NodeItem(..)) |
Some(hir_map::NodeTraitItem(..)) => {false}Some(hir_map::NodeImplItem(..)) => {self.is_bound_region_in_impl_item(suitable_region_binding_scope)}
_ => returnNone};There was a problem hiding this comment.
Does this code compile with your patch? Could you try to figure out why an error is not generated?
There was a problem hiding this comment.
Also add a test for early-bound regions (using the 'static: 'a, 'static: 'b trick?)
There was a problem hiding this comment.
The example we had discussed with where clause and sized trait doesn't seem to be working. So.still trying to get the code working for early bound
arielb1
commented
Aug 28, 2017
I would say r=me after style fixes, but WTF is happening with the error messages? |
gaurikholkar-zz
commented
Aug 28, 2017
@arielb some of the tests keep failing, I fixed them but they failed again. |
arielb1
commented
Aug 28, 2017
Are you on IRC? |
gaurikholkar-zz
commented
Aug 28, 2017
Afk for a few hours. @gkholkar on irc. |
nikomatsakis
left a comment
There was a problem hiding this comment.
Left a few comments. This looks pretty nice altogether, though I am concerned about the "disappearing errors" that @arielb1 noted. That said, I see travis isn't passing, so maybe those errors are still being generated?
There was a problem hiding this comment.
Maybe we should rename this variable, if it's not always anonymous? (For that matter, this file and fn?)
There was a problem hiding this comment.
How about both_params_anon_or_named_conflict.rs ?
There was a problem hiding this comment.
hmm, maybe something like different_lifetimes.rs? (since this generates the "types declared with different lifetimes..." message)
There was a problem hiding this comment.
Nit: newline at end of file
There was a problem hiding this comment.
Nit: no need to remove this space, I'd say...
nikomatsakis
commented
Aug 29, 2017
Status update: doesn't fully work for early bound regions yet. Have to investigate to see why. |
5442498 to
ef2f0e1Compare
nikomatsakis
left a comment
There was a problem hiding this comment.
Lookin' good! Left a few more nits. We have to solve the disappearing error problem, obviously.
There was a problem hiding this comment.
we should rename try_report_anon_anon_conflict() to try_report_different_lifetime_conflict()
There was a problem hiding this comment.
Maybe we can call this is_suitable_free_region()? Seems a touch more informative.
There was a problem hiding this comment.
I guess that the error in this case could be a touch misleading -- we'll say that "data flows from a into b here" or whatever, when in fact no dataflow actually occurs. This seems kind of like an edge case though. I'm inclined to leave it as is for now. We may want to reconsider in the future though. Maybe worth opening an issue about at some point.
There was a problem hiding this comment.
indeed, this error should not disappear -- when I investigated a bit, it appeared we were ICEing...?
There was a problem hiding this comment.
error should not disappear
There was a problem hiding this comment.
error should not disappear
There was a problem hiding this comment.
error should not disappear
gaurikholkar-zz
commented
Sep 8, 2017
@GuillaumeGomez, changed the diagnostics.rs for E0312 |
There was a problem hiding this comment.
The error E0312 still exists so why not writing its long error diagnostic instead of just removing the old one?
There was a problem hiding this comment.
At it. Just thought you should know.
25fa4e8 to
44810d9Comparenikomatsakis
commented
Sep 8, 2017
@bors r+ |
bors
commented
Sep 8, 2017
📌 Commit 1c304d2 has been approved by |
bors
commented
Sep 8, 2017
🔒 Merge conflict |
bors
commented
Sep 8, 2017
☔ The latest upstream changes (presumably #44142) made this pull request unmergeable. Please resolve the merge conflicts. |
f91c3fe to
f2ac5ddComparenikomatsakis
commented
Sep 8, 2017
@bors r+ |
bors
commented
Sep 8, 2017
📌 Commit f2ac5dd has been approved by |
I was directed here from this comment. I may be missing what this message is trying to say, but it looks like the compiler should suggest an "outlives" annotation in this case. The above message doesn't tell me what to do. I believe it is saying that since Could this be modified to do so, or a new issue opened to add the Help message? |
1770e90 to
9caab73Compare9caab73 to
09d1a43Compare09d1a43 to
cfc7cf3Comparenikomatsakis
commented
Sep 10, 2017
Thanks for the suggestion. =) This is tricky. This message is intended, in part, as a fallback message -- with the extended error ( |
nikomatsakis
commented
Sep 10, 2017
@bors r+ |
bors
commented
Sep 10, 2017
📌 Commit 88e4bf6 has been approved by |
bors
commented
Sep 10, 2017
Extend E0623 for LateBound and EarlyBound Regions This is a fix for #43882 ``` fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { x.push(y); } ``` now gives ``` error[E0623]: lifetime mismatch --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:12 | 11 | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | ------ ------ these two types are declared with different lifetimes... 12 | x.push(y); | ^ ...but data from `y` flows into `x` here ``` cc @nikomatsakis@arielb1 Please ignore the second commit. It will be merged in a separate PR.
bors
commented
Sep 10, 2017
☀️ Test successful - status-appveyor, status-travis |
This is a fix for #43882
now gives
cc @nikomatsakis@arielb1
Please ignore the second commit. It will be merged in a separate PR.