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

ICE: region_obligations not empty #46069

Closed
bluss opened this issue Nov 18, 2017 · 3 comments
Closed

ICE: region_obligations not empty #46069

bluss opened this issue Nov 18, 2017 · 3 comments
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bluss
Copy link
Member

bluss commented Nov 18, 2017

New ICE discovered (in itertools' test suite):

thread 'rustc' panicked at 'region_obligations not empty: [
    (
        NodeId(
            0
        ),  
        RegionObligation(sub_region='_#60r, sup_type=u8)
    )   
]', /checkout/src/librustc/infer/mod.rs:1160:8

(Note, the issue has been worked around in itertools, to keep CI green)

Code to reproduce

(playground link)

//! ```cargo
//! [dependencies]
//! itertools = "=0.7.2"
//! ```
extern crate itertools;

use itertools::Itertools;

fn equal_combinations_2(a: Vec<u8>) {
    a.iter().cloned().tuple_combinations::<(_, _)>();
}

Implementation links for tuple_combinations:

  1. https://github.com/bluss/rust-itertools/blob/c56a69d7cc3014b04bb88bbe42040a0243168a0a/src/lib.rs#L992-L998
  2. https://github.com/bluss/rust-itertools/blob/c56a69d7cc3014b04bb88bbe42040a0243168a0a/src/adaptors/mod.rs#L910-L921

Full error

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.23.0-nightly (d0f8e2913 2017-11-16) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at 'region_obligations not empty: [
    (
        NodeId(
            0
        ),  
        RegionObligation(sub_region='_#60r, sup_type=u8)
    )   
]', /checkout/src/librustc/infer/mod.rs:1160:8
@bluss bluss added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Nov 18, 2017
@arielb1 arielb1 added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 19, 2017
@nagisa nagisa added P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed I-nominated labels Nov 23, 2017
@arielb1 arielb1 self-assigned this Nov 23, 2017
@arielb1
Copy link
Contributor

arielb1 commented Nov 23, 2017

Minified:

use std::iter::Fuse;

pub struct TupleCombinations<I: Iterator> {
    iter: <Fuse<I> as Iterator>::Item,
}

pub fn equal_combinations_2(
    a: TupleCombinations<std::iter::Cloned<std::slice::Iter<u8>>>
) {
}

fn main() {}

@arielb1
Copy link
Contributor

arielb1 commented Nov 23, 2017

even minier:

use std::iter::{Fuse, Cloned};
use std::slice::Iter;

fn main() {
    let f = 0 as *mut <Fuse<Cloned<Iter<u8>>> as Iterator>::Item;
}

@arielb1
Copy link
Contributor

arielb1 commented Nov 23, 2017

Similar (using upvar inference instead of specialization);

struct Foo<T>(*const T);
impl<T: 'static> Copy for Foo<T> {}
impl<T: 'static> Clone for Foo<T> {
    fn clone(&self) -> Self { *self }
}

fn main() {
    let s = 2;
    let upvar = Foo(&|| s);
    let k = || upvar;
    k();
}

arielb1 added a commit to arielb1/rust that referenced this issue Nov 25, 2017
Type-live-for-region obligations on DUMMY_NODE_ID cause an ICE, and it
turns out that in the few cases they are needed, these obligations are not
needed anyway because they are verified elsewhere.

Fixes rust-lang#46069.
bors added a commit that referenced this issue Nov 30, 2017
avoid type-live-for-region obligations on dummy nodes

Type-live-for-region obligations on DUMMY_NODE_ID cause an ICE, and it
turns out that in the few cases they are needed, these obligations are not
needed anyway because they are verified elsewhere.

Fixes #46069.

Beta-nominating because this is a regression for our new beta.
r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants