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.

Name resolution and completion don't work with async_std/tokio/reqwest crates

See original GitHub issue

Environment

  • IntelliJ Rust plugin version: 0.2.109.2149-192
  • Rust toolchain version: 1.39.0
  • IDE name and version: Clion 2019.2.1
  • Operating system: Ubuntu 19.10

Problem description

#[cfg(feature = "...")] in macros could not be found.

https://github.com/async-rs/async-std/blob/f611ceccc87aaf6b6cfb5bdee8bfffaffee5498f/src/utils.rs#L134-L144 https://github.com/async-rs/async-std/blob/f611ceccc87aaf6b6cfb5bdee8bfffaffee5498f/src/lib.rs#L203-L211

/// Declares std items.
#[allow(unused_macros)]
#[doc(hidden)]
macro_rules! cfg_std {
    ($($item:item)*) => {
        $(
            #[cfg(feature = "std")]
            $item
        )*
    }
}

cfg_std! {
    // ...
    pub mod task;
}

Steps to reproduce

The plugin cannot find the declaration of block_on to go. But it cound find after changing cfg_std! { pub mod task;} to #[cfg(feature = "std")]pub mod task; .

use async_std::task;

fn main() {
    task::block_on(async {
        println!("Hello, world!");
    })
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:28
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
Undincommented, Feb 7, 2020

It’s fixed in #4914 and will be landed in the next release (I hope). Note, intellisense features (name resolution, completion, etc) should work correctly only with new experimental macro expansion engine (see #3628). So, let’s keep this issue open until new macro expansion engine is enabled by default

9reactions
vlad20012commented, Nov 16, 2019

The issue has been known for a long time. The new macro expansion engine (#3628) doesn’t solve it for now. Recently we discussed some possible solutions, so I’ll try to prototype something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using async-std (was reqwest) - #20 by Rustafarian - help - The ...
I am trying to use the simple example in reqwest but had run into a "dogs dinner" ... feature where the library name...
Read more >
Rust JNI async callback with Tokio and Reqwest for Android
I want to do execute requests in Rust and return the result to Android asynchronously with callback. I'm testing code to execute the...
Read more >
Request coalescing in async Rust - fasterthanli.me
A simple web server; The case for async; Enter tokio ... to use netcat to open a TCP connection to our server, send...
Read more >
reqwest - crates.io: Rust Package Registry
An ergonomic, batteries-included HTTP Client for Rust. Plain bodies, JSON, urlencoded, multipart; Customizable redirect policy; HTTP Proxies ...
Read more >
thirtyfour 0.27.2 - Docs.rs
... should work. Async only ( tokio and async-std runtimes supported via feature flags). For synchronous support, use the thirtyfour_sync crate instead.
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