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

macros: Improve IDE support #6968

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clippy fix
nurmohammed840 committed Nov 13, 2024
commit 642b01fafdccb3b69574718ab71db1821938438f
15 changes: 7 additions & 8 deletions tests-build/tests/fail/macros_type_mismatch.stderr
Original file line number Diff line number Diff line change
@@ -33,27 +33,26 @@ help: consider using `Result::expect` to unwrap the `Result<(), _>` value, panic
| +++++++++++++++++

error[E0308]: mismatched types
--> tests/fail/macros_type_mismatch.rs:23:5
--> tests/fail/macros_type_mismatch.rs:15:5
|
14 | async fn extra_semicolon() -> Result<(), ()> {
| -------------- expected `Result<(), ()>` because of return type
...
23 | Ok(());
15 | Ok(());
| ^^^^^^^ expected `Result<(), ()>`, found `()`
|
= note: expected enum `Result<(), ()>`
found unit type `()`
help: try wrapping the expression in a variant of `Result`
|
23 | Ok(Ok(());)
15 | Ok(Ok(());)
| +++ +
23 | Err(Ok(());)
15 | Err(Ok(());)
| ++++ +

error[E0308]: mismatched types
--> tests/fail/macros_type_mismatch.rs:31:5
--> tests/fail/macros_type_mismatch.rs:23:5
|
30 | async fn issue_4635() {
22 | async fn issue_4635() {
| - help: try adding a return type: `-> i32`
31 | return 1;
23 | return 1;
| ^^^^^^^^^ expected `()`, found integer
2 changes: 1 addition & 1 deletion tokio-macros/src/entry.rs
Original file line number Diff line number Diff line change
@@ -414,7 +414,7 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
start = tt.span();
end = tt.span();

while let Some(tt) = stream.next() {
for tt in stream.by_ref() {
match tt {
TokenTree::Punct(p) if p.as_char() == ';' => {
end = p.span();