aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/tests/test
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-13 20:14:39 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-13 20:14:39 +0000
commitcb4327b3a9f0858235dc20b7c5c7e25c6c330aab (patch)
tree489b3497b2762dcabf60d2674031585431e16959 /crates/ra_ide_api/tests/test
parent65266c644a31e6b321e5afb3c5a2ee75be76cb0c (diff)
parent911e32bca9b73e66eceb6bbee3768c82e94597d5 (diff)
Merge #816
816: Prelude & Edition 2015 import resolution r=matklad a=flodiebold I implemented the prelude import, but it turned out to be useless without being able to resolve any of the imports in the prelude :sweat_smile: So I had to add some edition handling and handle 2015-style imports (at least the simplified scheme proposed in rust-lang/rust#57745). So now finally `Option` resolves :smile: One remaining problem is that we don't actually know the edition for sysroot crates. They're currently hardcoded to 2015, but there's already a bunch of PRs upgrading the editions of various rustc crates, so we'll have to detect the edition somehow, or just change the hardcoding to 2018 later, I guess... ~Also currently missing is completion for prelude names, though that shouldn't be hard to add. And `Vec` still doesn't resolve, so I need to look into that.~ Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/tests/test')
-rw-r--r--crates/ra_ide_api/tests/test/main.rs4
1 files changed, 2 insertions, 2 deletions
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 @@
1use insta::assert_debug_snapshot_matches; 1use insta::assert_debug_snapshot_matches;
2use ra_ide_api::{ 2use 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};
6use ra_syntax::{TextRange, SmolStr}; 6use 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);