ICE: #[rustc_variance] on trait: asked to compute variance for wrong kind of item #79699
Closed as not planned
Closed as not planned
Description
Code
#![feature(rustc_attrs)]
#[rustc_variance]
trait Tr { }
fn main() { }
Meta
rustc --version --verbose
:
rustc 1.50.0-nightly (e9dd18ca7 2020-12-04)
binary: rustc
commit-hash: e9dd18ca749801a19d85bfb424ae12011a8ff894
commit-date: 2020-12-04
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly
Error output
error: internal compiler error: compiler/rustc_typeck/src/variance/mod.rs:45:9: asked to compute variance for wrong kind of item
--> ./src/test/compile-fail/variance-region-bounds.rs:4:1
|
4 | trait Tr { }
| ^^^^^^^^^^^^
thread 'rustc' panicked at 'Box<Any>', /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/compiler/rustc_errors/src/lib.rs:904:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
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.50.0-nightly (e9dd18ca7 2020-12-04) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [variances_of] computing the variances of `Tr`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
Backtrace
error: internal compiler error: compiler/rustc_typeck/src/variance/mod.rs:45:9: asked to compute variance for wrong kind of item
--> ./src/test/compile-fail/variance-region-bounds.rs:4:1
|
4 | trait Tr { }
| ^^^^^^^^^^^^
thread 'rustc' panicked at 'Box<Any>', /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/compiler/rustc_errors/src/lib.rs:904:9
stack backtrace:
0: 0x7f90f0b2b990 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x7f90f0b2b990 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f90f0b2b990 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7f90f0b2b990 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/sys_common/backtrace.rs:46:22
4: 0x7f90f0b9f58c - core::fmt::write::hdf023a0036d2a25f
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/core/src/fmt/mod.rs:1078:17
5: 0x7f90f0b1d462 - std::io::Write::write_fmt::h8580846154bcb66a
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/io/mod.rs:1519:15
6: 0x7f90f0b2f615 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/sys_common/backtrace.rs:49:5
7: 0x7f90f0b2f615 - std::sys_common::backtrace::print::h54a7d3e52a524177
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/sys_common/backtrace.rs:36:9
8: 0x7f90f0b2f615 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/panicking.rs:208:50
9: 0x7f90f0b2f16a - std::panicking::default_hook::hf0f9afb1017317fc
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/panicking.rs:225:9
10: 0x7f90f13c4948 - rustc_driver::report_ice::hff78d76a39ffbb86
11: 0x7f90f0b2ff16 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/panicking.rs:595:17
12: 0x7f90f205ec3d - std::panicking::begin_panic::{{closure}}::h54eeb46bac46db82
13: 0x7f90f205eb86 - std::sys_common::backtrace::__rust_end_short_backtrace::h4e2b24765319763c
14: 0x7f90f1f40f1f - std::panicking::begin_panic::hc2016e83d046c641
15: 0x7f90f204441c - rustc_errors::HandlerInner::span_bug::h8e6533b92ab43aa3
16: 0x7f90f20446d0 - rustc_errors::Handler::span_bug::h572b00fe05637c58
17: 0x7f90f211e554 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h5cb28236637f8e39
18: 0x7f90f211e14b - rustc_middle::ty::context::tls::with_opt::{{closure}}::h4b587d06910badc4
19: 0x7f90f211e0f2 - rustc_middle::ty::context::tls::with_opt::h1de5816033aded9d
20: 0x7f90f211e453 - rustc_middle::util::bug::opt_span_bug_fmt::hfae2ed8f53b5e93e
21: 0x7f90f211e417 - rustc_middle::util::bug::span_bug_fmt::h5fd16dadd4aa27be
22: 0x7f90f20775e7 - rustc_typeck::variance::variances_of::{{closure}}::h20f743f215738ce1
23: 0x7f90f207739a - rustc_typeck::variance::variances_of::h57ac03785ddd37d0
24: 0x7f90f1f302f2 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::variances_of>::compute::h29ccb15266121033
25: 0x7f90f200c065 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h45e1bc6044779c4d
26: 0x7f90f202beb4 - rustc_data_structures::stack::ensure_sufficient_stack::he988aaa7327e6398
27: 0x7f90f21a71f4 - rustc_query_system::query::plumbing::get_query_impl::hbcf2f924d8608ce6
28: 0x7f90f1f57fb3 - <rustc_typeck::variance::test::VarianceTest as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::he7d71188a6857160
29: 0x7f90f209b646 - rustc_hir::hir::Crate::visit_all_item_likes::hea439839e1e6c838
30: 0x7f90f2078a91 - rustc_typeck::check_crate::hab874d5f99f602e6
31: 0x7f90f1624642 - rustc_interface::passes::analysis::h34f9b972d8af6f3d
32: 0x7f90f1380f7b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h95ff81a8a73eaff3
33: 0x7f90f140f486 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task::h05a5aa3f40ff3b2d
34: 0x7f90f1422686 - rustc_data_structures::stack::ensure_sufficient_stack::h371083fbc17898bc
35: 0x7f90f13aecb4 - rustc_query_system::query::plumbing::get_query_impl::hcc63ca689fa3c69b
36: 0x7f90f138321b - rustc_interface::passes::QueryContext::enter::h2071e0a8631ee0e4
37: 0x7f90f1420045 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hd899306a06575d0c
38: 0x7f90f13eddf7 - rustc_span::with_source_map::ha4e07ff263d0dc1d
39: 0x7f90f141bdec - scoped_tls::ScopedKey<T>::set::h39c0aa543118d3f3
40: 0x7f90f1423296 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1e5aa72fb9cd6d86
41: 0x7f90f138afca - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc793837e985b77ce
42: 0x7f90f0b3f99a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/alloc/src/boxed.rs:1327:9
43: 0x7f90f0b3f99a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/alloc/src/boxed.rs:1327:9
44: 0x7f90f0b3f99a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
at /rustc/e9dd18ca749801a19d85bfb424ae12011a8ff894/library/std/src/sys/unix/thread.rs:71:17
45: 0x7f90f0a353e9 - start_thread
46: 0x7f90f0952293 - __GI___clone
47: 0x0 - <unknown>
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.50.0-nightly (e9dd18ca7 2020-12-04) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [variances_of] computing the variances of `Tr`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: This issue needs bisection: /~https://github.com/rust-lang/cargo-bisect-rustcInternal rustc attributes gated on the `#[rustc_attrs]` feature gate.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.