Skip to content
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

Subtree update of rust-analyzer #125576

Merged
merged 45 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
39a653f
Fix coercion of async block
Kohei316 Apr 26, 2024
dd16cbc
braces around {self} in UseTree are not unnecessary
harrysarson Apr 25, 2024
1287e86
Clear diagnostics only after new ones were received
mladedav May 16, 2024
ea2a16c
fix: resolve extern prelude for local mods in block modules
roife May 17, 2024
9ff4ffb
Update builtin tool list
Veykril May 18, 2024
7045044
Allow hir::Param to refer to other entity params aside from functions
Veykril May 18, 2024
4b3d7f6
Render closure fn trait kind in siganture help
Veykril May 18, 2024
f42e55d
Enable linked locations for closure param inlay hints
Veykril May 18, 2024
6438554
Show fn traits in signature info for trait implementors
Veykril May 18, 2024
719eee2
test: add tests for extern preludes resolving in local mods
roife May 21, 2024
5992af6
fix: Fix general find-path inconsistencies
Veykril May 22, 2024
b29c755
expectify find_path tests
Veykril May 22, 2024
b1830a5
Update assists test fixtures
Veykril May 22, 2024
24bf53d
Auto merge of #17268 - Veykril:signatures, r=Veykril
bors May 22, 2024
39e6032
Auto merge of #17248 - mladedav:dm/delay-clear, r=Veykril
bors May 22, 2024
2ff9bab
fix: Fix format_args lowering passing incorrect parameters to rustc_p…
Veykril May 22, 2024
d9dda8f
Auto merge of #17279 - Veykril:format_args-escape, r=Veykril
bors May 22, 2024
ad810a5
Auto merge of #17277 - Veykril:find-path-fixes, r=Veykril
bors May 22, 2024
4e9b128
fix: check pseudo-block by local_id instead of ModuleOrigin
roife May 22, 2024
7a21dff
internal: refactor `prefer_no_std`/`prefer_prelude` bools into a struct
davidbarsky May 17, 2024
f50f8fb
Simplify
Veykril May 22, 2024
56ce7e0
Auto merge of #17252 - davidbarsky:david/refactor-standalone-bools-in…
bors May 22, 2024
0916e72
Auto merge of #17251 - roife:fix-issue-17057, r=Veykril
bors May 22, 2024
f2c3ef7
fix: ensure implied bounds from associated types are considered in au…
davidbarsky May 22, 2024
ac2708a
Auto merge of #17270 - davidbarsky:david/fix-completions-from-associa…
bors May 22, 2024
68fe34a
Auto merge of #17140 - harrysarson:harry-unused-self, r=Veykril
bors May 23, 2024
425ed6a
Update crates/hir-ty/src/infer/expr.rs
Veykril May 23, 2024
6e8646d
Auto merge of #17174 - Kohei316:fix-infer-async-block-with-tail-retur…
bors May 23, 2024
616fdd0
Use correct toolchain channel when generating builtin type doc links
Veykril May 23, 2024
ecadf37
Auto merge of #17284 - Veykril:doc-links, r=Veykril
bors May 23, 2024
f93256c
Allow sysroots to only consist of the source root dir
Veykril May 23, 2024
6259991
Auto merge of #17287 - Veykril:sysroot-encode-empty, r=Veykril
bors May 23, 2024
d83b267
Add cwd to CargoRunnable
roife May 22, 2024
7b54c82
Revert "Debug use cargo workspace root as cwd. fixes #13022"
roife May 22, 2024
1a37cfb
Use cwd from runnable.args for debugger
roife May 22, 2024
c10bda5
Update docs
roife May 22, 2024
3c7a13d
tests: update test for runnables
roife May 22, 2024
56d77b9
Auto merge of #17275 - roife:fix-issue-17012, r=Veykril
bors May 24, 2024
2315c6b
Use correct format for setting environment variables when debugging w…
0xJonas May 25, 2024
78fe45e
Semicolon
0xJonas May 25, 2024
09677b0
Formatting
0xJonas May 25, 2024
afa8dfc
Avoid clone when constructing runnable label.
mathew-horner May 25, 2024
eb9894f
Removed return
0xJonas May 25, 2024
bd9cc02
Auto merge of #17295 - 0xJonas:fix_passing_env_vars_to_cpptools, r=Ve…
bors May 26, 2024
f7ca8a6
Auto merge of #17296 - mathew-horner:no-clone-target, r=Veykril
bors May 26, 2024
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
Allow sysroots to only consist of the source root dir
  • Loading branch information
Veykril committed May 23, 2024
commit f93256ca42afb93f2dada055bb695c30d7abccb3
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/hir-ty/src/layout/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use chalk_ir::{AdtId, TyKind};
use either::Either;
use hir_def::db::DefDatabase;
use project_model::target_data_layout::RustcDataLayoutConfig;
use project_model::{target_data_layout::RustcDataLayoutConfig, Sysroot};
use rustc_hash::FxHashMap;
use test_fixture::WithFixture;
use triomphe::Arc;
Expand All @@ -17,7 +17,7 @@ mod closure;

fn current_machine_data_layout() -> String {
project_model::target_data_layout::get(
RustcDataLayoutConfig::Rustc(None),
RustcDataLayoutConfig::Rustc(&Sysroot::empty()),
None,
&FxHashMap::default(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl WorkspaceBuildScripts {
allowed_features: &FxHashSet<String>,
manifest_path: &ManifestPath,
toolchain: Option<&Version>,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
) -> io::Result<Command> {
const RUST_1_75: Version = Version::new(1, 75, 0);
let mut cmd = match config.run_build_script_command.as_deref() {
Expand All @@ -75,7 +75,7 @@ impl WorkspaceBuildScripts {
cmd
}
_ => {
let mut cmd = Sysroot::tool(sysroot, Tool::Cargo);
let mut cmd = sysroot.tool(Tool::Cargo);

cmd.args(["check", "--quiet", "--workspace", "--message-format=json"]);
cmd.args(&config.extra_args);
Expand Down Expand Up @@ -149,7 +149,7 @@ impl WorkspaceBuildScripts {
workspace: &CargoWorkspace,
progress: &dyn Fn(String),
toolchain: Option<&Version>,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
) -> io::Result<WorkspaceBuildScripts> {
let current_dir = match &config.invocation_location {
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {
Expand Down Expand Up @@ -195,7 +195,7 @@ impl WorkspaceBuildScripts {
// This is not gonna be used anyways, so just construct a dummy here
&ManifestPath::try_from(workspace_root.clone()).unwrap(),
None,
None,
&Sysroot::empty(),
)?;
// 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 Expand Up @@ -412,15 +412,15 @@ impl WorkspaceBuildScripts {
rustc: &CargoWorkspace,
current_dir: &AbsPath,
extra_env: &FxHashMap<String, String>,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
) -> Self {
let mut bs = WorkspaceBuildScripts::default();
for p in rustc.packages() {
bs.outputs.insert(p, BuildScriptOutput::default());
}
let res = (|| {
let target_libdir = (|| {
let mut cargo_config = Sysroot::tool(sysroot, Tool::Cargo);
let mut cargo_config = sysroot.tool(Tool::Cargo);
cargo_config.envs(extra_env);
cargo_config
.current_dir(current_dir)
Expand All @@ -429,7 +429,7 @@ impl WorkspaceBuildScripts {
if let Ok(it) = utf8_stdout(cargo_config) {
return Ok(it);
}
let mut cmd = Sysroot::tool(sysroot, Tool::Rustc);
let mut cmd = sysroot.tool(Tool::Rustc);
cmd.envs(extra_env);
cmd.args(["--print", "target-libdir"]);
utf8_stdout(cmd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ impl CargoWorkspace {
cargo_toml: &ManifestPath,
current_dir: &AbsPath,
config: &CargoConfig,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
progress: &dyn Fn(String),
) -> anyhow::Result<cargo_metadata::Metadata> {
let targets = find_list_of_build_targets(config, cargo_toml, sysroot);

let cargo = Sysroot::tool(sysroot, Tool::Cargo);
let cargo = sysroot.tool(Tool::Cargo);
let mut meta = MetadataCommand::new();
meta.cargo_path(cargo.get_program());
cargo.get_envs().for_each(|(var, val)| _ = meta.env(var, val.unwrap_or_default()));
Expand Down Expand Up @@ -536,7 +536,7 @@ impl CargoWorkspace {
fn find_list_of_build_targets(
config: &CargoConfig,
cargo_toml: &ManifestPath,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
) -> Vec<String> {
if let Some(target) = &config.target {
return [target.into()].to_vec();
Expand All @@ -553,9 +553,9 @@ fn find_list_of_build_targets(
fn rustc_discover_host_triple(
cargo_toml: &ManifestPath,
extra_env: &FxHashMap<String, String>,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
) -> Option<String> {
let mut rustc = Sysroot::tool(sysroot, Tool::Rustc);
let mut rustc = sysroot.tool(Tool::Rustc);
rustc.envs(extra_env);
rustc.current_dir(cargo_toml.parent()).arg("-vV");
tracing::debug!("Discovering host platform by {:?}", rustc);
Expand All @@ -581,9 +581,9 @@ fn rustc_discover_host_triple(
fn cargo_config_build_target(
cargo_toml: &ManifestPath,
extra_env: &FxHashMap<String, String>,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
) -> Vec<String> {
let mut cargo_config = Sysroot::tool(sysroot, Tool::Cargo);
let mut cargo_config = sysroot.tool(Tool::Cargo);
cargo_config.envs(extra_env);
cargo_config
.current_dir(cargo_toml.parent())
Expand Down
4 changes: 2 additions & 2 deletions src/tools/rust-analyzer/crates/project-model/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ pub(crate) fn inject_rustc_tool_env(env: &mut Env, cargo_name: &str, kind: Targe
pub(crate) fn cargo_config_env(
manifest: &ManifestPath,
extra_env: &FxHashMap<String, String>,
sysroot: Option<&Sysroot>,
sysroot: &Sysroot,
) -> FxHashMap<String, String> {
let mut cargo_config = Sysroot::tool(sysroot, Tool::Cargo);
let mut cargo_config = sysroot.tool(Tool::Cargo);
cargo_config.envs(extra_env);
cargo_config
.current_dir(manifest.parent())
Expand Down
8 changes: 4 additions & 4 deletions src/tools/rust-analyzer/crates/project-model/src/rustc_cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use crate::{cfg::CfgFlag, utf8_stdout, ManifestPath, Sysroot};
pub(crate) enum RustcCfgConfig<'a> {
/// Use `rustc --print cfg`, either from with the binary from the sysroot or by discovering via
/// [`toolchain::rustc`].
Rustc(Option<&'a Sysroot>),
Rustc(&'a Sysroot),
/// Use `cargo --print cfg`, either from with the binary from the sysroot or by discovering via
/// [`toolchain::cargo`].
Cargo(Option<&'a Sysroot>, &'a ManifestPath),
Cargo(&'a Sysroot, &'a ManifestPath),
}

pub(crate) fn get(
Expand Down Expand Up @@ -65,7 +65,7 @@ fn get_rust_cfgs(
) -> anyhow::Result<String> {
let sysroot = match config {
RustcCfgConfig::Cargo(sysroot, cargo_toml) => {
let mut cmd = Sysroot::tool(sysroot, Tool::Cargo);
let mut cmd = sysroot.tool(Tool::Cargo);

cmd.envs(extra_env);
cmd.current_dir(cargo_toml.parent())
Expand All @@ -86,7 +86,7 @@ fn get_rust_cfgs(
RustcCfgConfig::Rustc(sysroot) => sysroot,
};

let mut cmd = Sysroot::tool(sysroot, Tool::Rustc);
let mut cmd = sysroot.tool(Tool::Rustc);
cmd.envs(extra_env);
cmd.args(["--print", "cfg", "-O"]);
if let Some(target) = target {
Expand Down
Loading