Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5f10bb5

Browse files
committedMar 8, 2017
Remove internal liblog
This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
1 parent b04ebef commit 5f10bb5

File tree

30 files changed

+67
-984
lines changed

30 files changed

+67
-984
lines changed
 

‎src/Cargo.lock

Lines changed: 34 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/bootstrap/bin/rustc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ fn main() {
7979
cmd.args(&args)
8080
.arg("--cfg")
8181
.arg(format!("stage{}", stage))
82+
.arg("--cfg").arg("rustbuild")
8283
.env(bootstrap::util::dylib_path_var(),
8384
env::join_paths(&dylib_path).unwrap());
8485

‎src/liblog/Cargo.toml

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎src/liblog/directive.rs

Lines changed: 0 additions & 193 deletions
This file was deleted.

‎src/liblog/lib.rs

Lines changed: 0 additions & 506 deletions
This file was deleted.

‎src/liblog/macros.rs

Lines changed: 0 additions & 205 deletions
This file was deleted.

‎src/librustc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["dylib"]
1212
arena = { path = "../libarena" }
1313
fmt_macros = { path = "../libfmt_macros" }
1414
graphviz = { path = "../libgraphviz" }
15-
log = { path = "../liblog" }
15+
log = "0.3"
1616
rustc_back = { path = "../librustc_back" }
1717
rustc_bitflags = { path = "../librustc_bitflags" }
1818
rustc_const_math = { path = "../librustc_const_math" }

‎src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ pub fn map_crate<'hir>(forest: &'hir mut Forest,
948948
intravisit::walk_crate(&mut collector, &forest.krate);
949949
let map = collector.map;
950950

951-
if log_enabled!(::log::DEBUG) {
951+
if log_enabled!(::log::LogLevel::Debug) {
952952
// This only makes sense for ordered stores; note the
953953
// enumerate to count the number of entries.
954954
let (entries_less_1, _) = map.iter().filter(|&x| {

‎src/librustc_back/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ crate-type = ["dylib"]
1111
[dependencies]
1212
syntax = { path = "../libsyntax" }
1313
serialize = { path = "../libserialize" }
14-
log = { path = "../liblog" }
14+
log = "0.3"
1515

1616
[features]
1717
jemalloc = []

‎src/librustc_borrowck/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010
test = false
1111

1212
[dependencies]
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
syntax = { path = "../libsyntax" }
1515
syntax_pos = { path = "../libsyntax_pos" }
1616
graphviz = { path = "../libgraphviz" }

‎src/librustc_const_eval/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010

1111
[dependencies]
1212
arena = { path = "../libarena" }
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
rustc = { path = "../librustc" }
1515
rustc_back = { path = "../librustc_back" }
1616
rustc_const_math = { path = "../librustc_const_math" }

‎src/librustc_data_structures/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ path = "lib.rs"
99
crate-type = ["dylib"]
1010

1111
[dependencies]
12-
log = { path = "../liblog" }
12+
log = "0.3"
1313
serialize = { path = "../libserialize" }

‎src/librustc_driver/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ crate-type = ["dylib"]
1111
[dependencies]
1212
arena = { path = "../libarena" }
1313
graphviz = { path = "../libgraphviz" }
14-
log = { path = "../liblog" }
14+
log = { version = "0.3", features = ["release_max_level_info"] }
15+
env_logger = { version = "0.4", default-features = false }
1516
proc_macro_plugin = { path = "../libproc_macro_plugin" }
1617
rustc = { path = "../librustc" }
1718
rustc_back = { path = "../librustc_back" }

‎src/librustc_driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ pub fn compile_input(sess: &Session,
195195

196196
result?;
197197

198-
if log_enabled!(::log::INFO) {
198+
if log_enabled!(::log::LogLevel::Info) {
199199
println!("Pre-trans");
200200
tcx.print_debug_stats();
201201
}
202202
let trans = phase_4_translate_to_llvm(tcx, analysis, &incremental_hashes_map);
203203

204-
if log_enabled!(::log::INFO) {
204+
if log_enabled!(::log::LogLevel::Info) {
205205
println!("Post-trans");
206206
tcx.print_debug_stats();
207207
}

‎src/librustc_driver/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
extern crate arena;
3636
extern crate getopts;
3737
extern crate graphviz;
38+
extern crate env_logger;
3839
extern crate libc;
3940
extern crate rustc;
4041
extern crate rustc_back;
@@ -1127,6 +1128,7 @@ pub fn diagnostics_registry() -> errors::registry::Registry {
11271128
}
11281129

11291130
pub fn main() {
1131+
env_logger::init().unwrap();
11301132
let result = run(|| run_compiler(&env::args().collect::<Vec<_>>(),
11311133
&mut RustcDefaultCalls,
11321134
None,

‎src/librustc_incremental/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ graphviz = { path = "../libgraphviz" }
1313
rustc = { path = "../librustc" }
1414
rustc_data_structures = { path = "../librustc_data_structures" }
1515
serialize = { path = "../libserialize" }
16-
log = { path = "../liblog" }
16+
log = "0.3"
1717
syntax = { path = "../libsyntax" }
1818
syntax_pos = { path = "../libsyntax_pos" }

‎src/librustc_lint/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010
test = false
1111

1212
[dependencies]
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
rustc = { path = "../librustc" }
1515
rustc_back = { path = "../librustc_back" }
1616
rustc_const_eval = { path = "../librustc_const_eval" }

‎src/librustc_metadata/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010

1111
[dependencies]
1212
flate = { path = "../libflate" }
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
proc_macro = { path = "../libproc_macro" }
1515
rustc = { path = "../librustc" }
1616
rustc_back = { path = "../librustc_back" }

‎src/librustc_metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ impl<'a> middle::cstore::CrateLoader for CrateLoader<'a> {
10551055
self.inject_allocator_crate();
10561056
self.inject_panic_runtime(krate);
10571057

1058-
if log_enabled!(log::INFO) {
1058+
if log_enabled!(log::LogLevel::Info) {
10591059
dump_crates(&self.cstore);
10601060
}
10611061

‎src/librustc_mir/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010

1111
[dependencies]
1212
graphviz = { path = "../libgraphviz" }
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
rustc = { path = "../librustc" }
1515
rustc_const_eval = { path = "../librustc_const_eval" }
1616
rustc_const_math = { path = "../librustc_const_math" }

‎src/librustc_passes/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ path = "lib.rs"
99
crate-type = ["dylib"]
1010

1111
[dependencies]
12-
log = { path = "../liblog" }
12+
log = "0.3"
1313
rustc = { path = "../librustc" }
1414
rustc_const_eval = { path = "../librustc_const_eval" }
1515
rustc_const_math = { path = "../librustc_const_math" }
1616
syntax = { path = "../libsyntax" }
1717
syntax_pos = { path = "../libsyntax_pos" }
18-
rustc_errors = { path = "../librustc_errors" }
18+
rustc_errors = { path = "../librustc_errors" }

‎src/librustc_resolve/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010
test = false
1111

1212
[dependencies]
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
syntax = { path = "../libsyntax" }
1515
rustc = { path = "../librustc" }
1616
arena = { path = "../libarena" }

‎src/librustc_save_analysis/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ path = "lib.rs"
99
crate-type = ["dylib"]
1010

1111
[dependencies]
12-
log = { path = "../liblog" }
12+
log = "0.3"
1313
rustc = { path = "../librustc" }
1414
syntax = { path = "../libsyntax" }
1515
serialize = { path = "../libserialize" }
16-
syntax_pos = { path = "../libsyntax_pos" }
16+
syntax_pos = { path = "../libsyntax_pos" }

‎src/librustc_trans/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test = false
1111

1212
[dependencies]
1313
flate = { path = "../libflate" }
14-
log = { path = "../liblog" }
14+
log = "0.3"
1515
rustc = { path = "../librustc" }
1616
rustc_back = { path = "../librustc_back" }
1717
rustc_bitflags = { path = "../librustc_bitflags" }

‎src/librustc_typeck/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010
test = false
1111

1212
[dependencies]
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
syntax = { path = "../libsyntax" }
1515
arena = { path = "../libarena" }
1616
fmt_macros = { path = "../libfmt_macros" }

‎src/librustdoc/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ crate-type = ["dylib"]
1111

1212
[dependencies]
1313
arena = { path = "../libarena" }
14+
env_logger = { version = "0.4", default-features = false }
15+
log = "0.3"
1416
rustc = { path = "../librustc" }
1517
rustc_back = { path = "../librustc_back" }
1618
rustc_const_eval = { path = "../librustc_const_eval" }
17-
rustc_driver = { path = "../librustc_driver" }
1819
rustc_data_structures = { path = "../librustc_data_structures" }
20+
rustc_driver = { path = "../librustc_driver" }
1921
rustc_errors = { path = "../librustc_errors" }
2022
rustc_lint = { path = "../librustc_lint" }
2123
rustc_metadata = { path = "../librustc_metadata" }
@@ -24,7 +26,6 @@ rustc_trans = { path = "../librustc_trans" }
2426
serialize = { path = "../libserialize" }
2527
syntax = { path = "../libsyntax" }
2628
syntax_pos = { path = "../libsyntax_pos" }
27-
log = { path = "../liblog" }
2829

2930
[build-dependencies]
3031
build_helper = { path = "../build_helper" }

‎src/librustdoc/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
extern crate arena;
3232
extern crate getopts;
33+
extern crate env_logger;
3334
extern crate libc;
3435
extern crate rustc;
3536
extern crate rustc_const_eval;
@@ -99,6 +100,7 @@ struct Output {
99100

100101
pub fn main() {
101102
const STACK_SIZE: usize = 32_000_000; // 32MB
103+
env_logger::init().unwrap();
102104
let res = std::thread::Builder::new().stack_size(STACK_SIZE).spawn(move || {
103105
let s = env::args().collect::<Vec<_>>();
104106
main_args(&s)

‎src/libsyntax/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010

1111
[dependencies]
1212
serialize = { path = "../libserialize" }
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
rustc_bitflags = { path = "../librustc_bitflags" }
1515
syntax_pos = { path = "../libsyntax_pos" }
1616
rustc_errors = { path = "../librustc_errors" }

‎src/libsyntax_ext/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["dylib"]
1010

1111
[dependencies]
1212
fmt_macros = { path = "../libfmt_macros" }
13-
log = { path = "../liblog" }
13+
log = "0.3"
1414
proc_macro = { path = "../libproc_macro" }
1515
rustc_errors = { path = "../librustc_errors" }
1616
syntax = { path = "../libsyntax" }

‎src/tools/compiletest/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ version = "0.0.0"
55

66
[dependencies]
77
log = "0.3"
8-
env_logger = { version = "0.3.5", default-features = false }
8+
env_logger = { version = "0.4", default-features = false }
99
rustc-serialize = "0.3"
1010
filetime = "0.1"

0 commit comments

Comments
 (0)
Please sign in to comment.