From f36a93ec52ef6aecfa3eab3f574677f985a94b14 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 29 Dec 2024 13:31:39 +0100 Subject: [PATCH] Inline toolchain_info module --- .../crates/project-model/src/lib.rs | 19 ++++++++++++++++++- .../project-model/src/toolchain_info.rs | 16 ---------------- .../src/toolchain_info/target_triple.rs | 1 + 3 files changed, 19 insertions(+), 17 deletions(-) delete mode 100644 src/tools/rust-analyzer/crates/project-model/src/toolchain_info.rs diff --git a/src/tools/rust-analyzer/crates/project-model/src/lib.rs b/src/tools/rust-analyzer/crates/project-model/src/lib.rs index 2dd9c54e0c72..1913db11fa9b 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/lib.rs +++ b/src/tools/rust-analyzer/crates/project-model/src/lib.rs @@ -16,7 +16,24 @@ //! * Lowering of concrete model to a [`base_db::CrateGraph`] pub mod project_json; -pub mod toolchain_info; +pub mod toolchain_info { + pub mod rustc_cfg; + pub mod target_data_layout; + pub mod target_triple; + + use std::path::Path; + + use crate::{ManifestPath, Sysroot}; + + #[derive(Copy, Clone)] + pub enum QueryConfig<'a> { + /// Directly invoke `rustc` to query the desired information. + Rustc(&'a Sysroot, &'a Path), + /// Attempt to use cargo to query the desired information, honoring cargo configurations. + /// If this fails, falls back to invoking `rustc` directly. + Cargo(&'a Sysroot, &'a ManifestPath), + } +} mod build_dependencies; mod cargo_workspace; diff --git a/src/tools/rust-analyzer/crates/project-model/src/toolchain_info.rs b/src/tools/rust-analyzer/crates/project-model/src/toolchain_info.rs deleted file mode 100644 index 6c8152262c3a..000000000000 --- a/src/tools/rust-analyzer/crates/project-model/src/toolchain_info.rs +++ /dev/null @@ -1,16 +0,0 @@ -pub mod rustc_cfg; -pub mod target_data_layout; -pub mod target_triple; - -use std::path::Path; - -use crate::{ManifestPath, Sysroot}; - -#[derive(Copy, Clone)] -pub enum QueryConfig<'a> { - /// Directly invoke `rustc` to query the desired information. - Rustc(&'a Sysroot, &'a Path), - /// Attempt to use cargo to query the desired information, honoring cargo configurations. - /// If this fails, falls back to invoking `rustc` directly. - Cargo(&'a Sysroot, &'a ManifestPath), -} diff --git a/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_triple.rs b/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_triple.rs index 2d0d4a7c50c2..163884e5e8ba 100644 --- a/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_triple.rs +++ b/src/tools/rust-analyzer/crates/project-model/src/toolchain_info/target_triple.rs @@ -1,3 +1,4 @@ +//! Functionality to discover the current build target(s). use std::path::Path; use anyhow::Context;