Rust: Compiler crashed with `impl Trait` inside a non-existing type

Created on 13 Aug 2018  路  5Comments  路  Source: rust-lang/rust

When putting impl Trait inside some non-existing type as the return type of a function, the compiler crashes unexpectedly with

thread 'main' panicked at 'no entry found for key', libcore/option.rs:960:5.

minimal case:

fn bug() -> Wrapper<impl A> {}

Playground: http://play.rust-lang.org/?gist=b16591d9c6cc69f894c15bfca84198d9&version=stable&mode=debug&edition=2015

rustc version (my local machine):

rustc 1.28.0 (9634041f0 2018-07-30)
binary: rustc
commit-hash: 9634041f0e8c0f3191d2867311276f19d0a42564
commit-date: 2018-07-30
host: x86_64-apple-darwin
release: 1.28.0
LLVM version: 6.0

E-easy I-ICE

Most helpful comment

@oli-obk I would like to help out with this, thanks.

All 5 comments

I was told that I should be more conservative with panics. Did I listen? No. "Can't happen anymore anyway", well it can

The fix is to revert the linked change (not the entire commit, just the change where the link points to)

https://github.com/rust-lang/rust/commit/28a76a90009d605349babcd2755962ab93913327#diff-4ed25c00aceb84666fca639cf8101c7cL1069

and then add a test for it.

@oli-obk I would like to help out with this, thanks.

Fixed by @JoshBrudnak in #53460
Aborts without ICE on current nightly
rustc 1.30.0-nightly (d41f21f11 2018-08-24)

Fixed by @JoshBrudnak in #53460
Aborts without ICE on current nightly
rustc 1.30.0-nightly (d41f21f11 2018-08-24)

Shouldn't this issue be closed considering this ?

I think so.

Was this page helpful?
0 / 5 - 0 ratings