Skip to content
This repository was archived by the owner on Mar 1, 2019. It is now read-only.

Commit 359910b

Browse files
committed
Use a lib/bin project setup
1 parent 037202a commit 359910b

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

src/bin/rustc.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extern crate rls_rustc;
2+
3+
fn main() {
4+
rls_rustc::run();
5+
}

src/main.rs renamed to src/lib.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern crate rustc_errors;
99
extern crate rustc_resolve;
1010
extern crate syntax;
1111

12-
use rustc_driver::{run, run_compiler, CompilerCalls, RustcDefaultCalls, Compilation, enable_save_analysis, get_args};
12+
use rustc_driver::{run_compiler, CompilerCalls, RustcDefaultCalls, Compilation, enable_save_analysis, get_args};
1313
use rustc_driver::driver::CompileController;
1414
use rustc::session::Session;
1515
use rustc::session::config::{self, ErrorOutputType, Input};
@@ -18,6 +18,17 @@ use syntax::ast;
1818
use std::path::PathBuf;
1919
use std::process;
2020

21+
pub fn run() {
22+
env_logger::init().unwrap();
23+
24+
let result = rustc_driver::run(|| run_compiler(&get_args(),
25+
&mut ShimCalls,
26+
None,
27+
None));
28+
process::exit(result as i32);
29+
}
30+
31+
2132
struct ShimCalls;
2233

2334
impl<'a> CompilerCalls<'a> for ShimCalls {
@@ -68,13 +79,3 @@ impl<'a> CompilerCalls<'a> for ShimCalls {
6879
result
6980
}
7081
}
71-
72-
fn main() {
73-
env_logger::init().unwrap();
74-
75-
let result = run(|| run_compiler(&get_args(),
76-
&mut ShimCalls,
77-
None,
78-
None));
79-
process::exit(result as i32);
80-
}

0 commit comments

Comments
 (0)