From 2c48fa087b6cc79ebfd81af9daf4a07d8019fd67 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 Nov 2019 13:55:03 +0300 Subject: Add support for environment to CrateGraph --- crates/ra_ide_api/src/mock_analysis.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide_api/src/mock_analysis.rs') diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs index 2b1c96dbf..bf8a54932 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; use ra_cfg::CfgOptions; -use ra_db::RelativePathBuf; +use ra_db::{Env, RelativePathBuf}; use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER}; use crate::{ @@ -96,9 +96,15 @@ impl MockAnalysis { let file_id = FileId(i as u32 + 1); let cfg_options = CfgOptions::default(); if path == "/lib.rs" || path == "/main.rs" { - root_crate = Some(crate_graph.add_crate_root(file_id, Edition2018, cfg_options)); + root_crate = Some(crate_graph.add_crate_root( + file_id, + Edition2018, + cfg_options, + Env::default(), + )); } else if path.ends_with("/lib.rs") { - let other_crate = crate_graph.add_crate_root(file_id, Edition2018, cfg_options); + let other_crate = + crate_graph.add_crate_root(file_id, Edition2018, cfg_options, Env::default()); let crate_name = path.parent().unwrap().file_name().unwrap(); if let Some(root_crate) = root_crate { crate_graph.add_dep(root_crate, crate_name.into(), other_crate).unwrap(); -- cgit v1.2.3