Adjust pretty-print compat hack to work with item statements
This commit is contained in:
parent
9c9f40656d
commit
baefba80b7
1 changed files with 14 additions and 7 deletions
|
@ -785,13 +785,20 @@ impl Nonterminal {
|
||||||
/// See issue #73345 for more details.
|
/// See issue #73345 for more details.
|
||||||
/// FIXME(#73933): Remove this eventually.
|
/// FIXME(#73933): Remove this eventually.
|
||||||
pub fn pretty_printing_compatibility_hack(&self) -> bool {
|
pub fn pretty_printing_compatibility_hack(&self) -> bool {
|
||||||
if let NtItem(item) = self {
|
let item = match self {
|
||||||
let name = item.ident.name;
|
NtItem(item) => item,
|
||||||
if name == sym::ProceduralMasqueradeDummyType || name == sym::ProcMacroHack {
|
NtStmt(stmt) => match &stmt.kind {
|
||||||
if let ast::ItemKind::Enum(enum_def, _) = &item.kind {
|
ast::StmtKind::Item(item) => item,
|
||||||
if let [variant] = &*enum_def.variants {
|
_ => return false,
|
||||||
return variant.ident.name == sym::Input;
|
},
|
||||||
}
|
_ => return false,
|
||||||
|
};
|
||||||
|
|
||||||
|
let name = item.ident.name;
|
||||||
|
if name == sym::ProceduralMasqueradeDummyType || name == sym::ProcMacroHack {
|
||||||
|
if let ast::ItemKind::Enum(enum_def, _) = &item.kind {
|
||||||
|
if let [variant] = &*enum_def.variants {
|
||||||
|
return variant.ident.name == sym::Input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue