You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The js_sys crate has 2 functions called global: one in the outer scope and one in RegExp. When I try to use the outer one rustc handles it fine, but rust-analyzer consistently gives me docs and type hints for the RegExp one, and sometimes an error because that one takes 1 argument while the outer one takes 0.
This reproduces the problem for me on the latest rust-analyzer release:
The correct function does not have an attribute macro, only the one that wrongly gets resolved does, so shouldn't the problem be the other way around if that is the cause?
The RegExp::global function is declared in an extern block, which is being changed by the proc macro. To RA this looks like an ordinary extern function and since its defined prior to the actual free standing global function I believe that resolution just picks the first function as that's what RA sees first.
The
js_sys
crate has 2 functions calledglobal
: one in the outer scope and one inRegExp
. When I try to use the outer one rustc handles it fine, but rust-analyzer consistently gives me docs and type hints for theRegExp
one, and sometimes an error because that one takes 1 argument while the outer one takes 0.This reproduces the problem for me on the latest rust-analyzer release:
Cargo.toml
main.rs
Incidentally this example also triggers #5412
The text was updated successfully, but these errors were encountered: