rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

completion failed inside macro call

Open zhongjn opened this issue 4 years ago • 2 comments

RA version: 2021-01-11 (0976a1e)

Dependencies: crossbeam = "0.8.0"

fn main() {
    let (_, r1) = crossbeam::channel::bounded::<()>(1);
    let (_, r2) = crossbeam::channel::bounded::<()>(1);
    crossbeam::select! {
        recv(r1) -> _ => {
            // completion failed here
        },
        recv(r2) -> _ => {
        }
    }
}

image

Besides, it works fine with only one select arm:

fn main() {
    let (_, r1) = crossbeam::channel::bounded::<()>(1);
    let (_, r2) = crossbeam::channel::bounded::<()>(1);
    crossbeam::select! {
        recv(r1) -> _ => {
            // completion works fine
        },
        // recv(r2) -> _ => ()
    }
}

image

I'm new to the macro system, so I didn't find a smaller reproducible example.

zhongjn avatar Jan 17 '21 11:01 zhongjn

Turns out pretty much nothing works inside that macro, not even hover. The macro does get expanded though...

Veykril avatar Jul 24 '21 19:07 Veykril

I'm hitting a very similar issue with tokio::select! in the latest nightly as of this writing, completion works for a little while then grinds to a half, then it refuses to update all diagnostics after some point, and I see a lot of

"diagnostics": [
    {
        "range": {
            "start": {
                "line": 57,
                "character": 30
            },
            "end": {
                "line": 57,
                "character": 32
            }
        },
        "severity": 1,
        "code": "macro-error",
        "codeDescription": {
            "href": "https://rust-analyzer.github.io/manual.html#macro-error"
        },
        "source": "rust-analyzer",
        "message": ""
    },
    {
        "range": {
            "start": {
                "line": 57,
                "character": 30
            },
            "end": {
                "line": 57,
                "character": 32
            }
        },
        "severity": 1,
        "code": "macro-error",
        "codeDescription": {
            "href": "https://rust-analyzer.github.io/manual.html#macro-error"
        },
        "source": "rust-analyzer",
        "message": "reached recursion limit during macro expansion"
    },

in the trace logs

repnop avatar Dec 02 '21 23:12 repnop