Skip to content

ICE: cycle detected when computing function signature #131648

Closed
@matthiaskrgr

Description

@matthiaskrgr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall 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-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions