-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Implement RFC 1679 #36340
Implement RFC 1679 #36340
Conversation
e4cdd6a
to
26f5c2e
Compare
Nice! Could you also add tests that are exercising these new abilities as well? |
26f5c2e
to
dcb3b42
Compare
@alexcrichton updated |
Ok so I finally got around to actually running this on crater, and the result was three regressions: https://gist.github.com/alexcrichton/0c44e2a95044ae9f4d364496bbd0a388. One of those is spurious but the other two look legitimate.
These seem kinda worrisome :( |
The gilrs failure looks like the kind of breakage we'd expect from our back compat guarantees and should be easy to fix. The rss-rs issue is way weirder - not sure what's going on with that. |
I'm guessing this is all because the output type is now generic, so there's cases where there's just not enough inference to figure out what it should actually be |
Ok, minimizing the rss-rs case a little further: fn foo<'a>(split: &[&'a [u8]]) -> (&'a [u8], &'a [u8]) {
(
unsafe { split.get_unchecked(0) },
unsafe { split.get_unchecked(1) },
)
} On stable that compiles and with this patch it yields
That help message seems pretty suspicious for what might be happening here/ |
@alexcrichton do you see the same error using normal indexing with/without the patch? |
@sfackler interestingly, no! If I change the return value to |
That's bizarre. It is a difference between parameterized impls and parameterized methods, but I wouldn't have expected that to matter in this way. |
☔ The latest upstream changes (presumably #36491) made this pull request unmergeable. Please resolve the merge conflicts. |
cc @nikomatsakis, see #36340 (comment) in particular. |
Hmm. I have some theories but no concrete idea. I think I'll have to dig in a bit. |
I spent about an hour digging into this case today. Got to do a few other things now, but I'll try to come back to it. I haven't yet gotten to the bottom of what's going on, but I am going to leave myself a few notes here:
|
Thanks for looking into it! @alexcrichton Given that the weird breakage seems to be something that "should" work modulo compiler bugs, I'd lean towards fixing the two crates that regress and landing this. Thoughts? |
Hm this is a change to such a core type I'd personally prefer to wait for the compiler bug, if any, to get fixed. |
I'd be more comfortable waiting; I'll try to dig in a bit more asap On Fri, Oct 21, 2016 at 10:04:18AM -0700, Alex Crichton wrote:
|
OK, sorry for the delay, last week was crazy, but I dug in some more and I understand the problem. In particular, we have this bit of cleverness called In this case, though, we know that the return type like be I'm not entirely sure what's the best solution here. I have to kind of bring this coercion bit back in my head, and in particular under what circumstances it is required to commit region edges; it may be that we can apply it in more limited circumstances, or avoid committing all of the region inference edges. I suspect region edges are only needed when they affect new region variables that get created during the coercion -- e.g., the edge here, if it were truly needed, would be recreated, I believe. cc @eddyb who wrote the code originally |
Yeah, the region stuff was never great. We only truly care about "type skeletons" - as long as the coercion is triggered, having more freedom around regions (i.e. even replacing them all with fresh vars) shouldn't break anything. |
Do you remember why we had to commit the regions? I guess I can remove that step (and perhaps replace them with fresh vars) and see what happens. |
OK, I have a provisional fix for the compiler bug in question. Doing more testing now. |
Thanks @nikomatsakis! |
dcb3b42
to
8c3e80c
Compare
Rebased - can we run crater one more time now that niko's fix is in? |
Starting crater run. |
Thanks! |
//~| NOTE required because of the requirements on the impl of `std::ops::Index<i32>` | ||
x[..1i32]; //~ ERROR E0277 | ||
//~| NOTE slice indices are of type `usize` or ranges of `usize` | ||
//~| NOTE trait `std::slice::SliceIndex<i32>` is not implemented for `std::ops::RangeTo<i32>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tidy failed, line longer than 100 chars
(should not impact the crater run though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, fixed.
8c3e80c
to
3446a94
Compare
Crater report shows one root regression ( |
Well that's easy! sfackler/rust-postgres@11f1186 |
@alexcrichton I think this is good to go now? |
@@ -8,7 +8,7 @@ | |||
// option. This file may not be copied, modified, or distributed | |||
// except according to those terms. | |||
|
|||
// error-pattern:index out of bounds | |||
// error-pattern:assertion failed: self < slice.len() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per travis:
error: error pattern 'assertion failed: self < slice.len()' not found!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, fixed.
3446a94
to
5377b5e
Compare
@bors: r+ Nice! |
📌 Commit 5377b5e has been approved by |
Implement RFC 1679 cc #35729 r? @alexcrichton
Fix more breakage similar to rust-lang/rust#36340 and 11f1186
cc #35729
r? @alexcrichton