Skip to content

"Run Doctest" lens shows up on compile_fail tests #19103

@PRO-2684

Description

@PRO-2684

rust-analyzer version: 0.3.2291-standalone

rustc version: 1.83.0 (90b35a623 2024-11-26)

editor or extension: VSCode, r-a v0.3.2291

relevant settings: N/A

repository link (if public, optional): https://github.com/PRO-2684/rust-test/blob/36aed888c00cf79c7497ef99f93b0fdd192c4a93/src/lib.rs#L1-L12

code snippet to reproduce:

Clone the repo and navigate to src/lib.rs. You should see a "Run Doctest" button before the following code:

/// ```rust compile_fail
/// let x = 5;
/// x += 1;
/// ```
///
/// ```rust
/// let x = 5;
/// x + 1;
/// ```
pub fn add(left: u64, right: u64) -> u64 {
    left + right
}

"Run Doctest" button

Click it and see how r-a reports error in src/lib.rs:

r-a reported error

Notice that although cargo test exited successfully, the spawned shell also reported error (I'm not sure whether it is r-a's issue):

spawned shell error

Metadata

Metadata

Labels

A-idegeneral IDE featuresC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions