Skip to content

Regression: could not convert tokens in some macros #17701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rscarson opened this issue Jul 25, 2024 · 5 comments · Fixed by #17741
Closed

Regression: could not convert tokens in some macros #17701

rscarson opened this issue Jul 25, 2024 · 5 comments · Fixed by #17741
Labels
A-macro macro expansion C-bug Category: bug

Comments

@rscarson
Copy link

rscarson commented Jul 25, 2024

rust-analyzer version: v0.3.2045

rustc version: rustc 1.79.0 (129f3b996 2024-06-10)

editor or extension: VSCode

code snippet to reproduce:

extension!(
    init_console,
    deps = [rustyscript],
    esm_entry_point = "ext:init_console/init_console.js",
    esm = [ dir "src/ext/console", "init_console.js" ],
);

image

Upstream issue: denoland/deno_core#844

The macro in question: https://github.com/denoland/deno_core/blob/85b40e5d47e568563957b031b5c3d4673226cc20/core/extensions.rs#L386

@rscarson rscarson added the C-bug Category: bug label Jul 25, 2024
@rscarson rscarson changed the title Regression: ; could not convert tokens in some macros Regression: could not convert tokens in some macros Jul 25, 2024
@Veykril Veykril added the A-macro macro expansion label Jul 25, 2024
@maxdeviant
Copy link

I started seeing this recently (in the last day or so) with the wasmtime::component::bindgen! macro.

I'm seeing it in all usages of the macro in the Zed repo:

https://github.com/zed-industries/zed/blob/fe23504eba5db02f8f5796e0c97cc328794b024f/crates/extension/src/wasm_host/wit/since_v0_0_7.rs#L27-L35

@Veykril
Copy link
Member

Veykril commented Jul 26, 2024

Ugh our () wrapping expressions bites us here, the decl macro chain ends up with us wrapping the file path in () which breaks the builtin include_str parser as it expects a literal

bors added a commit that referenced this issue Jul 26, 2024
fix: Fix includes not working with expr fragment inputs

Temporary workaround for #17701
@Veykril
Copy link
Member

Veykril commented Jul 26, 2024

#17706 should workaround this issue for now

@Veykril Veykril closed this as completed Jul 26, 2024
lnicola pushed a commit to lnicola/rust that referenced this issue Jul 28, 2024
fix: Fix includes not working with expr fragment inputs

Temporary workaround for rust-lang/rust-analyzer#17701
@itowlson
Copy link

itowlson commented Jul 30, 2024

I'm still seeing this in 0.3.2053, even though the changelog says it includes the #17706 fix. I did a full uninstall-reinstall of the VS Code extension and created a fresh project (in case there was some cached state), but still the same error.

(I also tried 0.3.2054, but that only changed the error to "Expected string literal.")

An example that exhibits the error for me is https://github.com/itowlson/ra-macro-errors. The red line shows on the #[http_component] macro on line 5.

Environment: WSL (Ubuntu 22.04)
Cargo/rustc: 1.78.0
Editor: VS Code

Thanks!

@rscarson
Copy link
Author

I am also still seeing this

@Veykril Veykril reopened this Jul 30, 2024
@bors bors closed this as completed in 5b934bd Jul 30, 2024
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 1, 2024
fix: Fix includes not working with expr fragment inputs

Temporary workaround for rust-lang/rust-analyzer#17701
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 1, 2024
fix: Fix builtin includes rejecting raw string literals

Fixes rust-lang/rust-analyzer#17701
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Aug 2, 2024
fix: Fix builtin includes rejecting raw string literals

Fixes rust-lang/rust-analyzer#17701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants