Pass required features to cargo when using run action

When using `F1`->`Rust Analyzer: Run` action on an `example`, pass its
`required-features` to `cargo run`. This allows to run examples that
were otherwise impossible to run with RA.
This commit is contained in:
Maybe Waffle 2022-02-06 18:56:25 +03:00
parent ba33054802
commit 662dd7c27d
2 changed files with 21 additions and 4 deletions

View file

@ -210,6 +210,8 @@ pub struct TargetData {
pub kind: TargetKind,
/// Is this target a proc-macro
pub is_proc_macro: bool,
/// Required features of the target without which it won't build
pub required_features: Vec<String>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -348,6 +350,7 @@ impl CargoWorkspace {
root: AbsPathBuf::assert(PathBuf::from(&meta_tgt.src_path)),
kind: TargetKind::new(meta_tgt.kind.as_slice()),
is_proc_macro,
required_features: meta_tgt.required_features.clone(),
});
pkg_data.targets.push(tgt);
}