I'm trying to use rustc crate in my program.
#[macro_use]
extern crate rustc;
extern crate rustc_typeck;
extern crate syntax;
extern crate syntax_pos;
use rustc::hir;
fn main() {
println!("Hello, world!");
}
I also added extra dependency in Cargo.toml file.
[dependencies]
log = "0.4.1"
cargo run emits bunch of errors that it's private and nightly only.
error: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> src/main.rs:2:1
|
2 | extern crate rustc;
| ^^^^^^^^^^^^^^^^^^^
It seems Cargo want a stable crate from crates.io, but I don't know which crate I should use. There's no crate named rustc on crates.io.
Here's my Rust installation version.
- rustc 1.23.0 (766bd11c8 2018-01-01)
- cargo 0.24.0 (45043115c 2017-12-05)
I installed it using rustup.
How can I use rustc crate for my program?
Update
I added rustc = "1.23.0" to Cargo.toml, but it still doesn't work with this error.
error: no matching package named `rustc` found (required by `rust-swift-serde-gen`)
rustcin yourCargo.toml? - tadmanrustccrate oncrates.io. - eonilCargo.tomlto pull down that dependency instead of using the private one that ships with Rust. Just add that line and try it! - tadmanerror: no matching package named `rustc` found (required by `rust-swift-serde-gen`)... So sad. - eonil