Compiler panics when creating a trait object for a trait which uses generic_associated_types #76535
Labels
A-GATs
Area: Generic associated types (GATs)
C-bug
Category: This is a bug.
F-generic_associated_types
`#![feature(generic_associated_types)]` a.k.a. GATs
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I think the trait object isn't aware of the parameters in the associated type, so it ends up with a different number of parameters than it should.
Code
main.rs
:Meta
rustc --version --verbose
:Error output
Backtrace
```warning: the feature
generic_associated_types
is incomplete and may not be safe to use and/or cause compiler crashes--> src/main.rs:1:12
|
1 | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44265 #44265 for more information
warning: unused variable:
sub
--> src/main.rs:36:9
|
36 | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
| ^^^ help: if this is intentional, prefix it with an underscore:
_sub
|
= note:
#[warn(unused_variables)]
on by defaultwarning: field is never read:
sup
--> src/main.rs:12:5
|
12 | sup: &'a mut SuperStruct,
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note:
#[warn(dead_code)]
on by defaultwarning: field is never read:
value
--> src/main.rs:18:5
|
18 | value: u8,
| ^^^^^^^^^
warning: Error finalizing incremental compilation session directory
/home/alex/Documents/Development/ice_minimal/target/debug/incremental/ice_minimal-12sq6hsbdt9f2/s-fr1ebr4tpj-1habbbz-working
: No such file or directory (os error 2)warning: 5 warnings emitted
error: internal compiler error: impl item and trait item have different parameter counts
|
= note: delayed at /rustc/8e21bd0633b8d970646ee6eb706c9e8acfad19af/src/librustc_session/session.rs:441:27
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at /rustc/8e21bd0633b8d970646ee6eb706c9e8acfad19af/src/librustc_session/session.rs:441:27
thread 'rustc' panicked at 'no errors encountered even though
delay_span_bug
issued', src/librustc_errors/lib.rs:366:17stack backtrace:
0: std::panicking::begin_panic
1: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
2: core::ptr::drop_in_place
3: <alloc::rc::Rc as core::ops::drop::Drop>::drop
4: core::ptr::drop_in_place
5: rustc_span::with_source_map
6: rustc_interface::interface::create_compiler_and_run
7: rustc_span::with_session_globals
note: Some details are omitted, run with
RUST_BACKTRACE=full
for a verbose backtrace.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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.47.0-nightly (8e21bd0 2020-08-14) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile
ice_minimal
.To learn more, run the command again with --verbose.
The text was updated successfully, but these errors were encountered: