aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_db/src/fixture.rs8
-rw-r--r--crates/ra_db/src/input.rs6
-rw-r--r--crates/ra_hir/src/code_model.rs6
-rw-r--r--crates/ra_ide/src/mock_analysis.rs2
-rw-r--r--crates/ra_project_model/src/lib.rs8
5 files changed, 15 insertions, 15 deletions
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs
index 4f4fb4494..209713987 100644
--- a/crates/ra_db/src/fixture.rs
+++ b/crates/ra_db/src/fixture.rs
@@ -149,15 +149,17 @@ fn with_files(
149 let crate_id = crate_graph.add_crate_root( 149 let crate_id = crate_graph.add_crate_root(
150 file_id, 150 file_id,
151 meta.edition, 151 meta.edition,
152 Some(CrateName::new(&krate).unwrap()), 152 Some(krate.clone()),
153 meta.cfg, 153 meta.cfg,
154 meta.env, 154 meta.env,
155 Default::default(), 155 Default::default(),
156 ); 156 );
157 let prev = crates.insert(krate.clone(), crate_id); 157 let crate_name = CrateName::new(&krate).unwrap();
158 let prev = crates.insert(crate_name.clone(), crate_id);
158 assert!(prev.is_none()); 159 assert!(prev.is_none());
159 for dep in meta.deps { 160 for dep in meta.deps {
160 crate_deps.push((krate.clone(), dep)) 161 let dep = CrateName::new(&dep).unwrap();
162 crate_deps.push((crate_name.clone(), dep))
161 } 163 }
162 } else if meta.path == "/main.rs" || meta.path == "/lib.rs" { 164 } else if meta.path == "/main.rs" || meta.path == "/lib.rs" {
163 assert!(default_crate_root.is_none()); 165 assert!(default_crate_root.is_none());
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index a8cc588f9..445a1ee48 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -67,7 +67,7 @@ pub struct CrateGraph {
67#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 67#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
68pub struct CrateId(pub u32); 68pub struct CrateId(pub u32);
69 69
70#[derive(Debug, Clone, PartialEq, Eq)] 70#[derive(Debug, Clone, PartialEq, Eq, Hash)]
71pub struct CrateName(SmolStr); 71pub struct CrateName(SmolStr);
72 72
73impl CrateName { 73impl CrateName {
@@ -124,7 +124,7 @@ pub struct CrateData {
124 /// The name to display to the end user. 124 /// The name to display to the end user.
125 /// This actual crate name can be different in a particular dependent crate 125 /// This actual crate name can be different in a particular dependent crate
126 /// or may even be missing for some cases, such as a dummy crate for the code snippet. 126 /// or may even be missing for some cases, such as a dummy crate for the code snippet.
127 pub display_name: Option<CrateName>, 127 pub display_name: Option<String>,
128 pub cfg_options: CfgOptions, 128 pub cfg_options: CfgOptions,
129 pub env: Env, 129 pub env: Env,
130 pub dependencies: Vec<Dependency>, 130 pub dependencies: Vec<Dependency>,
@@ -153,7 +153,7 @@ impl CrateGraph {
153 &mut self, 153 &mut self,
154 file_id: FileId, 154 file_id: FileId,
155 edition: Edition, 155 edition: Edition,
156 display_name: Option<CrateName>, 156 display_name: Option<String>,
157 cfg_options: CfgOptions, 157 cfg_options: CfgOptions,
158 env: Env, 158 env: Env,
159 proc_macro: Vec<(SmolStr, Arc<dyn ra_tt::TokenExpander>)>, 159 proc_macro: Vec<(SmolStr, Arc<dyn ra_tt::TokenExpander>)>,
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index e86077dd6..e09eb77c2 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -31,7 +31,7 @@ use hir_ty::{
31 ApplicationTy, Canonical, GenericPredicate, InEnvironment, Substs, TraitEnvironment, Ty, 31 ApplicationTy, Canonical, GenericPredicate, InEnvironment, Substs, TraitEnvironment, Ty,
32 TyDefId, TypeCtor, 32 TyDefId, TypeCtor,
33}; 33};
34use ra_db::{CrateId, CrateName, Edition, FileId}; 34use ra_db::{CrateId, Edition, FileId};
35use ra_prof::profile; 35use ra_prof::profile;
36use ra_syntax::ast::{self, AttrsOwner, NameOwner}; 36use ra_syntax::ast::{self, AttrsOwner, NameOwner};
37use rustc_hash::FxHashSet; 37use rustc_hash::FxHashSet;
@@ -94,8 +94,8 @@ impl Crate {
94 db.crate_graph()[self.id].edition 94 db.crate_graph()[self.id].edition
95 } 95 }
96 96
97 pub fn display_name(self, db: &dyn HirDatabase) -> Option<CrateName> { 97 pub fn display_name(self, db: &dyn HirDatabase) -> Option<String> {
98 db.crate_graph()[self.id].display_name.as_ref().cloned() 98 db.crate_graph()[self.id].display_name.clone()
99 } 99 }
100 100
101 pub fn query_external_importables( 101 pub fn query_external_importables(
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index db6d50694..a393d3dba 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -130,7 +130,7 @@ impl MockAnalysis {
130 let other_crate = crate_graph.add_crate_root( 130 let other_crate = crate_graph.add_crate_root(
131 file_id, 131 file_id,
132 edition, 132 edition,
133 Some(CrateName::new(crate_name).unwrap()), 133 Some(crate_name.to_string()),
134 cfg, 134 cfg,
135 env, 135 env,
136 Default::default(), 136 Default::default(),
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 1533d32c9..8dbf4e6ea 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -309,13 +309,11 @@ impl ProjectWorkspace {
309 309
310 let env = Env::default(); 310 let env = Env::default();
311 let proc_macro = vec![]; 311 let proc_macro = vec![];
312 let crate_name = CrateName::new(&sysroot[krate].name) 312 let name = sysroot[krate].name.clone();
313 .expect("Sysroot crate names should not contain dashes");
314
315 let crate_id = crate_graph.add_crate_root( 313 let crate_id = crate_graph.add_crate_root(
316 file_id, 314 file_id,
317 Edition::Edition2018, 315 Edition::Edition2018,
318 Some(crate_name), 316 Some(name),
319 cfg_options.clone(), 317 cfg_options.clone(),
320 env, 318 env,
321 proc_macro, 319 proc_macro,
@@ -389,7 +387,7 @@ impl ProjectWorkspace {
389 let crate_id = crate_graph.add_crate_root( 387 let crate_id = crate_graph.add_crate_root(
390 file_id, 388 file_id,
391 edition, 389 edition,
392 Some(CrateName::normalize_dashes(&cargo[pkg].name)), 390 Some(cargo[pkg].name.clone()),
393 cfg_options, 391 cfg_options,
394 env, 392 env,
395 proc_macro.clone(), 393 proc_macro.clone(),