Fix standalone build
Add extern declarations and optional dependencies to fix build done directly via `cargo build`.
This commit is contained in:
parent
05b82e551e
commit
44d0fce150
4 changed files with 17 additions and 2 deletions
|
@ -4235,6 +4235,7 @@ dependencies = [
|
|||
"rustc_middle",
|
||||
"rustc_span",
|
||||
"scoped-tls",
|
||||
"rustc_target",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2023-02-28"
|
||||
channel = "nightly-2023-06-14"
|
||||
components = [ "rustfmt", "rustc-dev" ]
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue