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: stack overflow with -Ztyping-mode-borrowck in inference #139446

Open
matthiaskrgr opened this issue Apr 6, 2025 · 0 comments
Open

ICE: stack overflow with -Ztyping-mode-borrowck in inference #139446

matthiaskrgr opened this issue Apr 6, 2025 · 0 comments
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

code:

//@compile-flags: -Ztyping-mode-borrowck

trait T {}

fn wrap(x: impl T) -> impl T {
    //~^ WARN function cannot return without recursing
    wrap(wrap(x))
}

fn main() {}

Version information

rustc 1.88.0-nightly (1de931283 2025-04-06)
binary: rustc
commit-hash: 1de931283df18f3af4922fe9a96adcc8936ac42e
commit-date: 2025-04-06
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Ztyping-mode-borrowck

Program output

warning: function cannot return without recursing
 --> a.rs:5:1
  |
5 | fn wrap(x: impl T) -> impl T {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
6 |     //~^ WARN function cannot return without recursing
7 |     wrap(wrap(x))
  |          ------- recursive call site
  |
  = help: a `loop` may express intention better if this is on purpose
  = note: `#[warn(unconditional_recursion)]` on by default

error: rustc interrupted by SIGSEGV, printing backtrace

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x391999f) [0x7e969231999f]
/usr/lib/libc.so.6(+0x3dcd0) [0x7e968e84bcd0]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x57e0005) [0x7e96941e0005]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x57e00de) [0x7e96941e00de]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x57e00de) [0x7e96941e00de]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMs_NtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB6_9InferCtxt18insert_hidden_type+0x34d) [0x7e9694994b9f]

### cycle encountered after 6 frames with period 12
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95d4a) [0x7e9694995d4a]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95c42) [0x7e9694995c42]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMNtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB4_9InferCtxt18handle_opaque_type+0x87) [0x7e9694995a87]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvXs_NtNtNtCs9vGWXuItzyG_11rustc_infer5infer6relate13type_relatingNtB4_12TypeRelatingINtNtCskmNsZO2KjvA_13rustc_type_ir6relate12TypeRelationNtNtNtCsjT0uPda8Ytm_12rustc_middle2ty7context6TyCtxtE3tys+0x179a) [0x7e9693b51432]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5c4dba9) [0x7e969464dba9]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMs_NtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB6_9InferCtxt18insert_hidden_type+0x21d) [0x7e9694994a6f]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95d4a) [0x7e9694995d4a]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95c42) [0x7e9694995c42]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMNtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB4_9InferCtxt18handle_opaque_type+0x87) [0x7e9694995a87]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvXs_NtNtNtCs9vGWXuItzyG_11rustc_infer5infer6relate13type_relatingNtB4_12TypeRelatingINtNtCskmNsZO2KjvA_13rustc_type_ir6relate12TypeRelationNtNtNtCsjT0uPda8Ytm_12rustc_middle2ty7context6TyCtxtE3tys+0x179a) [0x7e9693b51432]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5c4dba9) [0x7e969464dba9]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMs_NtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB6_9InferCtxt18insert_hidden_type+0x21d) [0x7e9694994a6f]
### recursed 20 times

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95d4a) [0x7e9694995d4a]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95c42) [0x7e9694995c42]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMNtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB4_9InferCtxt18handle_opaque_type+0x87) [0x7e9694995a87]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvXs_NtNtNtCs9vGWXuItzyG_11rustc_infer5infer6relate13type_relatingNtB4_12TypeRelatingINtNtCskmNsZO2KjvA_13rustc_type_ir6relate12TypeRelationNtNtNtCsjT0uPda8Ytm_12rustc_middle2ty7context6TyCtxtE3tys+0x179a) [0x7e9693b51432]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5c4dba9) [0x7e969464dba9]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMs_NtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB6_9InferCtxt18insert_hidden_type+0x21d) [0x7e9694994a6f]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95d4a) [0x7e9694995d4a]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(+0x5f95c42) [0x7e9694995c42]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvMNtNtCs9vGWXuItzyG_11rustc_infer5infer12opaque_typesNtB4_9InferCtxt18handle_opaque_type+0x87) [0x7e9694995a87]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-cf045bbab0bf32f8.so(_RNvXs_NtNtNtCs9vGWXuItzyG_11rustc_infer5infer6relate13type_relatingNtB4_12TypeRelatingINtNtCskmNsZO2KjvA_13rustc_type_ir6relate12TypeRelationNtNtNtCsjT0uPda8Ytm_12rustc_middle2ty7context6TyCtxtE3tys+0x179a) [0x7e9693b51432]

note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
note: backtrace dumped due to SIGSEGV! resuming signal
[1]    2747756 segmentation fault  rustc a.rs -Ztyping-mode-borrowck

@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 Apr 6, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 6, 2025
@matthiaskrgr matthiaskrgr added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Apr 6, 2025
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. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. 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

2 participants