-
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
Only 'static
is permitted within type bounds (causes ICE: Cannot relate bound region)
#5121
Comments
see also #5715 |
@nikomatsakis this going to land in time for 0.7? I really hope so, it's really obnoxious. |
(Also, |
Bumping from 0.7 |
I ran into this when trying to devise a too-clever interface for select2 that would let me avoid code duplication, but it would not let me use non-static borrowed pointers. https://gist.github.com/bblum/6042762 |
This will be the final part of #4846. Turns out that this is not so simple as I originally thought (but also not horribly scary or complex). I'll put up a blog post soon (and link it here) describing my proposal. |
See http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ for a detailed write-up of the changes I propose to fix this. |
…f whether they appear in a trait bound. Fixes rust-lang#5121.
@nikomatsakis: I ran into another region ICE that's similar to the other ones I ran into. This is with #10506 applied:
With this error:
Is this related to #5121 or is this a different bug? |
@erickt: In case you want a quick workaround, I've found that something like the following sometimes works:
(Note that I changed the type of the argument of |
@pnkfelix: a fix for this issue would be awesome. In case it helps, here's an example of the kind of thing I'd like to see supported:
|
@dwrensha yeah I've successfully rebased niko's patches and got them passing our tests. I need to rebase them again now that |
@nikomatsakis by the way, the example given by @erickt still does not work even after applying PR #12807. I think that this is because erickt's example is not quite correct: in fn foo<'a, C: Iterable<'a>>(c: C) {
c.my_iter();
} the (I think erickt's example should work fine if you change the foo parameter to be a |
…etime-params, r=pnkfelix Fix issue #5121: Add proper support for early/late distinction for lifetime bindings. There are some little refactoring cleanups as separate commits; the real meat that has the actual fix is in the final commit. The original author of the work was @nikomatsakis; I have reviewed it, revised it slightly, refactored it into these separate commits, and done some rebasing work.
Taken from #12851 trait MyTrait<'a> {
fn yo(&'a self);
}
struct MyStruct<'a> {
inner: &'a MyTrait<'a>,
}
impl<'a> MyStruct<'a> {
fn foo_inner(&mut self) {
self.inner.yo()
}
} |
well, I guess it is a good thing I didn't have bors automatically close this ticket with PR #12807. Will investigate these ICE's. (i had noted others above, may be related.) |
The problem was that we need to apply the substitution, so that the formal lifetime parameters get replaced with (unifiable) free-lifetimes that can actually be fed into the constraint solver.
I have a patch that fixes most of the ICE's above, though not all of them. I will try to put it up for review either tonight or tomorrow. |
After reviewing the bugs that have been marked as duplicates of this bug, I've collected all of the cases that were not fixed by the original Early/Late patch and put them into their own modules. (Sometimes I tried to reduce them into smaller test cases, but usually when I did that I made a variant module with the reduced case while also keeping the original.) The result of this collection process is posted in a file at the following gist: (It wasn't originally a single file, but that is the easiest way to distribute the collection. It is easy enough to go back and forth between separate files and a single file for the modules, thanks to the beauty of Rust's module system.) |
PR #13157 fixes most of the ICE's exposed by https://gist.github.com/pnkfelix/9788730 The main exceptions are the ICE's that are exposed by passing The other important things that are not fixed by PR #13157 (a fix to issue #13140) are the non-ICE unsoundness issues that are represented by the print out from the gisted code when you run it, namely the output:
|
r? @nikomatsakis Fix #13140 Includes two fixes, and a semi-thorough regression test. (There is another set of tests that I linked from #5121, but those are sort of all over the place, while the ones I've included here are more directly focused on the issues at hand.)
So, as mentioned above, there still remain issues #11971 and #12856 that remain unfixed. (They are already open, since they were not marked as dupes, just related.) Also, we probably need to make some other changes, such as allowing one to put a lifetime bound on a trait (which means that all impls need to have that bound on them But, most of the work has been done here, and I claim that new bugs related to this one should not be closed as dupes of this one (but rather should be classified as unique on their own or classified as dupes of some other, more specific bug). So I am going to close this bug. |
Improve compile_test and dogfood tests * Hopefully this finally resolves the "multiple matching crates" error, e.g. rust-lang#4015 * This handle some convenient CARGO env like CARGO_TARGET_DIR and CARGO_BUILD_TARGET changelog: none
Fix error E0460 when compiled on Rustc repo Sadly, this mostly reverts rust-lang#5121. Now I use HashMap to only store one rlib per crate. But that would not work when non-compatible version of the same crate show up. changelog: none
…021-12-02 subtree sync
Once we can declare lifetime parameters, there is no reason not to permit them in type bounds. Also, I am not entirely sure if the way we are handling them is correct/sound. I've tagged places where such bounds appear with FIXMEs so that I can look into them later.
Example:
pnkfelix: I am adding a checklist to the bottom of this bug, where the unchecked issues represent problems that still remain unfixed (and the entire list of issues were closed as duplicates of this ticket).
Cannot relate bound region
#10868The text was updated successfully, but these errors were encountered: