From 53f7149d4510137111ed810803e9529157537288 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 7 May 2021 23:35:43 +0300 Subject: internal: expose cfg attrs from hir::Crate --- crates/hir/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/hir/src') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index f876339de..ac23e385e 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -89,6 +89,7 @@ pub use crate::{ // Generally, a refactoring which *removes* a name from this list is a good // idea! pub use { + cfg::{CfgAtom, CfgExpr, CfgOptions}, hir_def::{ adt::StructKind, attr::{Attr, Attrs, AttrsWithOwner, Documentation}, @@ -215,6 +216,10 @@ impl Crate { doc_url.map(|s| s.trim_matches('"').trim_end_matches('/').to_owned() + "/") } + + pub fn cfg(&self, db: &dyn HirDatabase) -> CfgOptions { + db.crate_graph()[self.id].cfg_options.clone() + } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -- cgit v1.2.3