Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: rustc_specialization_trait and circular associated type #102252

Open
ChaiTRex opened this issue Sep 25, 2022 · 2 comments
Open

ICE: rustc_specialization_trait and circular associated type #102252

ChaiTRex opened this issue Sep 25, 2022 · 2 comments
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-rustc_attrs Internal rustc attributes gated on the `#[rustc_attrs]` feature gate. F-specialization `#![feature(specialization)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-internal-features This issue requires the use of internal features S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@ChaiTRex
Copy link
Contributor

Code

[Playground link]

#![feature(min_specialization, rustc_attrs)]

#[rustc_specialization_trait]
pub trait Trait {}

struct Struct
where
    Self: Iterator<Item = <Self as Iterator>::Item>, {}

impl Trait for Struct {}

Meta

rustc --version --verbose:

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-unknown-linux-gnu
release: 1.64.0
LLVM version: 14.0.6

rustc 1.65.0-beta.2 (e5da98475 2022-09-24)
binary: rustc
commit-hash: e5da98475e88b52384bac96923bba7cd45941d69
commit-date: 2022-09-24
host: x86_64-unknown-linux-gnu
release: 1.65.0-beta.2
LLVM version: 15.0.0

rustc 1.66.0-nightly (3f83906b3 2022-09-24)
binary: rustc
commit-hash: 3f83906b30798bf61513fa340524cebf6676f9db
commit-date: 2022-09-24
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.0

Error output

   Compiling ice v0.0.0 (/home/ubuntu/dev/ice)
thread 'rustc' panicked at 'assertion failed: !obligations.needs_infer()', compiler/rustc_typeck/src/impl_wf_check/min_specialization.rs:358:13

[Backtrace removed]

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.66.0-nightly (3f83906b3 2022-09-24) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_mod_impl_wf] checking that impls are well-formed in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: implied_outlives_bounds failed to solve all obligations
  --> src/lib.rs:10:1
   |
10 | impl Trait for Struct {}
   | ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_trait_selection/src/traits/outlives_bounds.rs:63:31

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1530:13

[Backtrace removed]

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.66.0-nightly (3f83906b3 2022-09-24) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `ice`

Caused by:
  process didn't exit successfully: `rustc --crate-name ice --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=2cc8a57eb73b0fe5 -C extra-filename=-2cc8a57eb73b0fe5 --out-dir /home/ubuntu/dev/ice/target/debug/deps -C incremental=/home/ubuntu/dev/ice/target/debug/incremental -L dependency=/home/ubuntu/dev/ice/target/debug/deps` (signal: 6, SIGABRT: process abort signal)
Backtrace

   Compiling ice v0.0.0 (/home/ubuntu/dev/ice)
thread 'rustc' panicked at 'assertion failed: !obligations.needs_infer()', compiler/rustc_typeck/src/impl_wf_check/min_specialization.rs:358:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/panicking.rs:556:5
   1: core::panicking::panic_fmt
             at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/core/src/panicking.rs:48:5
   3: <rustc_infer::infer::InferCtxtBuilder>::enter::<(), rustc_typeck::impl_wf_check::min_specialization::check_predicates::{closure#3}>
   4: rustc_typeck::impl_wf_check::min_specialization::check_min_specialization
   5: rustc_typeck::impl_wf_check::check_mod_impl_wf
   6: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, ()>
   7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, ()>>
   8: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::check_mod_impl_wf, rustc_query_impl::plumbing::QueryCtxt>
   9: <rustc_middle::hir::map::Map>::for_each_module::<rustc_typeck::check_crate::{closure#2}::{closure#0}::{closure#0}>
  10: <rustc_session::session::Session>::track_errors::<rustc_typeck::check_crate::{closure#2}, ()>
  11: rustc_typeck::check_crate
  12: rustc_interface::passes::analysis
  13: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
  15: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  16: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  17: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  18: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
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.66.0-nightly (3f83906b3 2022-09-24) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_mod_impl_wf] checking that impls are well-formed in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: implied_outlives_bounds failed to solve all obligations
  --> src/lib.rs:10:1
   |
10 | impl Trait for Struct {}
   | ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at compiler/rustc_trait_selection/src/traits/outlives_bounds.rs:63:31

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1530:13
stack backtrace:
   0:     0x7f3a43cd1fc0 - std::backtrace_rs::backtrace::libunwind::trace::h83db09f97ba446e0
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f3a43cd1fc0 - std::backtrace_rs::backtrace::trace_unsynchronized::hbc692a375382599a
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3a43cd1fc0 - std::sys_common::backtrace::_print_fmt::h5d9374f1dc540502
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f3a43cd1fc0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h678bc20029fef91d
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f3a43d2cdfe - core::fmt::write::h3ff59c1e0cfd7af2
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f3a43cc2c05 - std::io::Write::write_fmt::h57bc84b9ab3e4292
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/io/mod.rs:1679:15
   6:     0x7f3a43cd4d43 - std::sys_common::backtrace::_print::h58613138e3b60a1b
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3a43cd4d43 - std::sys_common::backtrace::print::h182e9bde2e8d07ea
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3a43cd4d43 - std::panicking::default_hook::{{closure}}::h829771b46ce932f3
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/panicking.rs:267:22
   9:     0x7f3a43cd4a2f - std::panicking::default_hook::h167447d609e3453b
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/panicking.rs:286:9
  10:     0x7f3a4650c431 - <rustc_driver[615eae184240f2d1]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[d525c930f060fa4e]::ops::function::FnOnce<(&core[d525c930f060fa4e]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f3a43cd557b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8a7c5a65eb87446d
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/alloc/src/boxed.rs:1954:9
  12:     0x7f3a43cd557b - std::panicking::rust_panic_with_hook::haa7a7aef616e6ae8
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/panicking.rs:673:13
  13:     0x7f3a4761e931 - std[590eaa09bda9df92]::panicking::begin_panic::<rustc_errors[a92f92f3abe4e548]::ExplicitBug>::{closure#0}
  14:     0x7f3a4761e306 - std[590eaa09bda9df92]::sys_common::backtrace::__rust_end_short_backtrace::<std[590eaa09bda9df92]::panicking::begin_panic<rustc_errors[a92f92f3abe4e548]::ExplicitBug>::{closure#0}, !>
  15:     0x7f3a4761dfa6 - std[590eaa09bda9df92]::panicking::begin_panic::<rustc_errors[a92f92f3abe4e548]::ExplicitBug>
  16:     0x7f3a4761bd06 - std[590eaa09bda9df92]::panic::panic_any::<rustc_errors[a92f92f3abe4e548]::ExplicitBug>
  17:     0x7f3a46055338 - <rustc_errors[a92f92f3abe4e548]::HandlerInner as core[d525c930f060fa4e]::ops::drop::Drop>::drop
  18:     0x7f3a452da348 - core[d525c930f060fa4e]::ptr::drop_in_place::<rustc_session[c2bba8d08c637bfa]::parse::ParseSess>
  19:     0x7f3a452985c8 - <alloc[10be8beb537b5cb7]::rc::Rc<rustc_session[c2bba8d08c637bfa]::session::Session> as core[d525c930f060fa4e]::ops::drop::Drop>::drop
  20:     0x7f3a4529529d - core[d525c930f060fa4e]::ptr::drop_in_place::<rustc_interface[c48cc815669d5993]::interface::Compiler>
  21:     0x7f3a45293444 - rustc_interface[c48cc815669d5993]::interface::create_compiler_and_run::<core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>, rustc_driver[615eae184240f2d1]::run_compiler::{closure#1}>
  22:     0x7f3a45290f41 - <scoped_tls[cad2a7494d31e12]::ScopedKey<rustc_span[199ab19abca3e97b]::SessionGlobals>>::set::<rustc_interface[c48cc815669d5993]::interface::run_compiler<core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>, rustc_driver[615eae184240f2d1]::run_compiler::{closure#1}>::{closure#0}, core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>>
  23:     0x7f3a45290c2f - std[590eaa09bda9df92]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c48cc815669d5993]::util::run_in_thread_pool_with_globals<rustc_interface[c48cc815669d5993]::interface::run_compiler<core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>, rustc_driver[615eae184240f2d1]::run_compiler::{closure#1}>::{closure#0}, core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>>::{closure#0}, core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>>
  24:     0x7f3a46362ff0 - <<std[590eaa09bda9df92]::thread::Builder>::spawn_unchecked_<rustc_interface[c48cc815669d5993]::util::run_in_thread_pool_with_globals<rustc_interface[c48cc815669d5993]::interface::run_compiler<core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>, rustc_driver[615eae184240f2d1]::run_compiler::{closure#1}>::{closure#0}, core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>>::{closure#0}, core[d525c930f060fa4e]::result::Result<(), rustc_errors[a92f92f3abe4e548]::ErrorGuaranteed>>::{closure#1} as core[d525c930f060fa4e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f3a43cdf363 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc33c8b6114373b1d
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/alloc/src/boxed.rs:1940:9
  26:     0x7f3a43cdf363 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h477ba7c62d8daaed
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/alloc/src/boxed.rs:1940:9
  27:     0x7f3a43cdf363 - std::sys::unix::thread::Thread::new::thread_start::h7a4a94e6bf66c5d5
                               at /rustc/3f83906b30798bf61513fa340524cebf6676f9db/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f3a43a33b43 - <unknown>
  29:     0x7f3a43ac5a00 - <unknown>
  30:                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.66.0-nightly (3f83906b3 2022-09-24) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `ice`

Caused by:
  process didn't exit successfully: `rustc --crate-name ice --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=2cc8a57eb73b0fe5 -C extra-filename=-2cc8a57eb73b0fe5 --out-dir /home/ubuntu/dev/ice/target/debug/deps -C incremental=/home/ubuntu/dev/ice/target/debug/incremental -L dependency=/home/ubuntu/dev/ice/target/debug/deps` (signal: 6, SIGABRT: process abort signal)

@ChaiTRex ChaiTRex added C-bug Category: This is a bug. 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. labels Sep 25, 2022
@ChaiTRex
Copy link
Contributor Author

It looks like it was introduced some time between 1.43.1 and 1.44.1.

Meta

rustc --version --verbose:

rustc 1.44.1 (c7087fe00 2020-06-17)
binary: rustc
commit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7
commit-date: 2020-06-17
host: x86_64-unknown-linux-gnu
release: 1.44.1
LLVM version: 9.0

Error output

   Compiling ice v0.0.0 (/home/ubuntu/dev/ice)
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> src/lib.rs:1:1
  |
1 | #![feature(min_specialization, rustc_attrs)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'region constraints already solved', src/librustc_infer/infer/mod.rs:209:9
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.1 (c7087fe00 2020-06-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
error: could not compile `ice`.

To learn more, run the command again with --verbose.
Backtrace
   Compiling ice v0.0.0 (/home/ubuntu/dev/ice)
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> src/lib.rs:1:1
  |
1 | #![feature(min_specialization, rustc_attrs)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'region constraints already solved', src/librustc_infer/infer/mod.rs:209:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1504
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:515
  12: rust_begin_unwind
             at src/libstd/panicking.rs:419
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:111
  14: core::option::expect_failed
             at src/libcore/option.rs:1260
  15: rustc_infer::infer::InferCtxt::start_snapshot
  16: rustc_infer::infer::InferCtxt::commit_if_ok
  17: rustc_trait_selection::traits::project::opt_normalize_projection_type
  18: rustc_trait_selection::traits::project::normalize_projection_type
  19: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_ty
  20: rustc_middle::ty::fold::TypeFoldable::fold_with
  21: rustc_trait_selection::traits::project::normalize_to
  22: rustc_trait_selection::traits::wf::WfPredicates::normalize
  23: rustc_trait_selection::traits::wf::obligations
  24: rustc_typeck::impl_wf_check::min_specialization::check_always_applicable
  25: rustc_infer::infer::InferCtxtBuilder::enter
  26: rustc_typeck::impl_wf_check::min_specialization::check_min_specialization
  27: <rustc_typeck::impl_wf_check::ImplWfCheck as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item
  28: rustc_middle::hir::map::Map::visit_item_likes_in_module
  29: rustc_typeck::impl_wf_check::check_mod_impl_wf
  30: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_impl_wf>::compute
  31: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  33: rustc_query_system::query::plumbing::get_query
  34: rustc_query_system::query::plumbing::ensure_query
  35: rustc_typeck::impl_wf_check::impl_wf_check
  36: rustc_typeck::check_crate
  37: rustc_interface::passes::analysis
  38: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  39: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  40: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  41: rustc_query_system::query::plumbing::get_query
  42: rustc_middle::ty::context::tls::enter_global
  43: rustc_interface::interface::run_compiler_in_existing_thread_pool
  44: scoped_tls::ScopedKey<T>::set
  45: rustc_ast::attr::with_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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.1 (c7087fe00 2020-06-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [check_mod_impl_wf] checking that impls are well-formed in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

For more information about this error, try `rustc --explain E0554`.
error: could not compile `ice`.

To learn more, run the command again with --verbose.

@crlf0710 crlf0710 added A-specialization Area: Trait impl specialization F-specialization `#![feature(specialization)]` T-types Relevant to the types team, which will review and decide on the PR/issue. labels Sep 25, 2022
@matthiaskrgr matthiaskrgr added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Dec 19, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Dec 21, 2022
@workingjubilee workingjubilee added the F-rustc_attrs Internal rustc attributes gated on the `#[rustc_attrs]` feature gate. label Mar 14, 2023
@Noratrieb Noratrieb added the requires-internal-features This issue requires the use of internal features label Apr 5, 2023
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@matthiaskrgr
Copy link
Member

updated stacktrace

warning: the feature `rustc_attrs` is internal to the compiler or standard library
 --> f.rs:1:32
  |
1 | #![feature(min_specialization, rustc_attrs)]
  |                                ^^^^^^^^^^^
  |
  = note: using it is strongly discouraged
  = note: `#[warn(internal_features)]` on by default

error[E0601]: `main` function not found in crate `f`
  --> f.rs:10:25
   |
10 | impl Trait for Struct {}
   |                         ^ consider adding a `main` function to `f.rs`

error[E0275]: overflow evaluating the requirement `<Struct as Iterator>::Item == _`
 --> f.rs:6:1
  |
6 | struct Struct
  | ^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs:420:9:
assertion failed: !obligations.has_infer()
stack backtrace:
   0:     0x7cc880835b35 - std::backtrace_rs::backtrace::libunwind::trace::hf6436e929f7909b2
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7cc880835b35 - std::backtrace_rs::backtrace::trace_unsynchronized::h66804002fba2d9a2
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7cc880835b35 - std::sys_common::backtrace::_print_fmt::h37691a73293ec221
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7cc880835b35 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0c103d3d357450b2
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7cc880884cfb - core::fmt::rt::Argument::fmt::h7dd3a77f3202738e
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/core/src/fmt/rt.rs:165:63
   5:     0x7cc880884cfb - core::fmt::write::h14fe62b4f0765a22
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/core/src/fmt/mod.rs:1157:21
   6:     0x7cc88082a87f - std::io::Write::write_fmt::h65dcc5485b0907ac
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/io/mod.rs:1835:15
   7:     0x7cc88083590e - std::sys_common::backtrace::_print::h494af3712379749e
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7cc88083590e - std::sys_common::backtrace::print::h033d8e5cb8f913e7
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7cc880838279 - std::panicking::default_hook::{{closure}}::h2c9a1c60f356f72b
  10:     0x7cc880837fbd - std::panicking::default_hook::h5eb86e5b9864f803
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/panicking.rs:298:9
  11:     0x7cc87d2ba1af - std[c2942707aeb3fecf]::panicking::update_hook::<alloc[7183c8e6e494c79b]::boxed::Box<rustc_driver_impl[183fefe8278e000e]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7cc880838976 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h687983cf8c8b1924
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/alloc/src/boxed.rs:2036:9
  13:     0x7cc880838976 - std::panicking::rust_panic_with_hook::he27185849116e75a
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/panicking.rs:799:13
  14:     0x7cc8808386eb - std::panicking::begin_panic_handler::{{closure}}::h4c49ba09408244b3
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/panicking.rs:656:13
  15:     0x7cc880835ff9 - std::sys_common::backtrace::__rust_end_short_backtrace::hd35c2e6a82fff9df
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7cc880838457 - rust_begin_unwind
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/panicking.rs:652:5
  17:     0x7cc8808812c3 - core::panicking::panic_fmt::h9ce34dba3d434a10
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/core/src/panicking.rs:72:14
  18:     0x7cc88088136c - core::panicking::panic::h97f5e163faee8a89
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/core/src/panicking.rs:146:5
  19:     0x7cc87d4253bf - rustc_hir_analysis[7270adfa0a603d34]::impl_wf_check::min_specialization::check_always_applicable
  20:     0x7cc87ef13772 - rustc_hir_analysis[7270adfa0a603d34]::check::wfcheck::check_well_formed
  21:     0x7cc87ef1019d - rustc_query_impl[b0b6e1adda5b8627]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b0b6e1adda5b8627]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ad05dbfce6aa193f]::query::erase::Erased<[u8; 1usize]>>
  22:     0x7cc87ef0f940 - rustc_query_system[a96a8a7004732019]::query::plumbing::try_execute_query::<rustc_query_impl[b0b6e1adda5b8627]::DynamicConfig<rustc_query_system[a96a8a7004732019]::query::caches::VecCache<rustc_hir[923df9bef2e89365]::hir_id::OwnerId, rustc_middle[ad05dbfce6aa193f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b0b6e1adda5b8627]::plumbing::QueryCtxt, false>
  23:     0x7cc87ef0f6bf - rustc_query_impl[b0b6e1adda5b8627]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7cc87ef0d5f7 - rustc_hir_analysis[7270adfa0a603d34]::check::wfcheck::check_mod_type_wf
  25:     0x7cc87ef0d427 - rustc_query_impl[b0b6e1adda5b8627]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b0b6e1adda5b8627]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ad05dbfce6aa193f]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7cc87eefc2b0 - rustc_query_system[a96a8a7004732019]::query::plumbing::try_execute_query::<rustc_query_impl[b0b6e1adda5b8627]::DynamicConfig<rustc_query_system[a96a8a7004732019]::query::caches::DefaultCache<rustc_span[2022bdb1e52fe685]::def_id::LocalModDefId, rustc_middle[ad05dbfce6aa193f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b0b6e1adda5b8627]::plumbing::QueryCtxt, false>
  27:     0x7cc87eefc05b - rustc_query_impl[b0b6e1adda5b8627]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7cc87ec9fcde - rustc_hir_analysis[7270adfa0a603d34]::check_crate
  29:     0x7cc87efe2423 - rustc_interface[4e3bc9a91fb7f25c]::passes::analysis
  30:     0x7cc87efe1f61 - rustc_query_impl[b0b6e1adda5b8627]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b0b6e1adda5b8627]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ad05dbfce6aa193f]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7cc87f3d3d65 - rustc_query_system[a96a8a7004732019]::query::plumbing::try_execute_query::<rustc_query_impl[b0b6e1adda5b8627]::DynamicConfig<rustc_query_system[a96a8a7004732019]::query::caches::SingleCache<rustc_middle[ad05dbfce6aa193f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b0b6e1adda5b8627]::plumbing::QueryCtxt, false>
  32:     0x7cc87f3d3ac9 - rustc_query_impl[b0b6e1adda5b8627]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7cc87f23988e - rustc_interface[4e3bc9a91fb7f25c]::interface::run_compiler::<core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>, rustc_driver_impl[183fefe8278e000e]::run_compiler::{closure#0}>::{closure#1}
  34:     0x7cc87f225609 - std[c2942707aeb3fecf]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4e3bc9a91fb7f25c]::util::run_in_thread_with_globals<rustc_interface[4e3bc9a91fb7f25c]::util::run_in_thread_pool_with_globals<rustc_interface[4e3bc9a91fb7f25c]::interface::run_compiler<core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>, rustc_driver_impl[183fefe8278e000e]::run_compiler::{closure#0}>::{closure#1}, core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>>::{closure#0}, core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>>
  35:     0x7cc87f2253b8 - <<std[c2942707aeb3fecf]::thread::Builder>::spawn_unchecked_<rustc_interface[4e3bc9a91fb7f25c]::util::run_in_thread_with_globals<rustc_interface[4e3bc9a91fb7f25c]::util::run_in_thread_pool_with_globals<rustc_interface[4e3bc9a91fb7f25c]::interface::run_compiler<core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>, rustc_driver_impl[183fefe8278e000e]::run_compiler::{closure#0}>::{closure#1}, core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>>::{closure#0}, core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[719ca24346e77cd2]::result::Result<(), rustc_span[2022bdb1e52fe685]::ErrorGuaranteed>>::{closure#2} as core[719ca24346e77cd2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x7cc8808427bb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8fd56e044d024af5
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/alloc/src/boxed.rs:2022:9
  37:     0x7cc8808427bb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0e2ea69a6bf35e42
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/alloc/src/boxed.rs:2022:9
  38:     0x7cc8808427bb - std::sys::pal::unix::thread::Thread::new::thread_start::h02710c0b1a3f6241
                               at /rustc/9c9b568792ef20d8459c745345dd3e79b7c7fa8c/library/std/src/sys/pal/unix/thread.rs:108:17
  39:     0x7cc87a0a955a - <unknown>
  40:     0x7cc87a126a3c - <unknown>
  41:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

note: please attach the file at `/tmp/im/rustc-ice-2024-05-06T16_12_59-1062772.txt` to your bug report

query stack during panic:
#0 [check_well_formed] checking that `<impl at f.rs:10:1: 10:22>` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

Some errors have detailed explanations: E0275, E0601.
For more information about an error, try `rustc --explain E0275`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-specialization Area: Trait impl specialization C-bug Category: This is a bug. F-rustc_attrs Internal rustc attributes gated on the `#[rustc_attrs]` feature gate. F-specialization `#![feature(specialization)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-internal-features This issue requires the use of internal features S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants