Rust-analyzer: Support cfg_attr

Created on 27 Jul 2020  路  3Comments  路  Source: rust-analyzer/rust-analyzer

It seems the following is currently not supported:

#[cfg_attr(target_os = "windows", path = "os_windows.rs)]
mod os;

I've had to do the following:

#[cfg(target_os = "windows")]
mod os_windows;
#[cfg(target_os = "windows")]
use os_windows as os;
S-actionable

Most helpful comment

I've now added cfg_attr support. The code in the original report should now work fine, but there are still some parts of r-a that use syntactical attributes, so they don't handle cfg_attr.

All 3 comments

The following is not highlighted as code in the doc string

    #[cfg_attr(feature = "ci-headless", doc = "```no_run")]
    #[cfg_attr(not(feature = "ci-headless"), doc = "```")]
    /// Code goes here...
    /// ```

Not sure if only because of the missing cfg_attr support, or if there are other factors too.

I've now added cfg_attr support. The code in the original report should now work fine, but there are still some parts of r-a that use syntactical attributes, so they don't handle cfg_attr.

cc #5016

Was this page helpful?
0 / 5 - 0 ratings