Skip to content

OOB index in async fn evades linter #112850

Open
@fuse117

Description

@fuse117

I am hitting index out of bounds panics when indexing into arrays in macros inside aync functions. An example is the following.

async fn foo() {
    let x: [u8; 1] = [0];
    rprintln!("{:x} {:x}", x[0], x[1]);
}
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', src/main.rs:18:34

This playground showcases the issue. The actual macro I am using is rprintln from rtt-target

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.P-lowLow priority

    Type

    No type

    Projects

    Status

    In Progress (long term)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions