diff options
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide_api/src/mock_analysis.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide_api/tests/test/main.rs | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index de3ec4e0a..d77a56ce8 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -62,7 +62,8 @@ pub use ra_ide_api_light::{ | |||
62 | LineIndex, LineCol, translate_offset_with_edit, | 62 | LineIndex, LineCol, translate_offset_with_edit, |
63 | }; | 63 | }; |
64 | pub use ra_db::{ | 64 | pub use ra_db::{ |
65 | Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId | 65 | Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId, |
66 | Edition | ||
66 | }; | 67 | }; |
67 | pub use hir::Documentation; | 68 | pub use hir::Documentation; |
68 | 69 | ||
diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs index 017ac5de3..550d69641 100644 --- a/crates/ra_ide_api/src/mock_analysis.rs +++ b/crates/ra_ide_api/src/mock_analysis.rs | |||
@@ -3,7 +3,7 @@ use std::sync::Arc; | |||
3 | use relative_path::RelativePathBuf; | 3 | use relative_path::RelativePathBuf; |
4 | use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER}; | 4 | use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER}; |
5 | 5 | ||
6 | use crate::{Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, FilePosition, FileRange, SourceRootId}; | 6 | use crate::{Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, FilePosition, FileRange, SourceRootId, Edition::Edition2018}; |
7 | 7 | ||
8 | /// Mock analysis is used in test to bootstrap an AnalysisHost/Analysis | 8 | /// Mock analysis is used in test to bootstrap an AnalysisHost/Analysis |
9 | /// from a set of in-memory files. | 9 | /// from a set of in-memory files. |
@@ -89,9 +89,9 @@ impl MockAnalysis { | |||
89 | let path = RelativePathBuf::from_path(&path[1..]).unwrap(); | 89 | let path = RelativePathBuf::from_path(&path[1..]).unwrap(); |
90 | let file_id = FileId(i as u32 + 1); | 90 | let file_id = FileId(i as u32 + 1); |
91 | if path == "/lib.rs" || path == "/main.rs" { | 91 | if path == "/lib.rs" || path == "/main.rs" { |
92 | root_crate = Some(crate_graph.add_crate_root(file_id)); | 92 | root_crate = Some(crate_graph.add_crate_root(file_id, Edition2018)); |
93 | } else if path.ends_with("/lib.rs") { | 93 | } else if path.ends_with("/lib.rs") { |
94 | let other_crate = crate_graph.add_crate_root(file_id); | 94 | let other_crate = crate_graph.add_crate_root(file_id, Edition2018); |
95 | let crate_name = path.parent().unwrap().file_name().unwrap(); | 95 | let crate_name = path.parent().unwrap().file_name().unwrap(); |
96 | if let Some(root_crate) = root_crate { | 96 | if let Some(root_crate) = root_crate { |
97 | crate_graph.add_dep(root_crate, crate_name.into(), other_crate).unwrap(); | 97 | crate_graph.add_dep(root_crate, crate_name.into(), other_crate).unwrap(); |
diff --git a/crates/ra_ide_api/tests/test/main.rs b/crates/ra_ide_api/tests/test/main.rs index 4cf842452..0526f7584 100644 --- a/crates/ra_ide_api/tests/test/main.rs +++ b/crates/ra_ide_api/tests/test/main.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use insta::assert_debug_snapshot_matches; | 1 | use insta::assert_debug_snapshot_matches; |
2 | use ra_ide_api::{ | 2 | use ra_ide_api::{ |
3 | mock_analysis::{single_file, single_file_with_position, MockAnalysis}, | 3 | mock_analysis::{single_file, single_file_with_position, MockAnalysis}, |
4 | AnalysisChange, CrateGraph, FileId, Query, NavigationTarget, | 4 | AnalysisChange, CrateGraph, Edition::Edition2018, FileId, Query, NavigationTarget |
5 | }; | 5 | }; |
6 | use ra_syntax::{TextRange, SmolStr}; | 6 | use ra_syntax::{TextRange, SmolStr}; |
7 | 7 | ||
@@ -36,7 +36,7 @@ fn test_resolve_crate_root() { | |||
36 | assert!(host.analysis().crate_for(mod_file).unwrap().is_empty()); | 36 | assert!(host.analysis().crate_for(mod_file).unwrap().is_empty()); |
37 | 37 | ||
38 | let mut crate_graph = CrateGraph::default(); | 38 | let mut crate_graph = CrateGraph::default(); |
39 | let crate_id = crate_graph.add_crate_root(root_file); | 39 | let crate_id = crate_graph.add_crate_root(root_file, Edition2018); |
40 | let mut change = AnalysisChange::new(); | 40 | let mut change = AnalysisChange::new(); |
41 | change.set_crate_graph(crate_graph); | 41 | change.set_crate_graph(crate_graph); |
42 | host.apply_change(change); | 42 | host.apply_change(change); |