From 68c223872562a8d746d4f1045d508887a0cbca5e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 13 Aug 2020 10:19:09 +0200 Subject: Rename ra_cfg -> cfg --- crates/cfg/Cargo.toml | 18 ++++ crates/cfg/src/cfg_expr.rs | 133 ++++++++++++++++++++++++++ crates/cfg/src/lib.rs | 51 ++++++++++ crates/ra_cfg/Cargo.toml | 18 ---- crates/ra_cfg/src/cfg_expr.rs | 133 -------------------------- crates/ra_cfg/src/lib.rs | 51 ---------- crates/ra_db/Cargo.toml | 2 +- crates/ra_db/src/fixture.rs | 2 +- crates/ra_db/src/input.rs | 2 +- crates/ra_hir_def/Cargo.toml | 2 +- crates/ra_hir_def/src/adt.rs | 2 +- crates/ra_hir_def/src/attr.rs | 2 +- crates/ra_hir_def/src/body.rs | 2 +- crates/ra_hir_def/src/nameres/collector.rs | 2 +- crates/ra_ide/Cargo.toml | 2 +- crates/ra_ide/src/lib.rs | 2 +- crates/ra_ide/src/mock_analysis.rs | 2 +- crates/ra_ide/src/parent_module.rs | 2 +- crates/ra_ide/src/runnables.rs | 2 +- crates/ra_project_model/Cargo.toml | 2 +- crates/ra_project_model/src/cfg_flag.rs | 2 +- crates/ra_project_model/src/lib.rs | 2 +- crates/rust-analyzer/Cargo.toml | 2 +- crates/rust-analyzer/src/cargo_target_spec.rs | 4 +- 24 files changed, 221 insertions(+), 221 deletions(-) create mode 100644 crates/cfg/Cargo.toml create mode 100644 crates/cfg/src/cfg_expr.rs create mode 100644 crates/cfg/src/lib.rs delete mode 100644 crates/ra_cfg/Cargo.toml delete mode 100644 crates/ra_cfg/src/cfg_expr.rs delete mode 100644 crates/ra_cfg/src/lib.rs (limited to 'crates') diff --git a/crates/cfg/Cargo.toml b/crates/cfg/Cargo.toml new file mode 100644 index 000000000..d2ea551d1 --- /dev/null +++ b/crates/cfg/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "cfg" +version = "0.0.0" +license = "MIT OR Apache-2.0" +authors = ["rust-analyzer developers"] +edition = "2018" + +[lib] +doctest = false + +[dependencies] +rustc-hash = "1.1.0" + +tt = { path = "../tt" } + +[dev-dependencies] +mbe = { path = "../mbe" } +syntax = { path = "../syntax" } diff --git a/crates/cfg/src/cfg_expr.rs b/crates/cfg/src/cfg_expr.rs new file mode 100644 index 000000000..336fe25bc --- /dev/null +++ b/crates/cfg/src/cfg_expr.rs @@ -0,0 +1,133 @@ +//! The condition expression used in `#[cfg(..)]` attributes. +//! +//! See: https://doc.rust-lang.org/reference/conditional-compilation.html#conditional-compilation + +use std::slice::Iter as SliceIter; + +use tt::SmolStr; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum CfgExpr { + Invalid, + Atom(SmolStr), + KeyValue { key: SmolStr, value: SmolStr }, + All(Vec), + Any(Vec), + Not(Box), +} + +impl CfgExpr { + pub fn parse(tt: &tt::Subtree) -> CfgExpr { + next_cfg_expr(&mut tt.token_trees.iter()).unwrap_or(CfgExpr::Invalid) + } + /// Fold the cfg by querying all basic `Atom` and `KeyValue` predicates. + pub fn fold(&self, query: &dyn Fn(&SmolStr, Option<&SmolStr>) -> bool) -> Option { + match self { + CfgExpr::Invalid => None, + CfgExpr::Atom(name) => Some(query(name, None)), + CfgExpr::KeyValue { key, value } => Some(query(key, Some(value))), + CfgExpr::All(preds) => { + preds.iter().try_fold(true, |s, pred| Some(s && pred.fold(query)?)) + } + CfgExpr::Any(preds) => { + preds.iter().try_fold(false, |s, pred| Some(s || pred.fold(query)?)) + } + CfgExpr::Not(pred) => pred.fold(query).map(|s| !s), + } + } +} + +fn next_cfg_expr(it: &mut SliceIter) -> Option { + let name = match it.next() { + None => return None, + Some(tt::TokenTree::Leaf(tt::Leaf::Ident(ident))) => ident.text.clone(), + Some(_) => return Some(CfgExpr::Invalid), + }; + + // Peek + let ret = match it.as_slice().first() { + Some(tt::TokenTree::Leaf(tt::Leaf::Punct(punct))) if punct.char == '=' => { + match it.as_slice().get(1) { + Some(tt::TokenTree::Leaf(tt::Leaf::Literal(literal))) => { + it.next(); + it.next(); + // FIXME: escape? raw string? + let value = + SmolStr::new(literal.text.trim_start_matches('"').trim_end_matches('"')); + CfgExpr::KeyValue { key: name, value } + } + _ => return Some(CfgExpr::Invalid), + } + } + Some(tt::TokenTree::Subtree(subtree)) => { + it.next(); + let mut sub_it = subtree.token_trees.iter(); + let mut subs = std::iter::from_fn(|| next_cfg_expr(&mut sub_it)).collect(); + match name.as_str() { + "all" => CfgExpr::All(subs), + "any" => CfgExpr::Any(subs), + "not" => CfgExpr::Not(Box::new(subs.pop().unwrap_or(CfgExpr::Invalid))), + _ => CfgExpr::Invalid, + } + } + _ => CfgExpr::Atom(name), + }; + + // Eat comma separator + if let Some(tt::TokenTree::Leaf(tt::Leaf::Punct(punct))) = it.as_slice().first() { + if punct.char == ',' { + it.next(); + } + } + Some(ret) +} + +#[cfg(test)] +mod tests { + use super::*; + + use mbe::ast_to_token_tree; + use syntax::ast::{self, AstNode}; + + fn assert_parse_result(input: &str, expected: CfgExpr) { + let (tt, _) = { + let source_file = ast::SourceFile::parse(input).ok().unwrap(); + let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap(); + ast_to_token_tree(&tt).unwrap() + }; + let cfg = CfgExpr::parse(&tt); + assert_eq!(cfg, expected); + } + + #[test] + fn test_cfg_expr_parser() { + assert_parse_result("#![cfg(foo)]", CfgExpr::Atom("foo".into())); + assert_parse_result("#![cfg(foo,)]", CfgExpr::Atom("foo".into())); + assert_parse_result( + "#![cfg(not(foo))]", + CfgExpr::Not(Box::new(CfgExpr::Atom("foo".into()))), + ); + assert_parse_result("#![cfg(foo(bar))]", CfgExpr::Invalid); + + // Only take the first + assert_parse_result(r#"#![cfg(foo, bar = "baz")]"#, CfgExpr::Atom("foo".into())); + + assert_parse_result( + r#"#![cfg(all(foo, bar = "baz"))]"#, + CfgExpr::All(vec![ + CfgExpr::Atom("foo".into()), + CfgExpr::KeyValue { key: "bar".into(), value: "baz".into() }, + ]), + ); + + assert_parse_result( + r#"#![cfg(any(not(), all(), , bar = "baz",))]"#, + CfgExpr::Any(vec![ + CfgExpr::Not(Box::new(CfgExpr::Invalid)), + CfgExpr::All(vec![]), + CfgExpr::Invalid, + CfgExpr::KeyValue { key: "bar".into(), value: "baz".into() }, + ]), + ); + } +} diff --git a/crates/cfg/src/lib.rs b/crates/cfg/src/lib.rs new file mode 100644 index 000000000..a9d50e698 --- /dev/null +++ b/crates/cfg/src/lib.rs @@ -0,0 +1,51 @@ +//! cfg defines conditional compiling options, `cfg` attibute parser and evaluator + +mod cfg_expr; + +use rustc_hash::FxHashSet; +use tt::SmolStr; + +pub use cfg_expr::CfgExpr; + +/// Configuration options used for conditional compilition on items with `cfg` attributes. +/// We have two kind of options in different namespaces: atomic options like `unix`, and +/// key-value options like `target_arch="x86"`. +/// +/// Note that for key-value options, one key can have multiple values (but not none). +/// `feature` is an example. We have both `feature="foo"` and `feature="bar"` if features +/// `foo` and `bar` are both enabled. And here, we store key-value options as a set of tuple +/// of key and value in `key_values`. +/// +/// See: https://doc.rust-lang.org/reference/conditional-compilation.html#set-configuration-options +#[derive(Debug, Clone, PartialEq, Eq, Default)] +pub struct CfgOptions { + atoms: FxHashSet, + key_values: FxHashSet<(SmolStr, SmolStr)>, +} + +impl CfgOptions { + pub fn check(&self, cfg: &CfgExpr) -> Option { + cfg.fold(&|key, value| match value { + None => self.atoms.contains(key), + Some(value) => self.key_values.contains(&(key.clone(), value.clone())), + }) + } + + pub fn insert_atom(&mut self, key: SmolStr) { + self.atoms.insert(key); + } + + pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) { + self.key_values.insert((key, value)); + } + + pub fn append(&mut self, other: &CfgOptions) { + for atom in &other.atoms { + self.atoms.insert(atom.clone()); + } + + for (key, value) in &other.key_values { + self.key_values.insert((key.clone(), value.clone())); + } + } +} diff --git a/crates/ra_cfg/Cargo.toml b/crates/ra_cfg/Cargo.toml deleted file mode 100644 index 661e53904..000000000 --- a/crates/ra_cfg/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -edition = "2018" -name = "ra_cfg" -version = "0.1.0" -authors = ["rust-analyzer developers"] -license = "MIT OR Apache-2.0" - -[lib] -doctest = false - -[dependencies] -rustc-hash = "1.1.0" - -tt = { path = "../tt" } - -[dev-dependencies] -mbe = { path = "../mbe" } -syntax = { path = "../syntax" } diff --git a/crates/ra_cfg/src/cfg_expr.rs b/crates/ra_cfg/src/cfg_expr.rs deleted file mode 100644 index 336fe25bc..000000000 --- a/crates/ra_cfg/src/cfg_expr.rs +++ /dev/null @@ -1,133 +0,0 @@ -//! The condition expression used in `#[cfg(..)]` attributes. -//! -//! See: https://doc.rust-lang.org/reference/conditional-compilation.html#conditional-compilation - -use std::slice::Iter as SliceIter; - -use tt::SmolStr; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum CfgExpr { - Invalid, - Atom(SmolStr), - KeyValue { key: SmolStr, value: SmolStr }, - All(Vec), - Any(Vec), - Not(Box), -} - -impl CfgExpr { - pub fn parse(tt: &tt::Subtree) -> CfgExpr { - next_cfg_expr(&mut tt.token_trees.iter()).unwrap_or(CfgExpr::Invalid) - } - /// Fold the cfg by querying all basic `Atom` and `KeyValue` predicates. - pub fn fold(&self, query: &dyn Fn(&SmolStr, Option<&SmolStr>) -> bool) -> Option { - match self { - CfgExpr::Invalid => None, - CfgExpr::Atom(name) => Some(query(name, None)), - CfgExpr::KeyValue { key, value } => Some(query(key, Some(value))), - CfgExpr::All(preds) => { - preds.iter().try_fold(true, |s, pred| Some(s && pred.fold(query)?)) - } - CfgExpr::Any(preds) => { - preds.iter().try_fold(false, |s, pred| Some(s || pred.fold(query)?)) - } - CfgExpr::Not(pred) => pred.fold(query).map(|s| !s), - } - } -} - -fn next_cfg_expr(it: &mut SliceIter) -> Option { - let name = match it.next() { - None => return None, - Some(tt::TokenTree::Leaf(tt::Leaf::Ident(ident))) => ident.text.clone(), - Some(_) => return Some(CfgExpr::Invalid), - }; - - // Peek - let ret = match it.as_slice().first() { - Some(tt::TokenTree::Leaf(tt::Leaf::Punct(punct))) if punct.char == '=' => { - match it.as_slice().get(1) { - Some(tt::TokenTree::Leaf(tt::Leaf::Literal(literal))) => { - it.next(); - it.next(); - // FIXME: escape? raw string? - let value = - SmolStr::new(literal.text.trim_start_matches('"').trim_end_matches('"')); - CfgExpr::KeyValue { key: name, value } - } - _ => return Some(CfgExpr::Invalid), - } - } - Some(tt::TokenTree::Subtree(subtree)) => { - it.next(); - let mut sub_it = subtree.token_trees.iter(); - let mut subs = std::iter::from_fn(|| next_cfg_expr(&mut sub_it)).collect(); - match name.as_str() { - "all" => CfgExpr::All(subs), - "any" => CfgExpr::Any(subs), - "not" => CfgExpr::Not(Box::new(subs.pop().unwrap_or(CfgExpr::Invalid))), - _ => CfgExpr::Invalid, - } - } - _ => CfgExpr::Atom(name), - }; - - // Eat comma separator - if let Some(tt::TokenTree::Leaf(tt::Leaf::Punct(punct))) = it.as_slice().first() { - if punct.char == ',' { - it.next(); - } - } - Some(ret) -} - -#[cfg(test)] -mod tests { - use super::*; - - use mbe::ast_to_token_tree; - use syntax::ast::{self, AstNode}; - - fn assert_parse_result(input: &str, expected: CfgExpr) { - let (tt, _) = { - let source_file = ast::SourceFile::parse(input).ok().unwrap(); - let tt = source_file.syntax().descendants().find_map(ast::TokenTree::cast).unwrap(); - ast_to_token_tree(&tt).unwrap() - }; - let cfg = CfgExpr::parse(&tt); - assert_eq!(cfg, expected); - } - - #[test] - fn test_cfg_expr_parser() { - assert_parse_result("#![cfg(foo)]", CfgExpr::Atom("foo".into())); - assert_parse_result("#![cfg(foo,)]", CfgExpr::Atom("foo".into())); - assert_parse_result( - "#![cfg(not(foo))]", - CfgExpr::Not(Box::new(CfgExpr::Atom("foo".into()))), - ); - assert_parse_result("#![cfg(foo(bar))]", CfgExpr::Invalid); - - // Only take the first - assert_parse_result(r#"#![cfg(foo, bar = "baz")]"#, CfgExpr::Atom("foo".into())); - - assert_parse_result( - r#"#![cfg(all(foo, bar = "baz"))]"#, - CfgExpr::All(vec![ - CfgExpr::Atom("foo".into()), - CfgExpr::KeyValue { key: "bar".into(), value: "baz".into() }, - ]), - ); - - assert_parse_result( - r#"#![cfg(any(not(), all(), , bar = "baz",))]"#, - CfgExpr::Any(vec![ - CfgExpr::Not(Box::new(CfgExpr::Invalid)), - CfgExpr::All(vec![]), - CfgExpr::Invalid, - CfgExpr::KeyValue { key: "bar".into(), value: "baz".into() }, - ]), - ); - } -} diff --git a/crates/ra_cfg/src/lib.rs b/crates/ra_cfg/src/lib.rs deleted file mode 100644 index 6fb37bf9f..000000000 --- a/crates/ra_cfg/src/lib.rs +++ /dev/null @@ -1,51 +0,0 @@ -//! ra_cfg defines conditional compiling options, `cfg` attibute parser and evaluator - -mod cfg_expr; - -use rustc_hash::FxHashSet; -use tt::SmolStr; - -pub use cfg_expr::CfgExpr; - -/// Configuration options used for conditional compilition on items with `cfg` attributes. -/// We have two kind of options in different namespaces: atomic options like `unix`, and -/// key-value options like `target_arch="x86"`. -/// -/// Note that for key-value options, one key can have multiple values (but not none). -/// `feature` is an example. We have both `feature="foo"` and `feature="bar"` if features -/// `foo` and `bar` are both enabled. And here, we store key-value options as a set of tuple -/// of key and value in `key_values`. -/// -/// See: https://doc.rust-lang.org/reference/conditional-compilation.html#set-configuration-options -#[derive(Debug, Clone, PartialEq, Eq, Default)] -pub struct CfgOptions { - atoms: FxHashSet, - key_values: FxHashSet<(SmolStr, SmolStr)>, -} - -impl CfgOptions { - pub fn check(&self, cfg: &CfgExpr) -> Option { - cfg.fold(&|key, value| match value { - None => self.atoms.contains(key), - Some(value) => self.key_values.contains(&(key.clone(), value.clone())), - }) - } - - pub fn insert_atom(&mut self, key: SmolStr) { - self.atoms.insert(key); - } - - pub fn insert_key_value(&mut self, key: SmolStr, value: SmolStr) { - self.key_values.insert((key, value)); - } - - pub fn append(&mut self, other: &CfgOptions) { - for atom in &other.atoms { - self.atoms.insert(atom.clone()); - } - - for (key, value) in &other.key_values { - self.key_values.insert((key.clone(), value.clone())); - } - } -} diff --git a/crates/ra_db/Cargo.toml b/crates/ra_db/Cargo.toml index 156ea1ee4..ad432f096 100644 --- a/crates/ra_db/Cargo.toml +++ b/crates/ra_db/Cargo.toml @@ -13,7 +13,7 @@ salsa = "0.15.2" rustc-hash = "1.1.0" syntax = { path = "../syntax" } -ra_cfg = { path = "../ra_cfg" } +cfg = { path = "../cfg" } profile = { path = "../profile" } tt = { path = "../tt" } test_utils = { path = "../test_utils" } diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs index 2aafb9965..5ff8ead0e 100644 --- a/crates/ra_db/src/fixture.rs +++ b/crates/ra_db/src/fixture.rs @@ -59,7 +59,7 @@ //! ``` use std::{str::FromStr, sync::Arc}; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use rustc_hash::FxHashMap; use test_utils::{extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER}; use vfs::{file_set::FileSet, VfsPath}; diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 12a863499..f3d65cdf0 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs @@ -8,7 +8,7 @@ use std::{fmt, iter::FromIterator, ops, str::FromStr, sync::Arc}; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use rustc_hash::{FxHashMap, FxHashSet}; use syntax::SmolStr; use tt::TokenExpander; diff --git a/crates/ra_hir_def/Cargo.toml b/crates/ra_hir_def/Cargo.toml index ba7916c30..e7d3c4d5b 100644 --- a/crates/ra_hir_def/Cargo.toml +++ b/crates/ra_hir_def/Cargo.toml @@ -29,7 +29,7 @@ profile = { path = "../profile" } hir_expand = { path = "../ra_hir_expand", package = "ra_hir_expand" } test_utils = { path = "../test_utils" } mbe = { path = "../mbe" } -ra_cfg = { path = "../ra_cfg" } +cfg = { path = "../cfg" } tt = { path = "../tt" } [dev-dependencies] diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index c83219d77..d69ff2fc7 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs @@ -23,7 +23,7 @@ use crate::{ EnumId, HasModule, LocalEnumVariantId, LocalFieldId, Lookup, ModuleId, StructId, UnionId, VariantId, }; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; /// Note that we use `StructData` for unions as well! #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index 36dc8b816..1e5b06ca0 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs @@ -5,7 +5,7 @@ use std::{ops, sync::Arc}; use either::Either; use hir_expand::{hygiene::Hygiene, AstId, InFile}; use mbe::ast_to_token_tree; -use ra_cfg::{CfgExpr, CfgOptions}; +use cfg::{CfgExpr, CfgOptions}; use syntax::{ ast::{self, AstNode, AttrsOwner}, SmolStr, diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index 7c33966a7..3568513d1 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs @@ -9,7 +9,7 @@ use arena::{map::ArenaMap, Arena}; use drop_bomb::DropBomb; use either::Either; use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId}; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use ra_db::CrateId; use rustc_hash::FxHashMap; use syntax::{ast, AstNode, AstPtr}; diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index f7270ec91..fa2dadfc5 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -11,7 +11,7 @@ use hir_expand::{ proc_macro::ProcMacroExpander, HirFileId, MacroCallId, MacroDefId, MacroDefKind, }; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use ra_db::{CrateId, FileId, ProcMacroId}; use rustc_hash::FxHashMap; use syntax::ast; diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index 8e0fa5917..c60e55545 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml @@ -25,7 +25,7 @@ syntax = { path = "../syntax" } text_edit = { path = "../text_edit" } ra_db = { path = "../ra_db" } ra_ide_db = { path = "../ra_ide_db" } -ra_cfg = { path = "../ra_cfg" } +cfg = { path = "../cfg" } ra_fmt = { path = "../ra_fmt" } profile = { path = "../profile" } test_utils = { path = "../test_utils" } diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 20967ba99..1fdf17800 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs @@ -47,7 +47,7 @@ mod typing; use std::sync::Arc; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use ra_db::{ salsa::{self, ParallelDatabase}, CheckCanceled, Env, FileLoader, FileSet, SourceDatabase, VfsPath, diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs index c7e0f4b58..a4691f028 100644 --- a/crates/ra_ide/src/mock_analysis.rs +++ b/crates/ra_ide/src/mock_analysis.rs @@ -1,7 +1,7 @@ //! FIXME: write short doc here use std::sync::Arc; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use ra_db::{CrateName, FileSet, SourceRoot, VfsPath}; use test_utils::{ extract_annotations, extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER, diff --git a/crates/ra_ide/src/parent_module.rs b/crates/ra_ide/src/parent_module.rs index 69af0c86a..b78388e6b 100644 --- a/crates/ra_ide/src/parent_module.rs +++ b/crates/ra_ide/src/parent_module.rs @@ -63,7 +63,7 @@ pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec { #[cfg(test)] mod tests { - use ra_cfg::CfgOptions; + use cfg::CfgOptions; use ra_db::Env; use test_utils::mark; diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index 54cb3b309..7d8a210b7 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs @@ -2,7 +2,7 @@ use std::fmt; use hir::{AsAssocItem, Attrs, HirFileId, InFile, Semantics}; use itertools::Itertools; -use ra_cfg::CfgExpr; +use cfg::CfgExpr; use ra_ide_db::RootDatabase; use syntax::{ ast::{self, AstNode, AttrsOwner, DocCommentsOwner, ModuleItemOwner, NameOwner}, diff --git a/crates/ra_project_model/Cargo.toml b/crates/ra_project_model/Cargo.toml index 171fe8626..52f2d57b3 100644 --- a/crates/ra_project_model/Cargo.toml +++ b/crates/ra_project_model/Cargo.toml @@ -15,7 +15,7 @@ rustc-hash = "1.1.0" cargo_metadata = "0.11.1" arena = { path = "../arena" } -ra_cfg = { path = "../ra_cfg" } +cfg = { path = "../cfg" } ra_db = { path = "../ra_db" } toolchain = { path = "../toolchain" } ra_proc_macro = { path = "../ra_proc_macro" } diff --git a/crates/ra_project_model/src/cfg_flag.rs b/crates/ra_project_model/src/cfg_flag.rs index bd50056c6..e92962cf6 100644 --- a/crates/ra_project_model/src/cfg_flag.rs +++ b/crates/ra_project_model/src/cfg_flag.rs @@ -3,7 +3,7 @@ //! rustc main.rs --cfg foo --cfg 'feature="bar"' use std::str::FromStr; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use stdx::split_once; #[derive(Clone, Eq, PartialEq, Debug)] diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 46f44910c..47e7d2420 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs @@ -13,7 +13,7 @@ use std::{ use anyhow::{bail, Context, Result}; use paths::{AbsPath, AbsPathBuf}; -use ra_cfg::CfgOptions; +use cfg::CfgOptions; use ra_db::{CrateGraph, CrateId, CrateName, Edition, Env, FileId}; use rustc_hash::{FxHashMap, FxHashSet}; diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 156f8d538..440b1cd13 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -42,7 +42,7 @@ syntax = { path = "../syntax" } text_edit = { path = "../text_edit" } vfs = { path = "../vfs" } vfs-notify = { path = "../vfs-notify" } -ra_cfg = { path = "../ra_cfg" } +cfg = { path = "../cfg" } toolchain = { path = "../toolchain" } # This should only be used in CLI diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs index 7929368c0..87ddd25bf 100644 --- a/crates/rust-analyzer/src/cargo_target_spec.rs +++ b/crates/rust-analyzer/src/cargo_target_spec.rs @@ -1,6 +1,6 @@ //! See `CargoTargetSpec` -use ra_cfg::CfgExpr; +use cfg::CfgExpr; use ra_ide::{FileId, RunnableKind, TestId}; use ra_project_model::{self, TargetKind}; use vfs::AbsPathBuf; @@ -178,7 +178,7 @@ mod tests { use super::*; use mbe::ast_to_token_tree; - use ra_cfg::CfgExpr; + use cfg::CfgExpr; use syntax::{ ast::{self, AstNode}, SmolStr, -- cgit v1.2.3