Skip to content
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

invalid suggestion to add .into_iter() into the source code of quote #137345

Closed
cyrgani opened this issue Feb 20, 2025 · 0 comments · Fixed by #137415
Closed

invalid suggestion to add .into_iter() into the source code of quote #137345

cyrgani opened this issue Feb 20, 2025 · 0 comments · Fixed by #137415
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cyrgani
Copy link
Contributor

cyrgani commented Feb 20, 2025

Code

use proc_macro::TokenStream;

#[proc_macro]
pub fn default_args_fn(_: TokenStream) -> TokenStream {
    let decl_macro = TokenStream::new();

    quote::quote! {
        #(#decl_macro)*
    }
    .into()
}

Current output

error[E0599]: no method named `quote_into_iter` found for struct `proc_macro::TokenStream` in the current scope
 --> src/lib.rs:7:5
  |
7 | /     quote::quote! {
8 | |         #(#decl_macro)*
9 | |     }
  | |_____^ `proc_macro::TokenStream` is not an iterator
  |
  = note: this error originates in the macro `$crate::quote_bind_into_iter` which comes from the expansion of the macro `quote::quote` (in Nightly builds, run with -Z macro-backtrace for more info)
help: call `.into_iter()` first
 --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/quote-1.0.38/src/lib.rs:744:34
  |
74|         let (mut $var, i) = $var.into_iter().quote_into_iter();
  |                                  ++++++++++++

For more information about this error, try `rustc --explain E0599`.

Desired output

editing foreign code should not be suggested

Rationale and extra context

No response

Other cases

Rust Version

rustc 1.87.0-nightly (f280acf4c 2025-02-19)
binary: rustc
commit-hash: f280acf4c743806abbbbcfe65050ac52ec4bdec0
commit-date: 2025-02-19
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

Anything else?

No response

@cyrgani cyrgani added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 20, 2025
@chenyukang chenyukang self-assigned this Feb 22, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 22, 2025
…id-sugg, r=estebank

Remove invalid suggestion of into_iter for extern macro

Fixes rust-lang#137345

rust-lang#109082 is closed due to performance issue, do we have any other solution for this kind of issue?
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 22, 2025
…id-sugg, r=estebank

Remove invalid suggestion of into_iter for extern macro

Fixes rust-lang#137345

rust-lang#109082 is closed due to performance issue, do we have any other solution for this kind of issue?
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 22, 2025
…id-sugg, r=estebank

Remove invalid suggestion of into_iter for extern macro

Fixes rust-lang#137345

rust-lang#109082 is closed due to performance issue, do we have any other solution for this kind of issue?
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 22, 2025
…id-sugg, r=estebank

Remove invalid suggestion of into_iter for extern macro

Fixes rust-lang#137345

rust-lang#109082 is closed due to performance issue, do we have any other solution for this kind of issue?
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 23, 2025
Rollup merge of rust-lang#137415 - chenyukang:yukang-fix-137345-invalid-sugg, r=estebank

Remove invalid suggestion of into_iter for extern macro

Fixes rust-lang#137345

rust-lang#109082 is closed due to performance issue, do we have any other solution for this kind of issue?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants