Skip to content

[ICE]: cycle detected when computing function signature / Not enough bound vars: #159892

Description

@matthiaskrgr

Code

#![feature(return_type_notation)]
struct a<const b: usize >;
trait c {
    fn d(&self) -> impl c<d(..): >;
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.99.0-nightly (da86f4d07 2026-07-24)
binary: rustc
commit-hash: da86f4d0726be475afbbffe40cb2f65741c51ad3
commit-date: 2026-07-24
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

Error output

<output>
Backtrace

warning: type `a` should have an upper camel case name
 --> code.rs:2:8
  |
2 | struct a<const b: usize >;
  |        ^ help: convert the identifier to upper camel case: `A`
  |
  = note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default

warning: trait `c` should have an upper camel case name
 --> code.rs:3:7
  |
3 | trait c {
  |       ^ help: convert the identifier to upper camel case (notice the capitalization): `C`

warning: struct `a` is never constructed
 --> code.rs:2:8
  |
2 | struct a<const b: usize >;
  |        ^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: trait `c` is never used
 --> code.rs:3:7
  |
3 | trait c {
  |       ^

warning: const parameter `b` should have an upper case name
 --> code.rs:2:16
  |
2 | struct a<const b: usize >;
  |                ^ help: convert the identifier to upper case: `B`
  |
  = note: `#[warn(non_upper_case_globals)]` (part of `#[warn(nonstandard_style)]`) on by default

warning: 5 warnings 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 `c::d`
 --> code.rs:4:5
  |
4 |     fn d(&self) -> impl c<d(..): >;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: ...which requires looking up late bound vars inside `c::d`...
  = note: ...which requires resolving lifetimes for `c::d`...
  = note: ...which again requires computing function signature of `c::d`, completing the cycle
  = note: cycle used when computing the variances for items in this crate
  = note: for more information, see <https://rustc-dev-guide.rust-lang.org/overview.html#queries> and <https://rustc-dev-guide.rust-lang.org/query.html>
note: delayed at /rustc-dev/da86f4d0726be475afbbffe40cb2f65741c51ad3/compiler/rustc_query_impl/src/job.rs:487:24
         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_impl::query_impl::fn_sig::make_query_vtable::{closure#1} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId, rustc_middle::query::plumbing::Cycle, rustc_errors::diagnostic::Diag)>>::call_once
         5: rustc_query_impl::execution::handle_cycle::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>>
         6: rustc_query_impl::execution::find_and_handle_cycle::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>>
         7: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
         8: rustc_query_impl::query_impl::fn_sig::execute_query_non_incr::__rust_end_short_backtrace
         9: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_path
        10: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext>::visit_poly_trait_ref_inner
        11: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_opaque_ty
        12: <rustc_hir_analysis::collect::resolve_bound_vars::BoundVarContext as rustc_hir::intravisit::Visitor>::visit_trait_item
        13: rustc_query_impl::query_impl::resolve_bound_vars::invoke_provider_fn::__rust_begin_short_backtrace
        14: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_hir_id::OwnerId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        15: rustc_query_impl::query_impl::resolve_bound_vars::execute_query_non_incr::__rust_end_short_backtrace
        16: rustc_query_impl::query_impl::late_bound_vars_map::invoke_provider_fn::__rust_begin_short_backtrace
        17: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_hir_id::OwnerId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        18: rustc_query_impl::query_impl::late_bound_vars_map::execute_query_non_incr::__rust_end_short_backtrace
        19: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty
        20: rustc_hir_analysis::collect::fn_sig
        21: rustc_query_impl::query_impl::fn_sig::invoke_provider_fn::__rust_begin_short_backtrace
        22: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 24]>>, false>
        23: rustc_query_impl::query_impl::fn_sig::execute_query_non_incr::__rust_end_short_backtrace
        24: <rustc_hir_analysis::variance::constraints::ConstraintContext>::build_constraints_for_item
        25: rustc_hir_analysis::variance::crate_variances
        26: rustc_query_impl::query_impl::crate_variances::invoke_provider_fn::__rust_begin_short_backtrace
        27: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
        28: rustc_query_impl::query_impl::crate_variances::execute_query_non_incr::__rust_end_short_backtrace
        29: rustc_query_impl::query_impl::variances_of::invoke_provider_fn::__rust_begin_short_backtrace.warm
        30: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 16]>>, false>
        31: rustc_query_impl::query_impl::variances_of::execute_query_non_incr::__rust_end_short_backtrace
        32: rustc_hir_analysis::check::wfcheck::check_variances_for_type_defn
        33: rustc_hir_analysis::check::check::check_item_type
        34: rustc_hir_analysis::check::wfcheck::check_well_formed
        35: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        36: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        37: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        38: rustc_hir_analysis::check::wfcheck::check_type_wf
        39: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        40: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        41: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        42: rustc_hir_analysis::check_crate
        43: rustc_interface::passes::analysis
        44: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        45: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        46: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}
        47: 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<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        48: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        49: <std::sys::thread::unix::Thread>::new::thread_start
        50: <unknown>
        51: <unknown>

 --> code.rs:4:5
  |
4 |     fn d(&self) -> impl c<d(..): >;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-07-25T10_03_58-2301471.txt` to your bug report

note: rustc 1.99.0-nightly (da86f4d07 2026-07-24) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-return_type_notation`#[feature(return_type_notation)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions