aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/attr.rs3
-rw-r--r--crates/hir_def/src/nameres/tests/diagnostics.rs2
2 files changed, 5 insertions, 0 deletions
diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs
index 68d05c54d..1b9c64ee5 100644
--- a/crates/hir_def/src/attr.rs
+++ b/crates/hir_def/src/attr.rs
@@ -12,6 +12,7 @@ use syntax::{
12 ast::{self, AstNode, AttrsOwner}, 12 ast::{self, AstNode, AttrsOwner},
13 match_ast, AstToken, SmolStr, SyntaxNode, 13 match_ast, AstToken, SmolStr, SyntaxNode,
14}; 14};
15use test_utils::mark;
15use tt::Subtree; 16use tt::Subtree;
16 17
17use crate::{ 18use crate::{
@@ -175,6 +176,8 @@ impl RawAttrs {
175 if cfg_options.check(&cfg) == Some(false) { 176 if cfg_options.check(&cfg) == Some(false) {
176 None 177 None
177 } else { 178 } else {
179 mark::hit!(cfg_attr_active);
180
178 let attr = ast::Attr::parse(&format!("#[{}]", attr)).ok()?; 181 let attr = ast::Attr::parse(&format!("#[{}]", attr)).ok()?;
179 let hygiene = Hygiene::new_unhygienic(); // FIXME 182 let hygiene = Hygiene::new_unhygienic(); // FIXME
180 Attr::from_src(attr, &hygiene) 183 Attr::from_src(attr, &hygiene)
diff --git a/crates/hir_def/src/nameres/tests/diagnostics.rs b/crates/hir_def/src/nameres/tests/diagnostics.rs
index 4093f8bd0..58d69d3c6 100644
--- a/crates/hir_def/src/nameres/tests/diagnostics.rs
+++ b/crates/hir_def/src/nameres/tests/diagnostics.rs
@@ -1,4 +1,5 @@
1use base_db::fixture::WithFixture; 1use base_db::fixture::WithFixture;
2use test_utils::mark;
2 3
3use crate::test_db::TestDB; 4use crate::test_db::TestDB;
4 5
@@ -123,6 +124,7 @@ fn inactive_item() {
123/// Tests that `cfg` attributes behind `cfg_attr` is handled properly. 124/// Tests that `cfg` attributes behind `cfg_attr` is handled properly.
124#[test] 125#[test]
125fn inactive_via_cfg_attr() { 126fn inactive_via_cfg_attr() {
127 mark::check!(cfg_attr_active);
126 check_diagnostics( 128 check_diagnostics(
127 r#" 129 r#"
128 //- /lib.rs 130 //- /lib.rs