1
Fork 0

Adjust pretty-print compat hack to work with item statements

This commit is contained in:
Aaron Hill 2020-11-25 11:31:22 -05:00
parent 9c9f40656d
commit baefba80b7
No known key found for this signature in database
GPG key ID: B4087E510E98B164

View file

@ -785,7 +785,15 @@ impl Nonterminal {
/// See issue #73345 for more details.
/// FIXME(#73933): Remove this eventually.
pub fn pretty_printing_compatibility_hack(&self) -> bool {
if let NtItem(item) = self {
let item = match self {
NtItem(item) => item,
NtStmt(stmt) => match &stmt.kind {
ast::StmtKind::Item(item) => item,
_ => return false,
},
_ => return false,
};
let name = item.ident.name;
if name == sym::ProceduralMasqueradeDummyType || name == sym::ProcMacroHack {
if let ast::ItemKind::Enum(enum_def, _) = &item.kind {
@ -794,7 +802,6 @@ impl Nonterminal {
}
}
}
}
false
}