-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix [dbg_macro
] FN when dbg
is inside some complex macros
#12151
Conversation
r? @Jarcho (rustbot has picked a reviewer for you, use r? to override) |
Why are we even skipping nested calls in the first place? |
Idk, I guess the initial purpose was to warn the existence of dbg! macro thus linting the first one should suffice? I didn't put that 'span.contains' check at first, instead it was 'macro_span = prev_macro_span', then I saw a lot additional warnings popping up, especially on line 28 of the test file. Should I change it back to lint every nested calls? |
Looks like it was quirk that was kept when switching from an early pass to a late pass. You can change it to lint all nested calls. You'll need to either split the test file in two since uitest only runs rustfix once, so nested macros won't pass testing. actual |
860859c
to
6ef84d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's might be worth keeping track of the most recently seen SyntaxContext
as well. This will let you avoid walking the context chain on for the majority of expression.
247c3f4
to
aa06d41
Compare
All looks good. Thank you. @bors r+ |
fix [`dbg_macro`] FN when `dbg` is inside some complex macros fixes: #12131 It appears that [`root_macro_call_first_node`] only detects `println!` in the following example: ```rust println!("{:?}", dbg!(s)); ``` --- changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
💔 Test failed - checks-action_test |
You'll need to rebase to fix the test. How error patterns need to be placed when macros are used changed. |
d196298
to
b101598
Compare
@@ -49,6 +41,7 @@ fn issue9914() { | |||
macro_rules! expand_to_dbg { | |||
() => { | |||
dbg!(); | |||
//~^ ERROR: the `dbg!` macro is intended as a debugging tool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to put that ERROR comment inside this macro because I don't know where else to put it 😆
@bors r+ |
fix [`dbg_macro`] FN when `dbg` is inside some complex macros fixes: #12131 It appears that [`root_macro_call_first_node`] only detects `println!` in the following example: ```rust println!("{:?}", dbg!(s)); ``` --- changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes by reviewers with write access. |
some refractoring; (rebase): replace `.hir().find_parent` with `.parent_hir_node`; (rebase): move `ERROR` label into the `expand_to_dbg!` macro in test
👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes by reviewers with write access. |
@bors retry |
fix [`dbg_macro`] FN when `dbg` is inside some complex macros fixes: #12131 It appears that [`root_macro_call_first_node`] only detects `println!` in the following example: ```rust println!("{:?}", dbg!(s)); ``` --- changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes by reviewers with write access. |
Looks like rust-lang/homu#75 @bors retry |
fix [`dbg_macro`] FN when `dbg` is inside some complex macros fixes: #12131 It appears that [`root_macro_call_first_node`] only detects `println!` in the following example: ```rust println!("{:?}", dbg!(s)); ``` --- changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes by reviewers with write access. |
Lets see if this works today. @bors retry |
fix [`dbg_macro`] FN when `dbg` is inside some complex macros fixes: #12131 It appears that [`root_macro_call_first_node`] only detects `println!` in the following example: ```rust println!("{:?}", dbg!(s)); ``` --- changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes by reviewers with write access. |
@bors r+ |
💡 This pull request was already approved, no need to approve it again.
|
fix [`dbg_macro`] FN when `dbg` is inside some complex macros fixes: #12131 It appears that [`root_macro_call_first_node`] only detects `println!` in the following example: ```rust println!("{:?}", dbg!(s)); ``` --- changelog: fix [`dbg_macro`] FN when `dbg` is inside some complex macros
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
👀 Test was successful, but fast-forwarding failed: 422 1 review requesting changes by reviewers with write access. |
lol |
@J-ZhengLi can you try reopening this as a new PR? |
sure, that make sense😂 |
fixes: #12131
It appears that [
root_macro_call_first_node
] only detectsprintln!
in the following example:changelog: fix [
dbg_macro
] FN whendbg
is inside some complex macros