You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across a compiler error (stable channel) while working with a trait which extends another trait (eg: trait Dog: Mammal { .. }). After some experimenting, it appears the error occurs when the base trait has at least one associated type, and the extending trait specifies the associated type as an array of some kind. In order to trigger the error, the extending trait must be defined in an external crate, and used to constrain a generic type parameter.
Here is the simplest replication of the error I could come up with:
define my_crate like so:
pubtraitFoo{typeItem;}// can be any trait w/ an associated typepubtraitBar:Foo<Item=[u8;1]>{}// length & type of array does not seem to matter
pull in my_crate from another crate:
externcrate my_crate;use my_crate::Bar;fndo_thing<T:Bar>(){}// bounds on structs and impls also trigger bug
attempting to compile the above generates this 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.24.1 (d3ae9a9e0 2018-02-27) running on x86_64-unknown-linux-gnu
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:21
Judging by the backtrace it seems likely that the offending unwrap is one of these two, but that is just a guess.
I've replicated this bug with my local rust install as well as the latest version of the official rust docker image.
The text was updated successfully, but these errors were encountered:
fspmarshall
changed the title
rustc panics on trait bound with array associated type (stable)
ICE: rustc panics on trait bound with array associated type (stable)
Mar 13, 2018
oli-obk
added
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
C-bug
Category: This is a bug.
labels
Mar 14, 2018
Fix ICE #48984
* ~~fbf6423 The tail type was not normalized.~~
* d0839d5 The method had a wrong assumption that something whose parent is a trait is an associated item. Fixes#48984.
I came across a compiler error (stable channel) while working with a trait which extends another trait (eg:
trait Dog: Mammal { .. }
). After some experimenting, it appears the error occurs when the base trait has at least one associated type, and the extending trait specifies the associated type as an array of some kind. In order to trigger the error, the extending trait must be defined in an external crate, and used to constrain a generic type parameter.Here is the simplest replication of the error I could come up with:
define
my_crate
like so:pull in
my_crate
from another crate:attempting to compile the above generates this error:
Judging by the backtrace it seems likely that the offending unwrap is one of these two, but that is just a guess.
I've replicated this bug with my local rust install as well as the latest version of the official rust docker image.
Verbose
rustc
version info for my local install:The text was updated successfully, but these errors were encountered: