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: cycle detected when computing function signature #131648

Closed
matthiaskrgr opened this issue Oct 13, 2024 · 2 comments
Closed

ICE: cycle detected when computing function signature #131648

matthiaskrgr opened this issue Oct 13, 2024 · 2 comments
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-return_type_notation `#[feature(return_type_notation)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#![feature(return_type_notation)]

trait IntFactory {
    fn stream(self) -> impl IntFactory<stream(..): Send>;
}

fn main() {}

original:

#![feature(return_type_notation)]

trait IntFactory {
    fn stream(self) -> impl IntFactory<stream(..): Send>;
}
trait SendIntFactory: IntFactory<stream(..): Send> + Send {}

fn main() {}

Version information

rustc 1.83.0-nightly (ecf2d1fa4 2024-10-13)
binary: rustc
commit-hash: ecf2d1fa4bd8166c696883b10f483122b1fe98a3
commit-date: 2024-10-13
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: trait `IntFactory` is never used
 --> /tmp/icemaker_global_tempdir.Y5oQaABbYFFD/rustc_testrunner_tmpdir_reporting.Lfitn4m1Yb8Y/mvce.rs:3:7
  |
3 | trait IntFactory {
  |       ^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error[E0391]: cycle detected when computing function signature of `IntFactory::stream`
 --> /tmp/icemaker_global_tempdir.Y5oQaABbYFFD/rustc_testrunner_tmpdir_reporting.Lfitn4m1Yb8Y/mvce.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: ...which requires looking up late bound vars inside `IntFactory::stream`...
 --> /tmp/icemaker_global_tempdir.Y5oQaABbYFFD/rustc_testrunner_tmpdir_reporting.Lfitn4m1Yb8Y/mvce.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires resolving lifetimes for `IntFactory::stream`...
 --> /tmp/icemaker_global_tempdir.Y5oQaABbYFFD/rustc_testrunner_tmpdir_reporting.Lfitn4m1Yb8Y/mvce.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: ...which again requires computing function signature of `IntFactory::stream`, completing the cycle
note: cycle used when checking that `IntFactory` is well-formed
 --> /tmp/icemaker_global_tempdir.Y5oQaABbYFFD/rustc_testrunner_tmpdir_reporting.Lfitn4m1Yb8Y/mvce.rs:3:1
  |
3 | trait IntFactory {
  | ^^^^^^^^^^^^^^^^
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
note: delayed at compiler/rustc_query_system/src/query/job.rs:596:16 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.Y5oQaABbYFFD/rustc_testrunner_tmpdir_reporting.Lfitn4m1Yb8Y/mvce.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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: please make sure that you have updated to the latest nightly

note: rustc 1.83.0-nightly (ecf2d1fa4 2024-10-13) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

@rustbot label +F-return_type_notation

@matthiaskrgr matthiaskrgr 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 Oct 13, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-return_type_notation `#[feature(return_type_notation)]` labels Oct 13, 2024
@matthiaskrgr
Copy link
Member Author

error: internal compiler error[E0391]: cycle detected when computing function signature of `IntFactory::stream`
 --> f.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: ...which requires looking up late bound vars inside `IntFactory::stream`...
 --> f.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires resolving lifetimes for `IntFactory::stream`...
 --> f.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: ...which again requires computing function signature of `IntFactory::stream`, completing the cycle
note: cycle used when checking that `IntFactory` is well-formed
 --> f.rs:3:1
  |
3 | trait IntFactory {
  | ^^^^^^^^^^^^^^^^
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
note: delayed at compiler/rustc_query_system/src/query/job.rs:596:16
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::diagnostic::Diag>::delay_as_bug
         4: rustc_query_system::query::plumbing::mk_cycle::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
         5: rustc_query_system::query::plumbing::cycle_error::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
         6: rustc_query_impl::query_impl::fn_sig::get_query_non_incr::__rust_end_short_backtrace
         7: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>>
         8: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_path
         9: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext>::visit_poly_trait_ref_inner
        10: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_opaque_ty
        11: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_ty
        12: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_trait_item
        13: rustc_hir_analysis::collect::resolve_bound_vars::resolve_bound_vars
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::resolve_bound_vars::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        16: rustc_query_impl::query_impl::resolve_bound_vars::get_query_non_incr::__rust_end_short_backtrace
        17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::late_bound_vars_map::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        19: rustc_query_impl::query_impl::late_bound_vars_map::get_query_non_incr::__rust_end_short_backtrace
        20: <rustc_middle::ty::context::TyCtxt>::late_bound_vars
        21: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
        22: rustc_hir_analysis::collect::fn_sig
        23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::fn_sig::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
        24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        25: rustc_query_impl::query_impl::fn_sig::get_query_non_incr::__rust_end_short_backtrace
        26: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>>
        27: rustc_hir_analysis::check::check::check_item_type
        28: rustc_hir_analysis::check::wfcheck::check_well_formed
        29: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        31: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
        32: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
        33: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        35: rustc_query_impl::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
        36: rustc_hir_analysis::check_crate
        37: rustc_interface::passes::run_required_analyses
        38: rustc_interface::passes::analysis
        39: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        41: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        42: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        43: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        44: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        45: std::sys::pal::unix::thread::Thread::new::thread_start
        46: <unknown>
        47: <unknown>
 --> f.rs:4:5
  |
4 |     fn stream(self) -> impl IntFactory<stream(..): Send>;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/rustc-ice-2024-10-13T12_34_05-2779095.txt` to your bug report

query stack during panic:
end of query stack

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 15, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Oct 20, 2024
@matthiaskrgr matthiaskrgr added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 31, 2024
@compiler-errors
Copy link
Member

This is just tests/ui/associated-type-bounds/return-type-notation/impl-trait-in-trait.stderr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-return_type_notation `#[feature(return_type_notation)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants