-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Type inference ICE: assertion failed: !self.obligations_in_snapshot.get()
#36053
Comments
What Rust version is that? Can't reproduce on the Playpen |
linux, x86_64, rustc 1.13.0-nightly (e9bc1ba 2016-08-24) |
Same on 1.13.0-nightly (1987131 2016-08-26) |
Also happens on http://play.integer32.com/ |
Note: This was is probably related to specialization. It's definitely not at all related to #35656, I don't even know why you would suggest that. Any suggestion that uncommenting the commented line below is at all related to this problem will be met with derision: #![feature(fused)]
use std::iter::FusedIterator;
struct Thing<'a>(&'a str);
impl<'a> Iterator for Thing<'a> {
type Item = &'a str;
fn next(&mut self) -> Option<&'a str> {
None
}
}
//impl<'a> FusedIterator for Thing<'a> {}
fn main() {
Thing("test").fuse().filter(|_| true).count();
} /cc @alexcrichton @aturon |
triage: P-high Regression, seems bad. @arielb1 says he'll take a look at it. |
The problem is that |
I'll try to gin up a patch, since I think @arielb1 is busy. |
@arielb1 do you agree that this is basically a "false positive" of the problem that this check was designed to prevent? |
(and hence an ok fix is just to save/restore the flag?) |
maybe a better fix is to have fulfillment cx be parameterized by whether to set the flag |
clear obligations-added flag with nested fulfillcx This flag is a debugging measure designed to detect cases where we start a snapshot, create type variables, register obligations involving those type variables in the fulfillment cx, and then have to unroll the snapshot, leaving "dangling type variables" behind. HOWEVER, in some cases the flag is wrong. In particular, we sometimes create a "mini-fulfilment-cx" in which we enroll obligations. As long as this fulfillment cx is fully drained before we return, this is not a problem, as there won't be any escaping obligations in the main cx. So we add a fn to save/restore the flag. Fixes rust-lang#36053. r? @arielb1
Type inference is barfing on:
This only happens to iterators over
types with lifetime parameters and only happens when fused, mapped or filtered, than "operated" on (e.g., counted).&str
sThe following works:
Trace:
The text was updated successfully, but these errors were encountered: