Skip to content

Rollup of 11 pull requests #103597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f310d4c
Don't auto-publish lib crates
Veykril Sep 27, 2022
d7fb8d5
Migrate assists to format args captures, part 2
DropDemBits Oct 10, 2022
d5f467a
Substitute some VSCode variables in the VSCode client
Veykril Oct 16, 2022
a2e4f78
Auto merge of #13399 - DropDemBits:assists-format-args-capture-pt2, r…
bors Oct 17, 2022
40cbeb5
Auto merge of #13423 - Veykril:vscode-vars, r=Veykril
bors Oct 17, 2022
f079792
Auto merge of #13302 - Veykril:auto-publish, r=Veykril
bors Oct 17, 2022
6f43597
Refactor language client handling
Veykril Oct 17, 2022
8aaafdd
Properly reload changed configs for server start
Veykril Oct 17, 2022
d68616a
Make more things private
Veykril Oct 17, 2022
0421756
Implement stop and start server commands
Veykril Oct 17, 2022
7b5c943
Downgrade vscode types dependency
Veykril Oct 17, 2022
d63c44e
Cleanup output channels
Veykril Oct 17, 2022
067c410
Auto merge of #13426 - Veykril:client-refactor, r=Veykril
bors Oct 17, 2022
e41023c
Make flycheck workdone progress reports cancellable
Veykril Oct 17, 2022
106285b
Auto merge of #13427 - Veykril:cancel-check, r=Veykril
bors Oct 17, 2022
a762bac
fix: Fix formatting requests hanging when r-a is still starting
Veykril Oct 17, 2022
4d4c05d
Auto merge of #13428 - Veykril:fmt-stuck, r=Veykril
bors Oct 17, 2022
8047512
Revert "feat: Diagnose some incorrect usages of the question mark ope…
Veykril Oct 18, 2022
97b357e
Auto merge of #13433 - rust-lang:revert-13354-try-stuff, r=Veykril
bors Oct 18, 2022
9d3e616
Simplify
Veykril Oct 19, 2022
3392573
Auto merge of #13439 - Veykril:simplify, r=Veykril
bors Oct 19, 2022
653dafa
Add some sysroot logging
Veykril Oct 19, 2022
82ac6f7
Auto merge of #13441 - Veykril:sysroot-logging, r=Veykril
bors Oct 19, 2022
7e2c41d
Implement invocation strategy config for build scripts
Veykril Aug 27, 2022
4a287d2
Implement invocation strategy config for checkOnSave
Veykril Sep 15, 2022
5174b65
Use correct invocation strategy config for checkOnSave
Veykril Sep 15, 2022
7db5029
{manifest-path} interpolation
Veykril Sep 26, 2022
4673236
Remove simplistic interpolation for manifest-path
Veykril Oct 19, 2022
a77ac93
Auto merge of #13128 - Veykril:invocation-strategy, r=Veykril
bors Oct 19, 2022
69b8456
Don't catch the server activation error
Veykril Oct 20, 2022
32614e2
Auto merge of #13444 - Veykril:rethrow-err, r=Veykril
bors Oct 20, 2022
5bff6c5
feat: add multiple getters mode in `generate_getter`
feniljain Oct 7, 2022
f3cce5f
Auto merge of #13365 - feniljain:master, r=Veykril
bors Oct 20, 2022
de195ff
fix: Fix DidSaveDocument requests blocking the server on startup
Veykril Oct 20, 2022
e05df93
Workaround the python vscode extension's polyfill
yotamofek Oct 20, 2022
7741e3d
Auto merge of #13448 - yotamofek:python-ext-polyfill-workaround, r=Ve…
bors Oct 20, 2022
2481721
Auto merge of #13447 - Veykril:didsavedoc-block, r=Veykril
bors Oct 20, 2022
a8e0a20
internal: Properly handle language configuration config changes
Veykril Oct 20, 2022
69f01fd
Auto merge of #13451 - Veykril:lang-config, r=Veykril
bors Oct 20, 2022
1cb4607
internal: Properly handle commands in the VSCode client when the serv…
Veykril Oct 21, 2022
8ee23f4
Auto merge of #13453 - Veykril:disabled-commands, r=Veykril
bors Oct 21, 2022
7ee7225
scip: minor clean-ups
emilio Oct 22, 2022
bd49d01
ide: Remove unnecessary continue.
emilio Oct 22, 2022
ec6d72b
scip: Rewrite tests to be closer to what we actually do.
emilio Oct 21, 2022
b643dd6
Auto merge of #13461 - emilio:ide-cleanup-continue, r=Veykril
bors Oct 22, 2022
d3b7e94
Auto merge of #13460 - emilio:scip-cleanups, r=Veykril
bors Oct 22, 2022
6459d7f
Support const generics for builtin derive macro
lowr Oct 22, 2022
19efa0b
Auto merge of #13463 - lowr:fix/builtin-derive-with-const-generics, r…
bors Oct 22, 2022
0f8904e
Implement invocation location config
Veykril Oct 22, 2022
b25f657
Auto merge of #13466 - Veykril:invocation-location, r=Veykril
bors Oct 22, 2022
859f559
Handle multiple projects sharing dependency correctly in `once` strategy
Veykril Oct 23, 2022
43fb956
Auto merge of #13471 - Veykril:invoc-strategy-once, r=Veykril
bors Oct 23, 2022
8b984e5
fake capture if min_captures empty
ouz-a Aug 11, 2022
ba847ca
Enable varargs support for calling conventions other than C or cdecl
Soveu Aug 8, 2022
65ef625
Apply suggestions from code review
jackh726 Aug 16, 2022
de78c32
Cleanup message and bless tests
jackh726 Oct 23, 2022
63d1a72
rustdoc: don't mark Box<T> as Iterator, Read, etc
jsha Oct 23, 2022
c246a3d
more dupe typos again
Rageking8 Oct 25, 2022
626d7fc
rustdoc: combine shared CSS between `.*-line-numbers`
notriddle Oct 25, 2022
6ea75ae
llvm-16: Don't initialize removed legacy passes
maurer Oct 25, 2022
67c4c1f
Update cargo
weihanglo Oct 26, 2022
0c4a01a
check lld version to choose correct flag for tests
belovdv Sep 21, 2022
99a74af
ptr::eq: clarify that comparing dyn Trait is fragile
RalfJung Oct 26, 2022
1946a18
explicitly mention that both components of wide prts are compared
RalfJung Oct 26, 2022
22a6bc4
:arrow_up: rust-analyzer
lnicola Oct 26, 2022
cce46e9
Fix typo in docs for `guaranteed_ne`
Oct 26, 2022
8b001e6
Rollup merge of #97971 - Soveu:varargs, r=jackh726
compiler-errors Oct 26, 2022
355e23e
Rollup merge of #100452 - ouz-a:issue-93242, r=jackh726
compiler-errors Oct 26, 2022
485adb5
Rollup merge of #102101 - BelovDV:new-check-lld-version, r=petrochenkov
compiler-errors Oct 26, 2022
978597f
Rollup merge of #103432 - jsha:box-is-not-notable, r=GuillaumeGomez
compiler-errors Oct 26, 2022
150dbca
Rollup merge of #103526 - Rageking8:more-dupe-typos-again, r=Mark-Sim…
compiler-errors Oct 26, 2022
c5b04de
Rollup merge of #103537 - notriddle:notriddle/line-numbers, r=Guillau…
compiler-errors Oct 26, 2022
758a99f
Rollup merge of #103549 - maurer:llvm-main, r=cuviper
compiler-errors Oct 26, 2022
29ad394
Rollup merge of #103558 - weihanglo:update-cargo, r=weihanglo
compiler-errors Oct 26, 2022
f619f01
Rollup merge of #103567 - RalfJung:ptr-eq-dyn-trait, r=dtolnay
compiler-errors Oct 26, 2022
2f21ead
Rollup merge of #103579 - lnicola:rust-analyzer-2022-10-26, r=lnicola
compiler-errors Oct 26, 2022
39796bd
Rollup merge of #103580 - lukas-code:guaranteed_ne, r=GuillaumeGomez
compiler-errors Oct 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove simplistic interpolation for manifest-path
  • Loading branch information
Veykril committed Oct 19, 2022
commit 46732369f4b8246e6dc764ef1aa01d03ab5f52b7
26 changes: 5 additions & 21 deletions crates/flycheck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub use cargo_metadata::diagnostic::{

#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum InvocationStrategy {
OnceInRoot,
Once,
#[default]
PerWorkspace,
}
Expand Down Expand Up @@ -317,26 +317,10 @@ impl FlycheckActor {
(cmd, args, invocation_strategy)
}
};
if let InvocationStrategy::PerWorkspace = invocation_strategy {
let mut with_manifest_path = false;
for arg in args {
if let Some(_) = arg.find("$manifest_path") {
with_manifest_path = true;
cmd.arg(arg.replace(
"$manifest_path",
&self.root.join("Cargo.toml").display().to_string(),
));
} else {
cmd.arg(arg);
}
}

if !with_manifest_path {
cmd.current_dir(&self.root);
}
} else {
cmd.args(args);
}
match invocation_strategy {
InvocationStrategy::PerWorkspace => cmd.current_dir(&self.root),
InvocationStrategy::Once => cmd.args(args),
};
cmd
}

Expand Down
27 changes: 2 additions & 25 deletions crates/project-model/src/build_scripts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,7 @@ impl WorkspaceBuildScripts {
let mut cmd = match config.run_build_script_command.as_deref() {
Some([program, args @ ..]) => {
let mut cmd = Command::new(program);

// FIXME: strategy and workspace root are coupled, express that in code
if let (InvocationStrategy::PerWorkspace, Some(workspace_root)) =
(config.invocation_strategy, workspace_root)
{
let mut with_manifest_path = false;
for arg in args {
if let Some(_) = arg.find("$manifest_path") {
with_manifest_path = true;
cmd.arg(arg.replace(
"$manifest_path",
&workspace_root.join("Cargo.toml").display().to_string(),
));
} else {
cmd.arg(arg);
}
}

if !with_manifest_path {
cmd.current_dir(workspace_root);
}
} else {
cmd.args(args);
}
cmd.args(args);
cmd
}
_ => {
Expand Down Expand Up @@ -176,7 +153,7 @@ impl WorkspaceBuildScripts {
workspaces: &[&CargoWorkspace],
progress: &dyn Fn(String),
) -> io::Result<Vec<WorkspaceBuildScripts>> {
assert_eq!(config.invocation_strategy, InvocationStrategy::OnceInRoot);
assert_eq!(config.invocation_strategy, InvocationStrategy::Once);
let cmd = Self::build_command(config, None)?;
// NB: Cargo.toml could have been modified between `cargo metadata` and
// `cargo check`. We shouldn't assume that package ids we see here are
Expand Down
2 changes: 1 addition & 1 deletion crates/project-model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fn utf8_stdout(mut cmd: Command) -> Result<String> {

#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum InvocationStrategy {
OnceInRoot,
Once,
#[default]
PerWorkspace,
}
30 changes: 11 additions & 19 deletions crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,9 @@ config_data! {
/// Run build scripts (`build.rs`) for more precise code analysis.
cargo_buildScripts_enable: bool = "true",
/// Specifies the invocation strategy to use when running the build scripts command.
/// If `per_workspace` is set, the command will be executed for each workspace and all
/// occurrences of `$manifest_path` in the command will be replaced by the corresponding
/// manifest path of the workspace that the command is being invoked for. If interpolation
/// for the manifest path happens at least once, the commands will be executed from the
/// project root, otherwise the commands will be executed from the corresponding workspace
/// root.
/// If `once_in_root` is set, the command will be executed once in the project root.
/// If `per_workspace` is set, the command will be executed for each workspace from the
/// corresponding workspace root.
/// If `once` is set, the command will be executed once in the project root.
/// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
/// is set.
cargo_buildScripts_invocationStrategy: InvocationStrategy = "\"per_workspace\"",
Expand Down Expand Up @@ -134,13 +130,9 @@ config_data! {
/// Set to `"all"` to pass `--all-features` to Cargo.
checkOnSave_features: Option<CargoFeaturesDef> = "null",
/// Specifies the invocation strategy to use when running the checkOnSave command.
/// If `per_workspace` is set, the command will be executed for each workspace and all
/// occurrences of `$manifest_path` in the command will be replaced by the corresponding
/// manifest path of the workspace that the command is being invoked for. If interpolation
/// for the manifest path happens at least once, the commands will be executed from the
/// project root, otherwise the commands will be executed from the corresponding workspace
/// root.
/// If `once_in_root` is set, the command will be executed once in the project root.
/// If `per_workspace` is set, the command will be executed for each workspace from the
/// corresponding workspace root.
/// If `once` is set, the command will be executed once in the project root.
/// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
/// is set.
checkOnSave_invocationStrategy: InvocationStrategy = "\"per_workspace\"",
Expand Down Expand Up @@ -1079,7 +1071,7 @@ impl Config {
unset_test_crates: UnsetTestCrates::Only(self.data.cargo_unsetTest.clone()),
wrap_rustc_in_build_scripts: self.data.cargo_buildScripts_useRustcWrapper,
invocation_strategy: match self.data.cargo_buildScripts_invocationStrategy {
InvocationStrategy::OnceInRoot => project_model::InvocationStrategy::OnceInRoot,
InvocationStrategy::Once => project_model::InvocationStrategy::Once,
InvocationStrategy::PerWorkspace => project_model::InvocationStrategy::PerWorkspace,
},
run_build_script_command: self.data.cargo_buildScripts_overrideCommand.clone(),
Expand All @@ -1106,7 +1098,7 @@ impl Config {
return None;
}
let invocation_strategy = match self.data.checkOnSave_invocationStrategy {
InvocationStrategy::OnceInRoot => flycheck::InvocationStrategy::OnceInRoot,
InvocationStrategy::Once => flycheck::InvocationStrategy::Once,
InvocationStrategy::PerWorkspace => flycheck::InvocationStrategy::PerWorkspace,
};
let flycheck_config = match &self.data.checkOnSave_overrideCommand {
Expand Down Expand Up @@ -1622,7 +1614,7 @@ enum CargoFeaturesDef {
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
enum InvocationStrategy {
OnceInRoot,
Once,
PerWorkspace,
}

Expand Down Expand Up @@ -2042,9 +2034,9 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
},
"InvocationStrategy" => set! {
"type": "string",
"enum": ["per_workspace", "once_in_root"],
"enum": ["per_workspace", "once"],
"enumDescriptions": [
"The command will be executed for each workspace and `{manifest-path}` usages will be interpolated with the corresponding workspace manifests. If `{manifest-path}` is used, the commands will be executed in the project root, otherwise in the corresponding workspace roots.",
"The command will be executed for each workspace from the corresponding workspace root.",
"The command will be executed once in the project root."
],
},
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ impl GlobalState {
| FlycheckConfig::CustomCommand { invocation_strategy, .. }) = config;

self.flycheck = match invocation_strategy {
flycheck::InvocationStrategy::OnceInRoot => vec![FlycheckHandle::spawn(
flycheck::InvocationStrategy::Once => vec![FlycheckHandle::spawn(
0,
Box::new(move |msg| sender.send(msg).unwrap()),
config.clone(),
Expand Down
20 changes: 6 additions & 14 deletions docs/user/generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ Run build scripts (`build.rs`) for more precise code analysis.
+
--
Specifies the invocation strategy to use when running the build scripts command.
If `per_workspace` is set, the command will be executed for each workspace and all
occurrences of `$manifest_path` in the command will be replaced by the corresponding
manifest path of the workspace that the command is being invoked for. If interpolation
for the manifest path happens at least once, the commands will be executed from the
project root, otherwise the commands will be executed from the corresponding workspace
root.
If `once_in_root` is set, the command will be executed once in the project root.
If `per_workspace` is set, the command will be executed for each workspace from the
corresponding workspace root.
If `once` is set, the command will be executed once in the project root.
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
is set.
--
Expand Down Expand Up @@ -136,13 +132,9 @@ Set to `"all"` to pass `--all-features` to Cargo.
+
--
Specifies the invocation strategy to use when running the checkOnSave command.
If `per_workspace` is set, the command will be executed for each workspace and all
occurrences of `$manifest_path` in the command will be replaced by the corresponding
manifest path of the workspace that the command is being invoked for. If interpolation
for the manifest path happens at least once, the commands will be executed from the
project root, otherwise the commands will be executed from the corresponding workspace
root.
If `once_in_root` is set, the command will be executed once in the project root.
If `per_workspace` is set, the command will be executed for each workspace from the
corresponding workspace root.
If `once` is set, the command will be executed once in the project root.
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
is set.
--
Expand Down
12 changes: 6 additions & 6 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@
"type": "boolean"
},
"rust-analyzer.cargo.buildScripts.invocationStrategy": {
"markdownDescription": "Specifies the invocation strategy to use when running the build scripts command.\nIf `per_workspace` is set, the command will be executed for each workspace and all\noccurrences of `$manifest_path` in the command will be replaced by the corresponding\nmanifest path of the workspace that the command is being invoked for. If interpolation\nfor the manifest path happens at least once, the commands will be executed from the\nproject root, otherwise the commands will be executed from the corresponding workspace\nroot.\nIf `once_in_root` is set, the command will be executed once in the project root.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
"markdownDescription": "Specifies the invocation strategy to use when running the build scripts command.\nIf `per_workspace` is set, the command will be executed for each workspace from the\ncorresponding workspace root.\nIf `once` is set, the command will be executed once in the project root.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
"default": "per_workspace",
"type": "string",
"enum": [
"per_workspace",
"once_in_root"
"once"
],
"enumDescriptions": [
"The command will be executed for each workspace and `{manifest-path}` usages will be interpolated with the corresponding workspace manifests. If `{manifest-path}` is used, the commands will be executed in the project root, otherwise in the corresponding workspace roots.",
"The command will be executed for each workspace from the corresponding workspace root.",
"The command will be executed once in the project root."
]
},
Expand Down Expand Up @@ -560,15 +560,15 @@
]
},
"rust-analyzer.checkOnSave.invocationStrategy": {
"markdownDescription": "Specifies the invocation strategy to use when running the checkOnSave command.\nIf `per_workspace` is set, the command will be executed for each workspace and all\noccurrences of `$manifest_path` in the command will be replaced by the corresponding\nmanifest path of the workspace that the command is being invoked for. If interpolation\nfor the manifest path happens at least once, the commands will be executed from the\nproject root, otherwise the commands will be executed from the corresponding workspace\nroot.\nIf `once_in_root` is set, the command will be executed once in the project root.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
"markdownDescription": "Specifies the invocation strategy to use when running the checkOnSave command.\nIf `per_workspace` is set, the command will be executed for each workspace from the\ncorresponding workspace root.\nIf `once` is set, the command will be executed once in the project root.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
"default": "per_workspace",
"type": "string",
"enum": [
"per_workspace",
"once_in_root"
"once"
],
"enumDescriptions": [
"The command will be executed for each workspace and `{manifest-path}` usages will be interpolated with the corresponding workspace manifests. If `{manifest-path}` is used, the commands will be executed in the project root, otherwise in the corresponding workspace roots.",
"The command will be executed for each workspace from the corresponding workspace root.",
"The command will be executed once in the project root."
]
},
Expand Down