Skip to content

cfg_attr falsely evaluated? #13019

@9SMTM6

Description

@9SMTM6

I may be a bit out of my dept, this is my interpretation.

But to me it seems like RA doesnt handle cfg_attr correctly, specifically I'm getting errors about using a nightly feature (the feature flag attribute:-)) in RA, when running cargo build doesnt fail.

I was able to observe this on Windows, with both the 1.63 and 1.62 toolchain, specifically when trying out uniffi_build.

It is reproducible just by following the tutorial until you use uniffi_build, and I get an error from the transitive anyhow dependency in the RA LSP log from VSCode:

[ERROR rust_analyzer::lsp_utils] failed to run build scripts

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> C:\Users\<USER>\.cargo\registry\src\github.com-1ecc6299db9ec823\anyhow-1.0.61\src\lib.rs:214:32
    |
214 | #![cfg_attr(backtrace, feature(backtrace))]
    |                                ^^^^^^^^^

From my cursory browsing the backtrace feature should not be enabled in anyhow, it should be disabled by default and uniffi_build doesnt enable it.

As I said, running cargo build runs the build-script just fine.

rust-analyzer version: 0.3.1162-standalone (634cfe3 2022-08-07)

rustc version: both 1.63 and 1.62 tested

relevant settings: -

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions