Skip to content
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

itertool's chunk iterator causes a compiler panic when mapping with non-lexical lifetimes #53680

Closed
Jess3Jane opened this issue Aug 24, 2018 · 2 comments · Fixed by #53580
Closed
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@Jess3Jane
Copy link

This is the minimum example I was able to get it down to:

#![feature(nll)]

extern crate itertools;
use itertools::Itertools;

fn main() {
    b"abcdefg".iter().chunks(2).into_iter().map(|a| 1);
}

When try to compile this the compiler says

thread 'main' panicked at 'scrape_region_constraints: incoming region obligations = [
    (
        NodeId(
            20
        ),
        RegionObligation(sub_region='_#1r, sup_type=&u8)
    )
]', librustc/traits/query/type_op/custom.rs:85:5

It is specifically an issue with map and non-lexical lifetimes as removing either of them doesn't cause the bug.

Meta

My current rust version is

rustc 1.30.0-nightly (63d66494a 2018-08-23)
binary: rustc
commit-hash: 63d66494aff57411bfec1dd2a3a5f1af900feab6
commit-date: 2018-08-23
host: x86_64-unknown-linux-gnu
release: 1.30.0-nightly
LLVM version: 7.0

But this happened on every other system I tried it on, including play.rust-lang.org

@memoryruins memoryruins added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-NLL Area: Non-lexical lifetimes (NLL) WG-compiler-nll labels Aug 25, 2018
@memoryruins
Copy link
Contributor

Thanks for the minimum example!
Similar issues: #53482 #52992
Potential fix: #53580

@nikomatsakis
Copy link
Contributor

I can confirm that this is fixed by #53580

@nikomatsakis nikomatsakis self-assigned this Aug 27, 2018
@nikomatsakis nikomatsakis added this to the Rust 2018 RC milestone Aug 27, 2018
bors added a commit that referenced this issue Aug 27, 2018
fix NLL ICEs

Custom type-ops reuse some of the query machinery -- but while query results are canonicalized after they are constructed, custom type ops are not, and hence we have to resolve the type variables to avoid an ICE here.

Also, use the type-op machinery for implied outlives bounds.

Fixes #53568
Fixes #52992
Fixes #53680
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants