diff options
| author | Celina G. Val <celinval@amazon.com> | 2023-06-20 10:32:12 -0700 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2023-07-10 10:06:18 -0700 |
| commit | 44d0fce1504a570260deebdadb3b5fcf59eea940 (patch) | |
| tree | 50b74e9c9000d5d50d188ab4adfb7c3a50580e2d /compiler | |
| parent | 05b82e551e781154ad2af8a72f34712e97206859 (diff) | |
| download | rust-44d0fce1504a570260deebdadb3b5fcf59eea940.tar.gz rust-44d0fce1504a570260deebdadb3b5fcf59eea940.zip | |
Fix standalone build
Add extern declarations and optional dependencies to fix build done directly via `cargo build`.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_smir/Cargo.toml | 6 | ||||
| -rw-r--r-- | compiler/rustc_smir/rust-toolchain.toml | 2 | ||||
| -rw-r--r-- | compiler/rustc_smir/src/lib.rs | 10 |
3 files changed, 16 insertions, 2 deletions
diff --git a/compiler/rustc_smir/Cargo.toml b/compiler/rustc_smir/Cargo.toml index a6e6de5f785..80d4e7ed02f 100644 --- a/compiler/rustc_smir/Cargo.toml +++ b/compiler/rustc_smir/Cargo.toml @@ -4,14 +4,18 @@ version = "0.0.0" edition = "2021" [dependencies] -rustc_hir = { path = "../rustc_hir" } +# Use optional dependencies for rustc_* in order to support building this crate separately. +rustc_hir = { path = "../rustc_hir", optional = true } rustc_middle = { path = "../rustc_middle", optional = true } rustc_span = { path = "../rustc_span", optional = true } +rustc_target = { path = "../rustc_target", optional = true } tracing = "0.1" scoped-tls = "1.0" [features] default = [ + "rustc_hir", "rustc_middle", "rustc_span", + "rustc_target", ] diff --git a/compiler/rustc_smir/rust-toolchain.toml b/compiler/rustc_smir/rust-toolchain.toml index 157dfd620ee..d75e8e33b1c 100644 --- a/compiler/rustc_smir/rust-toolchain.toml +++ b/compiler/rustc_smir/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2023-02-28" +channel = "nightly-2023-06-14" components = [ "rustfmt", "rustc-dev" ] diff --git a/compiler/rustc_smir/src/lib.rs b/compiler/rustc_smir/src/lib.rs index fb03633b99b..21c72f3aaa1 100644 --- a/compiler/rustc_smir/src/lib.rs +++ b/compiler/rustc_smir/src/lib.rs @@ -14,6 +14,16 @@ #![feature(local_key_cell_methods)] #![feature(ptr_metadata)] +// Declare extern rustc_* crates to enable building this crate separately from the compiler. +#[cfg(not(feature = "default"))] +extern crate rustc_hir; +#[cfg(not(feature = "default"))] +extern crate rustc_middle; +#[cfg(not(feature = "default"))] +extern crate rustc_span; +#[cfg(not(feature = "default"))] +extern crate rustc_target; + pub mod rustc_internal; pub mod stable_mir; |
