Auto merge of #107254 - chenyukang:yukang/fix-107113-wrong-sugg-in-macro, r=estebank
Avoid wrong code suggesting for attribute macro Fixes #107113 r? `@estebank`
This commit is contained in:
commit
736ef39a84
9 changed files with 85 additions and 5 deletions
|
@ -449,7 +449,11 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
|
|||
match expn_data.kind {
|
||||
ExpnKind::Root
|
||||
| ExpnKind::Desugaring(
|
||||
DesugaringKind::ForLoop | DesugaringKind::WhileLoop | DesugaringKind::OpaqueTy,
|
||||
DesugaringKind::ForLoop
|
||||
| DesugaringKind::WhileLoop
|
||||
| DesugaringKind::OpaqueTy
|
||||
| DesugaringKind::Async
|
||||
| DesugaringKind::Await,
|
||||
) => false,
|
||||
ExpnKind::AstPass(_) | ExpnKind::Desugaring(_) => true, // well, it's "external"
|
||||
ExpnKind::Macro(MacroKind::Bang, _) => {
|
||||
|
@ -459,3 +463,12 @@ pub fn in_external_macro(sess: &Session, span: Span) -> bool {
|
|||
ExpnKind::Macro { .. } => true, // definitely a plugin
|
||||
}
|
||||
}
|
||||
|
||||
/// Return whether `span` is generated by `async` or `await`.
|
||||
pub fn is_from_async_await(span: Span) -> bool {
|
||||
let expn_data = span.ctxt().outer_expn_data();
|
||||
match expn_data.kind {
|
||||
ExpnKind::Desugaring(DesugaringKind::Async | DesugaringKind::Await) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue