Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/item_tree/pretty.rs')
-rw-r--r--crates/hir-def/src/item_tree/pretty.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/hir-def/src/item_tree/pretty.rs b/crates/hir-def/src/item_tree/pretty.rs
index 66a2d14a73..c89299e6d8 100644
--- a/crates/hir-def/src/item_tree/pretty.rs
+++ b/crates/hir-def/src/item_tree/pretty.rs
@@ -86,9 +86,9 @@ impl Printer<'_> {
}
fn print_attrs(&mut self, attrs: &AttrsOrCfg, inner: bool, separated_by: &str) {
- let AttrsOrCfg::Enabled { attrs } = attrs else {
- w!(self, "#[cfg(false)]{separated_by}");
- return;
+ let (cfg_disabled_expr, attrs) = match attrs {
+ AttrsOrCfg::Enabled { attrs } => (None, attrs),
+ AttrsOrCfg::CfgDisabled(inner_box) => (Some(&inner_box.0), &inner_box.1),
};
let inner = if inner { "!" } else { "" };
for attr in &*attrs.as_ref() {
@@ -101,6 +101,9 @@ impl Printer<'_> {
separated_by,
);
}
+ if let Some(expr) = cfg_disabled_expr {
+ w!(self, "#{inner}[cfg({expr})]{separated_by}");
+ }
}
fn print_attrs_of(&mut self, of: ModItemId, separated_by: &str) {