Skip to content

Circular associated types using Self: "index out of bounds: the len is 1 but the index is 1" #10679

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

Closed
weswigham opened this issue Nov 2, 2021 · 2 comments
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug I-panic

Comments

@weswigham
Copy link

#10286 has been closed, but a somewhat similar issue is happening to me. Here's as small as I could make my repro: https://github.com/weswigham/rust-analyzer-crash

Here's what it reports in the output log in vscode:

[Error - 4:51:45 AM] Request textDocument/hover failed.
  Message: server panicked: index out of bounds: the len is 1 but the index is 1
  Code: -32603 
Panic context:
> 
version: 04f03a360 2021-11-02 nightly
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/d%3A/Github/test_rust/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 35,
            character: 85,
        },
        end: Position {
            line: 35,
            character: 92,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', C:\Users\runneradmin\.cargo\registry\src\gb.xjqchip.workers.dev-1ecc6299db9ec823\chalk-ir-0.72.0\src\lib.rs:2753:10
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', C:\Users\runneradmin\.cargo\registry\src\gb.xjqchip.workers.dev-1ecc6299db9ec823\chalk-ir-0.72.0\src\lib.rs:2753:10
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', C:\Users\runneradmin\.cargo\registry\src\gb.xjqchip.workers.dev-1ecc6299db9ec823\chalk-ir-0.72.0\src\lib.rs:2753:10
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 04f03a360 2021-11-02 nightly
request: rust-analyzer/inlayHints InlayHintsParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/d%3A/Github/test_rust/src/main.rs",
            query: None,
            fragment: None,
        },
    },
}

thread '<unnamed>' panicked at 'index out of bounds: the len is 1 but the index is 1', C:\Users\runneradmin\.cargo\registry\src\gb.xjqchip.workers.dev-1ecc6299db9ec823\chalk-ir-0.72.0\src\lib.rs:2753:10
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

It seems to need both the circularly referential associated types (as shown by the GetOnChangeSystem and OnChangeEvent traits), and a generic usage of those traits (as in the write method of the Command impl. If either are removed, rust-analyzer stops crashing.

@lnicola
Copy link
Member

lnicola commented Mar 8, 2022

@weswigham can you still reproduce this? I can't using your sample code.

@Veykril Veykril added A-ty type system / type inference / traits / method resolution C-bug Category: bug I-panic labels Jan 19, 2023
@Veykril
Copy link
Member

Veykril commented Jan 19, 2023

Assuming this is fixed then

@Veykril Veykril closed this as completed Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug I-panic
Projects
None yet
Development

No branches or pull requests

5 participants