Skip to content

Commit

Permalink
Re-implement dependecny tracking for cargo script
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Apr 19, 2024
1 parent 2f82807 commit 0b24599
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 234 deletions.
2 changes: 1 addition & 1 deletion crates/load-cargo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ fn load_crate_graph(
) -> RootDatabase {
let (ProjectWorkspace::Cargo { toolchain, target_layout, .. }
| ProjectWorkspace::Json { toolchain, target_layout, .. }
| ProjectWorkspace::DetachedFiles { toolchain, target_layout, .. }) = ws;
| ProjectWorkspace::DetachedFile { toolchain, target_layout, .. }) = ws;

let lru_cap = std::env::var("RA_LRU_CAP").ok().and_then(|it| it.parse::<usize>().ok());
let mut db = RootDatabase::new(lru_cap);
Expand Down
6 changes: 4 additions & 2 deletions crates/project-model/src/cargo_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,10 @@ impl CargoWorkspace {
.collect(),
);
}
if cargo_toml.extension().is_some_and(|x| x == "rs") {
// TODO: enable `+nightly` for cargo scripts
// The manifest is a rust file, so this means its a script manifest
if cargo_toml.extension().is_some_and(|ext| ext == "rs") {
// Deliberately don't set up RUSTC_BOOTSTRAP or a nightly override here, the user should
// opt into it themselves.
other_options.push("-Zscript".to_owned());
}
meta.other_options(other_options);
Expand Down
Loading

0 comments on commit 0b24599

Please sign in to comment.