question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support cfg features generated by build scripts

See original GitHub issue

Environment

  • IntelliJ Rust plugin version: 0.2.110.5742-193-dev
  • Rust toolchain version: 1.39 stable
  • IDE name and version: IntelliJ IDEA 2019.3 beta 2
  • Operating system: Windows 10 x64

Problem description

Ctrl-clicking function in specific circumstance takes me to wrong function. Experimental macro expansion engine is enabled.

Steps to reproduce

Cargo.toml:

[package]
name = "bug-repro"
version = "0.1.0"
authors = ["Alyosha Vasilieva <1284317+AlyoshaVasilieva@users.noreply.github.com>"]
edition = "2018"

[dependencies]
indexmap = "=1.3.0"
digest = "=0.8.1"

main.rs:

use indexmap::map::IndexMap;

fn main() {
    let mut map = IndexMap::new();
    map.insert("key", "value");
}

IndexMap::new is highlighted as error with “Unresolved reference: `new`”.

Ctrl-clicking IndexMap, despite being highlighted red, correctly takes me to its declaration.

Ctrl-clicking new incorrectly takes me to the new function inside impl<D: Input + FixedOutput + Reset + Clone + Default> Digest for D, part of the digest crate.

Compilation works and gives no warnings or errors.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
Undincommented, Jan 29, 2020

Now there is a way to collect info about generated items including generated cfg option while project refresh action. Under the hood, it uses cargo check so it may significantly increase refresh time (especially, in the first time when it has to compile all dependencies). It’s disabled by default for now. To turn it on, enable org.rust.cargo.evaluate.build.scripts option in Experimental Features dialog. The dialog can be found via Help | Find Action

1reaction
vlad20012commented, Apr 4, 2020

@MSxDOS, please, try the nightly IntelliJ Rust plugin (see instructions), #5186 is included there

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build Scripts - The Cargo Book
Outputs of the Build Script. Build scripts may save any output files or intermediate artifacts in the directory specified in the OUT_DIR environment...
Read more >
Evaluating Build Scripts in the IntelliJ Rust Plugin
Build scripts is a Cargo feature that allows executing any code prior to building a package. We implemented support for build scripts ......
Read more >
Build Scripts - The Cargo Book
Building a bundled C library. Finding a C library on the host system. Generating a Rust module from a specification. Performing any platform-specific ......
Read more >
cfg_rust_features - Rust - Docs.rs
A build-script helper to set cfg options according to probing which features of your choice are enabled in the Rust compiler, language, and...
Read more >
Access Cargo features *inside* the build script - Stack Overflow
... inside the build.rs script as well. So you can use any of the standard ways to check configuration, like the cfg! and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found