Repository: rust
Issue: ICE: `cycle detected when computing function signature`
Labels: I-ICE,E-needs-test,T-compiler,C-bug,S-bug-has-test,F-return_type_notation

<!--
[31mICE[0m: Rustc ./a.rs '' 'error: internal compiler error[E0391]: cycle detected when computing function signature of `IntFactory::stream`', 'error: internal compiler error[E0391]: cycle detected when computing function signature of `IntFactory::stream`'
File: /tmp/im/a.rs
-->

auto-reduced (treereduce-rust):
````rust
#![feature(return_type_notation)]

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

fn main() {}


````

original:
````rust
#![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 `

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Program output</strong></summary>
<p>

```
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

```

</p>
</details>

<!--
query stack:

-->
@rustbot label +F-return_type_notation