aboutsummaryrefslogtreecommitdiff
path: root/crates/base_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/base_db')
-rw-r--r--crates/base_db/src/fixture.rs5
-rw-r--r--crates/base_db/src/input.rs26
2 files changed, 16 insertions, 15 deletions
diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs
index 6d3b1266e..7d5d12e63 100644
--- a/crates/base_db/src/fixture.rs
+++ b/crates/base_db/src/fixture.rs
@@ -128,10 +128,10 @@ impl ChangeFixture {
128 file_id, 128 file_id,
129 meta.edition, 129 meta.edition,
130 Some(crate_name.clone().into()), 130 Some(crate_name.clone().into()),
131 meta.cfg.clone(),
131 meta.cfg, 132 meta.cfg,
132 meta.env, 133 meta.env,
133 Default::default(), 134 Default::default(),
134 Default::default(),
135 ); 135 );
136 let prev = crates.insert(crate_name.clone(), crate_id); 136 let prev = crates.insert(crate_name.clone(), crate_id);
137 assert!(prev.is_none()); 137 assert!(prev.is_none());
@@ -158,10 +158,10 @@ impl ChangeFixture {
158 crate_root, 158 crate_root,
159 Edition::Edition2018, 159 Edition::Edition2018,
160 Some(CrateName::new("test").unwrap().into()), 160 Some(CrateName::new("test").unwrap().into()),
161 default_cfg.clone(),
161 default_cfg, 162 default_cfg,
162 Env::default(), 163 Env::default(),
163 Default::default(), 164 Default::default(),
164 Default::default(),
165 ); 165 );
166 } else { 166 } else {
167 for (from, to) in crate_deps { 167 for (from, to) in crate_deps {
@@ -188,6 +188,7 @@ impl ChangeFixture {
188 Edition::Edition2021, 188 Edition::Edition2021,
189 Some(CrateDisplayName::from_canonical_name("core".to_string())), 189 Some(CrateDisplayName::from_canonical_name("core".to_string())),
190 CfgOptions::default(), 190 CfgOptions::default(),
191 CfgOptions::default(),
191 Env::default(), 192 Env::default(),
192 Vec::new(), 193 Vec::new(),
193 ); 194 );
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs
index d99388f71..0c51a59a0 100644
--- a/crates/base_db/src/input.rs
+++ b/crates/base_db/src/input.rs
@@ -189,10 +189,10 @@ pub struct CrateData {
189 /// `Dependency` matters), this name should only be used for UI. 189 /// `Dependency` matters), this name should only be used for UI.
190 pub display_name: Option<CrateDisplayName>, 190 pub display_name: Option<CrateDisplayName>,
191 pub cfg_options: CfgOptions, 191 pub cfg_options: CfgOptions,
192 pub potential_cfg_options: CfgOptions,
192 pub env: Env, 193 pub env: Env,
193 pub dependencies: Vec<Dependency>, 194 pub dependencies: Vec<Dependency>,
194 pub proc_macro: Vec<ProcMacro>, 195 pub proc_macro: Vec<ProcMacro>,
195 pub features: FxHashMap<String, Vec<String>>,
196} 196}
197 197
198#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 198#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -220,19 +220,19 @@ impl CrateGraph {
220 edition: Edition, 220 edition: Edition,
221 display_name: Option<CrateDisplayName>, 221 display_name: Option<CrateDisplayName>,
222 cfg_options: CfgOptions, 222 cfg_options: CfgOptions,
223 potential_cfg_options: CfgOptions,
223 env: Env, 224 env: Env,
224 proc_macro: Vec<ProcMacro>, 225 proc_macro: Vec<ProcMacro>,
225 features: FxHashMap<String, Vec<String>>,
226 ) -> CrateId { 226 ) -> CrateId {
227 let data = CrateData { 227 let data = CrateData {
228 root_file_id: file_id, 228 root_file_id: file_id,
229 edition, 229 edition,
230 display_name, 230 display_name,
231 cfg_options, 231 cfg_options,
232 potential_cfg_options,
232 env, 233 env,
233 proc_macro, 234 proc_macro,
234 dependencies: Vec::new(), 235 dependencies: Vec::new(),
235 features,
236 }; 236 };
237 let crate_id = CrateId(self.arena.len() as u32); 237 let crate_id = CrateId(self.arena.len() as u32);
238 let prev = self.arena.insert(crate_id, data); 238 let prev = self.arena.insert(crate_id, data);
@@ -507,27 +507,27 @@ mod tests {
507 Edition2018, 507 Edition2018,
508 None, 508 None,
509 CfgOptions::default(), 509 CfgOptions::default(),
510 CfgOptions::default(),
510 Env::default(), 511 Env::default(),
511 Default::default(), 512 Default::default(),
512 Default::default(),
513 ); 513 );
514 let crate2 = graph.add_crate_root( 514 let crate2 = graph.add_crate_root(
515 FileId(2u32), 515 FileId(2u32),
516 Edition2018, 516 Edition2018,
517 None, 517 None,
518 CfgOptions::default(), 518 CfgOptions::default(),
519 CfgOptions::default(),
519 Env::default(), 520 Env::default(),
520 Default::default(), 521 Default::default(),
521 Default::default(),
522 ); 522 );
523 let crate3 = graph.add_crate_root( 523 let crate3 = graph.add_crate_root(
524 FileId(3u32), 524 FileId(3u32),
525 Edition2018, 525 Edition2018,
526 None, 526 None,
527 CfgOptions::default(), 527 CfgOptions::default(),
528 CfgOptions::default(),
528 Env::default(), 529 Env::default(),
529 Default::default(), 530 Default::default(),
530 Default::default(),
531 ); 531 );
532 assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); 532 assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok());
533 assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok()); 533 assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok());
@@ -542,18 +542,18 @@ mod tests {
542 Edition2018, 542 Edition2018,
543 None, 543 None,
544 CfgOptions::default(), 544 CfgOptions::default(),
545 CfgOptions::default(),
545 Env::default(), 546 Env::default(),
546 Default::default(), 547 Default::default(),
547 Default::default(),
548 ); 548 );
549 let crate2 = graph.add_crate_root( 549 let crate2 = graph.add_crate_root(
550 FileId(2u32), 550 FileId(2u32),
551 Edition2018, 551 Edition2018,
552 None, 552 None,
553 CfgOptions::default(), 553 CfgOptions::default(),
554 CfgOptions::default(),
554 Env::default(), 555 Env::default(),
555 Default::default(), 556 Default::default(),
556 Default::default(),
557 ); 557 );
558 assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); 558 assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok());
559 assert!(graph.add_dep(crate2, CrateName::new("crate2").unwrap(), crate2).is_err()); 559 assert!(graph.add_dep(crate2, CrateName::new("crate2").unwrap(), crate2).is_err());
@@ -567,27 +567,27 @@ mod tests {
567 Edition2018, 567 Edition2018,
568 None, 568 None,
569 CfgOptions::default(), 569 CfgOptions::default(),
570 CfgOptions::default(),
570 Env::default(), 571 Env::default(),
571 Default::default(), 572 Default::default(),
572 Default::default(),
573 ); 573 );
574 let crate2 = graph.add_crate_root( 574 let crate2 = graph.add_crate_root(
575 FileId(2u32), 575 FileId(2u32),
576 Edition2018, 576 Edition2018,
577 None, 577 None,
578 CfgOptions::default(), 578 CfgOptions::default(),
579 CfgOptions::default(),
579 Env::default(), 580 Env::default(),
580 Default::default(), 581 Default::default(),
581 Default::default(),
582 ); 582 );
583 let crate3 = graph.add_crate_root( 583 let crate3 = graph.add_crate_root(
584 FileId(3u32), 584 FileId(3u32),
585 Edition2018, 585 Edition2018,
586 None, 586 None,
587 CfgOptions::default(), 587 CfgOptions::default(),
588 CfgOptions::default(),
588 Env::default(), 589 Env::default(),
589 Default::default(), 590 Default::default(),
590 Default::default(),
591 ); 591 );
592 assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok()); 592 assert!(graph.add_dep(crate1, CrateName::new("crate2").unwrap(), crate2).is_ok());
593 assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok()); 593 assert!(graph.add_dep(crate2, CrateName::new("crate3").unwrap(), crate3).is_ok());
@@ -601,18 +601,18 @@ mod tests {
601 Edition2018, 601 Edition2018,
602 None, 602 None,
603 CfgOptions::default(), 603 CfgOptions::default(),
604 CfgOptions::default(),
604 Env::default(), 605 Env::default(),
605 Default::default(), 606 Default::default(),
606 Default::default(),
607 ); 607 );
608 let crate2 = graph.add_crate_root( 608 let crate2 = graph.add_crate_root(
609 FileId(2u32), 609 FileId(2u32),
610 Edition2018, 610 Edition2018,
611 None, 611 None,
612 CfgOptions::default(), 612 CfgOptions::default(),
613 CfgOptions::default(),
613 Env::default(), 614 Env::default(),
614 Default::default(), 615 Default::default(),
615 Default::default(),
616 ); 616 );
617 assert!(graph 617 assert!(graph
618 .add_dep(crate1, CrateName::normalize_dashes("crate-name-with-dashes"), crate2) 618 .add_dep(crate1, CrateName::normalize_dashes("crate-name-with-dashes"), crate2)