-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #107254 - chenyukang:yukang/fix-107113-wrong-sugg-in-ma…
…cro, r=estebank Avoid wrong code suggesting for attribute macro Fixes #107113 r? `@estebank`
- Loading branch information
Showing
9 changed files
with
85 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
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,13 @@ | ||
// run-rustfix | ||
// edition:2018 | ||
fn _consume_reference<T: ?Sized>(_: &T) {} | ||
|
||
async fn _foo() { | ||
_consume_reference::<i32>(&Box::new(7_i32)); | ||
_consume_reference::<i32>(&*async { Box::new(7_i32) }.await); | ||
//~^ ERROR mismatched types | ||
_consume_reference::<[i32]>(&vec![7_i32]); | ||
_consume_reference::<[i32]>(&async { vec![7_i32] }.await); | ||
} | ||
|
||
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// check-fail | ||
// run-rustfix | ||
// edition:2018 | ||
fn _consume_reference<T: ?Sized>(_: &T) {} | ||
|
||
|
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,13 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::TokenStream; | ||
|
||
#[proc_macro_attribute] | ||
pub fn main(_: TokenStream, item: TokenStream) -> TokenStream { | ||
"fn main() -> std::io::Result<()> { () } ".parse().unwrap() | ||
} |
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,8 @@ | ||
// edition:2021 | ||
// aux-build:issue-107113.rs | ||
|
||
#[macro_use] | ||
extern crate issue_107113; | ||
|
||
#[issue_107113::main] //~ ERROR mismatched types [E0308] | ||
async fn main() -> std::io::Result<()> {} |
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,16 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-107113-wrap.rs:7:1 | ||
| | ||
LL | #[issue_107113::main] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| expected `Result<(), Error>`, found `()` | ||
| expected `Result<(), std::io::Error>` because of return type | ||
| | ||
= note: expected enum `Result<(), std::io::Error>` | ||
found unit type `()` | ||
= note: this error originates in the attribute macro `issue_107113::main` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |