Repository navigation
Regression in nightly-2020-07-22: collection encountered polymorphic constant #74614
Copy link
Copy link
Closed
Closed
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
The widely used reqwest crate began failing to compile in nightly-2020-07-22. To reproduce, clone https://github.com/seanmonstar/reqwest/tree/69288606bcf648967ddd09000f06e88161f80a2f and run cargo build.
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:629:54: collection encountered polymorphic constant
--> /home/david/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:30:1
|
30 | / pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable {
31 | | &Vtable {
32 | | poll: poll::<T, S>,
33 | | dealloc: dealloc::<T, S>,
... |
37 | | }
38 | | }
| |_^Note the error is presented on tokio-0.2.22 but that crate compiles fine by itself. Running cargo build again indicates it's only reqwest being compiled when the ICE occurs.
Complete error and backtrace
$ RUST_BACKTRACE=1 cargo +nightly-2020-07-22 build
Compiling reqwest v0.10.6 (/git/tmp/reqwest)
error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:629:54: collection encountered polymorphic constant
--> /home/david/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:30:1
|
30 | / pub(super) fn vtable<T: Future, S: Schedule>() -> &'static Vtable {
31 | | &Vtable {
32 | | poll: poll::<T, S>,
33 | | dealloc: dealloc::<T, S>,
... |
37 | | }
38 | | }
| |_^
thread 'rustc' panicked at 'Box<Any>', /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/macros.rs:13:23
stack backtrace:
0: std::backtrace_rs::backtrace::libunwind::trace
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/../backtrace/src/backtrace/libunwind.rs:96
1: std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/../backtrace/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/sys_common/backtrace.rs:77
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/sys_common/backtrace.rs:58
4: core::fmt::write
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libcore/fmt/mod.rs:1117
5: std::io::Write::write_fmt
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/io/mod.rs:1508
6: std::sys_common::backtrace::_print
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/sys_common/backtrace.rs:61
7: std::sys_common::backtrace::print
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/sys_common/backtrace.rs:48
8: std::panicking::default_hook::{{closure}}
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/panicking.rs:198
9: std::panicking::default_hook
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/panicking.rs:217
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at /rustc/8ad7bc3f428300aee6764f6e23527e19eb235e81/src/libstd/panicking.rs:530
12: std::panicking::begin_panic
13: rustc_errors::HandlerInner::span_bug
14: rustc_errors::Handler::span_bug
15: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
16: rustc_middle::ty::context::tls::with_opt::{{closure}}
17: rustc_middle::ty::context::tls::with_opt
18: rustc_middle::util::bug::opt_span_bug_fmt
19: rustc_middle::util::bug::span_bug_fmt
20: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_const
21: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_rvalue
22: rustc_mir::monomorphize::collector::collect_neighbours
23: rustc_mir::monomorphize::collector::collect_items_rec
24: rustc_mir::monomorphize::collector::collect_items_rec
25: rustc_mir::monomorphize::collector::collect_items_rec
26: rustc_mir::monomorphize::collector::collect_items_rec
27: rustc_mir::monomorphize::collector::collect_items_rec
28: rustc_mir::monomorphize::collector::collect_items_rec
29: rustc_mir::monomorphize::collector::collect_items_rec
30: rustc_mir::monomorphize::collector::collect_items_rec
31: rustc_mir::monomorphize::collector::collect_items_rec
32: rustc_mir::monomorphize::collector::collect_items_rec
33: rustc_mir::monomorphize::collector::collect_items_rec
34: rustc_mir::monomorphize::collector::collect_items_rec
35: rustc_mir::monomorphize::collector::collect_items_rec
36: rustc_mir::monomorphize::collector::collect_items_rec
37: rustc_mir::monomorphize::collector::collect_items_rec
38: rustc_mir::monomorphize::collector::collect_items_rec
39: rustc_mir::monomorphize::collector::collect_items_rec
40: rustc_mir::monomorphize::collector::collect_items_rec
41: rustc_mir::monomorphize::collector::collect_items_rec
42: rustc_mir::monomorphize::collector::collect_items_rec
43: rustc_mir::monomorphize::collector::collect_items_rec
44: rustc_mir::monomorphize::collector::collect_items_rec
45: rustc_mir::monomorphize::collector::collect_items_rec
46: rustc_mir::monomorphize::collector::collect_items_rec
47: rustc_mir::monomorphize::collector::collect_items_rec
48: rustc_mir::monomorphize::collector::collect_items_rec
49: rustc_mir::monomorphize::collector::collect_items_rec
50: rustc_session::utils::<impl rustc_session::session::Session>::time
51: rustc_mir::monomorphize::collector::collect_crate_mono_items
52: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
53: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
54: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
55: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
56: rustc_data_structures::stack::ensure_sufficient_stack
57: rustc_query_system::query::plumbing::get_query_impl
58: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
59: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::exported_symbols>::compute
60: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
61: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
62: rustc_data_structures::stack::ensure_sufficient_stack
63: rustc_query_system::query::plumbing::get_query_impl
64: rustc_metadata::rmeta::encoder::encode_metadata_impl
65: rustc_data_structures::sync::join
66: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata
67: rustc_middle::ty::context::TyCtxt::encode_metadata
68: rustc_interface::passes::start_codegen
69: rustc_middle::ty::context::tls::enter_global
70: rustc_interface::queries::Queries::ongoing_codegen
71: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
72: rustc_span::with_source_map
73: rustc_interface::interface::create_compiler_and_run
74: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.47.0-nightly (8ad7bc3f4 2020-07-21) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
error: aborting due to previous error
error: could not compile `reqwest`.
To learn more, run the command again with --verbose.Reacted by Michael Sproul, Jon Gjengset, Nazar Mokrynskyi and Vitalii Kryvenko
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Activity
Pin CI to nightly-2020-07-21 to avoid rust-lang/rust#74614
JohnTitor commentedon Jul 22, 2020
I think the culprit PR is #69749 (and this is the first failure of "Polymorphization"), cc @davidtwco
link2xt commentedon Jul 22, 2020
Same bug encountered here: chatmail/core#1743
eddyb commentedon Jul 22, 2020
Huh the code that emits the ICE is kind of broken in terms of user expectations:
rust/src/librustc_mir/monomorphize/collector.rs
Lines 625 to 631 in 4825e12
It found a constant
vtable::<T, S>(or more likelyvtable::<T, S>::promoted0) somewhere but theSpanit uses isn't that of the use site (self.body.source_info(location).span), but rather the definition site of the constant (fn vtable).IMO it should print the constant (as part of the message), but use the use site span as the ICE span. Printing the
ty::Constand not theDefIdwill ensure that the generic parameters are shown, which should help with debugging bugs like this.JohnTitor commentedon Jul 22, 2020
Assigning
P-criticalas discussed as part of the Prioritization Working Group procedure and removingI-prioritize.tests: add regression test for rust-lang#74614
Rollup merge of rust-lang#74623 - lcnr:polymorphize-functions, r=eddyb
Revert "Pin CI to nightly-2020-07-21 to avoid rust-lang/rust#74614"