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 using function pointer to function returning `impl Iterator<Item = &&'a str>` #50881

Closed
lbcsccrb opened this Issue May 19, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@lbcsccrb
Copy link

lbcsccrb commented May 19, 2018

struct S<'a> {
    v: Vec<&'a str>
}

impl<'a> S<'a> {
    fn inner_iter(&self) -> impl Iterator<Item = &&'a str> {
        self.v.iter()
    }
}

fn main() {
    let s = S { v: Vec::new() };
    [s].iter()
        .flat_map(S::inner_iter)
        .for_each(|_| {});
}

Error Message:

error: internal compiler error: librustc/infer/canonical.rs:705: failed to lift `QueryResult { var_values: CanonicalVarValues { var_values: ['?0, '?1] }, region_constraints: QueryRegionConstraints { region_outlives: [('?0, '?0), ('?0, '?0), ('?0, '?0), ('?0, '?0), ('?0, '?0), ('?0, '?0), ('?0, '?0), ('?0, '?0), (ReStatic, '?1)], ty_outlives: [] }, certainty: Proven, value: NormalizationResult { normalized_ty: &'_ &'_ str } }`, canonicalized from `QueryResult { var_values: CanonicalVarValues { var_values: ['_#0r, '_#1r] }, region_constraints: QueryRegionConstraints { region_outlives: [('_#0r, '_#2r), ('_#0r, '_#4r), ('_#2r, '_#0r), ('_#2r, '_#3r), ('_#2r, '_#5r), ('_#3r, '_#2r), ('_#4r, '_#0r), ('_#5r, '_#2r), (ReStatic, '_#1r)], ty_outlives: [] }, certainty: Proven, value: NormalizationResult { normalized_ty: &&str } }`

thread 'rustc' panicked at 'Box<Any>', librustc_errors/lib.rs:543:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error


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.26.0 (a77568041 2018-05-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

https://play.rust-lang.org/?gist=4f2d7ff43b1e5ceb514066159c1ffa63&version=stable&mode=debug

Meta

rustc --version --verbose:
rustc 1.26.0 (a775680 2018-05-07)
binary: rustc
commit-hash: a775680
commit-date: 2018-05-07
host: x86_64-unknown-linux-gnu
release: 1.26.0
LLVM version: 6.0

@estebank

This comment has been minimized.

Copy link
Contributor

estebank commented Jun 22, 2018

Fixed in nightly.

@rust-lang/compiler should we identify when it was fixed and back port?

@Arnavion

This comment has been minimized.

Copy link

Arnavion commented Aug 17, 2018

Whatever the fix was is also in stable now.

@estebank estebank closed this Aug 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment