From 61ee1089f0286e86efc268e970df62a7bbe6636f Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 16 Feb 2021 22:25:41 -0500 Subject: [PATCH] Use `rustc_private` instead of crates.io dependencies - Update rust-toolchain to also install `rustc-dev` component --- Cargo.toml | 32 +------------------------------- config_proc_macro/src/lib.rs | 2 -- rust-toolchain | 4 +++- src/attr.rs | 2 +- src/lib.rs | 11 +++++++++++ 5 files changed, 16 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f02d205c049..184c553db1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,34 +64,4 @@ thiserror = "1.0" # for more information. rustc-workspace-hack = "1.0.0" -[dependencies.rustc_ast] -package = "rustc-ap-rustc_ast" -version = "712.0.0" - -[dependencies.rustc_ast_pretty] -package = "rustc-ap-rustc_ast_pretty" -version = "712.0.0" - -[dependencies.rustc_data_structures] -package = "rustc-ap-rustc_data_structures" -version = "712.0.0" - -[dependencies.rustc_errors] -package = "rustc-ap-rustc_errors" -version = "712.0.0" - -[dependencies.rustc_expand] -package = "rustc-ap-rustc_expand" -version = "712.0.0" - -[dependencies.rustc_parse] -package = "rustc-ap-rustc_parse" -version = "712.0.0" - -[dependencies.rustc_session] -package = "rustc-ap-rustc_session" -version = "712.0.0" - -[dependencies.rustc_span] -package = "rustc-ap-rustc_span" -version = "712.0.0" +# Rustc dependencies are loaded from the sysroot, Cargo doesn't know about them. diff --git a/config_proc_macro/src/lib.rs b/config_proc_macro/src/lib.rs index 66cfd3c727d..78e7e098ed9 100644 --- a/config_proc_macro/src/lib.rs +++ b/config_proc_macro/src/lib.rs @@ -2,8 +2,6 @@ #![recursion_limit = "256"] -extern crate proc_macro; - mod attrs; mod config_type; mod item_enum; diff --git a/rust-toolchain b/rust-toolchain index 0cb2de6a3fb..c06f7353dfb 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1,3 @@ -nightly-2021-03-26 +[toolchain] +channel = "nightly-2021-03-26" +components = ["rustc-dev"] diff --git a/src/attr.rs b/src/attr.rs index 015e9f9b252..0e8b3072017 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -376,7 +376,7 @@ impl Rewrite for ast::Attribute { } } -impl<'a> Rewrite for [ast::Attribute] { +impl Rewrite for [ast::Attribute] { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { if self.is_empty() { return Some(String::new()); diff --git a/src/lib.rs b/src/lib.rs index db48b52f440..8a798777e0e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#![feature(rustc_private)] #![deny(rust_2018_idioms)] #![warn(unreachable_pub)] @@ -9,6 +10,16 @@ extern crate lazy_static; #[macro_use] extern crate log; +// N.B. these crates are loaded from the sysroot, so they need extern crate. +extern crate rustc_ast; +extern crate rustc_ast_pretty; +extern crate rustc_data_structures; +extern crate rustc_errors; +extern crate rustc_expand; +extern crate rustc_parse; +extern crate rustc_session; +extern crate rustc_span; + use std::cell::RefCell; use std::collections::HashMap; use std::fmt;