aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-02 16:48:54 +0100
committerGitHub <[email protected]>2020-07-02 16:48:54 +0100
commit4cb8bf03c588dcf244d25785de3878b6ef3f7958 (patch)
tree50fdb5017e7b788004a8ae36278c418c134b249f
parentc80b6876d537fe8abed4965635b3fe578170191e (diff)
parenteb75a644a1c4483a74027d8936b3cfb9a02b0957 (diff)
Merge #5192
5192: Implement rust-analyzer feature configuration to tests. r=matklad a=daxpedda Fixes #3198. I'm unsure if it is desired this way, maybe we want to make a seperate configuration? Co-authored-by: daxpedda <[email protected]>
-rw-r--r--crates/rust-analyzer/src/cargo_target_spec.rs23
-rw-r--r--crates/rust-analyzer/src/to_proto.rs2
2 files changed, 17 insertions, 8 deletions
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs
index e4dd5d92d..929926cbc 100644
--- a/crates/rust-analyzer/src/cargo_target_spec.rs
+++ b/crates/rust-analyzer/src/cargo_target_spec.rs
@@ -21,6 +21,7 @@ pub(crate) struct CargoTargetSpec {
21 21
22impl CargoTargetSpec { 22impl CargoTargetSpec {
23 pub(crate) fn runnable_args( 23 pub(crate) fn runnable_args(
24 snap: &GlobalStateSnapshot,
24 spec: Option<CargoTargetSpec>, 25 spec: Option<CargoTargetSpec>,
25 kind: &RunnableKind, 26 kind: &RunnableKind,
26 cfgs: &[CfgExpr], 27 cfgs: &[CfgExpr],
@@ -78,13 +79,21 @@ impl CargoTargetSpec {
78 } 79 }
79 } 80 }
80 81
81 let mut features = Vec::new(); 82 if snap.config.cargo.all_features {
82 for cfg in cfgs { 83 args.push("--all-features".to_string());
83 required_features(cfg, &mut features); 84 } else {
84 } 85 let mut features = Vec::new();
85 for feature in features { 86 for cfg in cfgs {
86 args.push("--features".to_string()); 87 required_features(cfg, &mut features);
87 args.push(feature); 88 }
89 for feature in &snap.config.cargo.features {
90 features.push(feature.clone());
91 }
92 features.dedup();
93 for feature in features {
94 args.push("--features".to_string());
95 args.push(feature);
96 }
88 } 97 }
89 98
90 Ok((args, extra_args)) 99 Ok((args, extra_args))
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 95dd8e408..652a44694 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -666,7 +666,7 @@ pub(crate) fn runnable(
666 let workspace_root = spec.as_ref().map(|it| it.workspace_root.clone()); 666 let workspace_root = spec.as_ref().map(|it| it.workspace_root.clone());
667 let target = spec.as_ref().map(|s| s.target.clone()); 667 let target = spec.as_ref().map(|s| s.target.clone());
668 let (cargo_args, executable_args) = 668 let (cargo_args, executable_args) =
669 CargoTargetSpec::runnable_args(spec, &runnable.kind, &runnable.cfg_exprs)?; 669 CargoTargetSpec::runnable_args(snap, spec, &runnable.kind, &runnable.cfg_exprs)?;
670 let label = runnable.label(target); 670 let label = runnable.label(target);
671 let location = location_link(snap, None, runnable.nav)?; 671 let location = location_link(snap, None, runnable.nav)?;
672 672