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
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P) rust-analyzer version: 0.4.2159-standalone
editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable) vscode
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
repository link (if public, optional): (eg. rust-analyzer)
code snippet to reproduce:
fnmain(){
hello::world();// E: ^^^^^ no such associated item}structhello{}fnhello(){implhello{pubfnworld(){}}
hello::world();// this is fine.}
I vaguely recall this being deliberate behavior, since r-a is not descending into function definitions to find impl's for use outside of that function, but I can't find an issue for it.
This is minimized from salsa3's salsa::trackedmacro expansion, which creates a struct that is named the same of the function, and defines an impl inside of it. I think salsa can probably move the impl defintion outside of the fn to make rust-analyzer work if this isn't solvable in rust-analyzer.
The text was updated successfully, but these errors were encountered:
This is indeed deliberate, @Veykril said they have no intent of changing this behavior, and salsa should be adapted. There is also a lint (non_local_definitions) in rustc that catch this cases (salsa allows it).
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P) rust-analyzer version: 0.4.2159-standalone
rustc version: (eg. output of
rustc -V
) rustc 1.81.0 (eeb90cda1 2024-09-04)editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable) vscode
relevant settings: (eg. client settings, or environment variables like
CARGO
,RUSTC
,RUSTUP_HOME
orCARGO_HOME
)repository link (if public, optional): (eg. rust-analyzer)
code snippet to reproduce:
I vaguely recall this being deliberate behavior, since r-a is not descending into function definitions to find impl's for use outside of that function, but I can't find an issue for it.
This is minimized from salsa3's
salsa::tracked
macro expansion, which creates a struct that is named the same of the function, and defines animpl
inside of it. I think salsa can probably move the impl defintion outside of the fn to make rust-analyzer work if this isn't solvable in rust-analyzer.The text was updated successfully, but these errors were encountered: