forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#137415 - chenyukang:yukang-fix-137345-inval…
…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?
- Loading branch information
Showing
4 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
extern crate proc_macro; | ||
use proc_macro::TokenStream; | ||
|
||
fn items() -> impl IntoIterator<Item = i32> { | ||
vec![1, 2, 3] | ||
} | ||
|
||
#[macro_export] | ||
macro_rules! quote { | ||
// Rule for any other number of tokens. | ||
($($tt:tt)*) => {{ | ||
fn items() -> impl IntoIterator<Item = i32> { | ||
vec![1, 2, 3] | ||
} | ||
let _s = TokenStream::new(); | ||
let other_items = items().map(|i| i + 1); | ||
_s | ||
}}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//@ aux-crate: quote=quote-issue-137345.rs | ||
|
||
extern crate proc_macro; | ||
extern crate quote; | ||
|
||
use proc_macro::TokenStream; | ||
|
||
pub fn default_args_fn(_: TokenStream) -> TokenStream { | ||
let decl_macro = TokenStream::new(); | ||
|
||
quote::quote! { | ||
#(#decl_macro)* | ||
} | ||
.into() //~^^^ ERROR no method named `map` found for opaque type | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0599]: no method named `map` found for opaque type `impl IntoIterator<Item = i32>` in the current scope | ||
--> $DIR/valid-sugg-issue-137345.rs:11:5 | ||
| | ||
LL | / quote::quote! { | ||
LL | | #(#decl_macro)* | ||
LL | | } | ||
| |_____^ `impl IntoIterator<Item = i32>` is not an iterator | ||
| | ||
= note: this error originates in the macro `quote::quote` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |