Skip to content

Commit

Permalink
librustc: De-export driver. rs=deexport
Browse files Browse the repository at this point in the history
  • Loading branch information
pcwalton committed Jan 29, 2013
1 parent b070590 commit 3105bcf
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 242 deletions.
25 changes: 10 additions & 15 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ pub fn WriteOutputFile(sess: Session,
}

pub mod jit {
#[legacy_exports];

use back::link::llvm_err;
use lib::llvm::llvm;
use lib::llvm::{ModuleRef, PassManagerRef, mk_target_data};
Expand All @@ -109,21 +107,20 @@ pub mod jit {

#[nolink]
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn morestack_addr() -> *();
pub extern mod rusti {
pub fn morestack_addr() -> *();
}

struct Closure {
pub struct Closure {
code: *(),
env: *(),
}

fn exec(sess: Session,
pm: PassManagerRef,
m: ModuleRef,
opt: c_int,
stacks: bool) {
pub fn exec(sess: Session,
pm: PassManagerRef,
m: ModuleRef,
opt: c_int,
stacks: bool) {
unsafe {
let manager = llvm::LLVMRustPrepareJIT(rusti::morestack_addr());

Expand Down Expand Up @@ -174,8 +171,6 @@ pub mod jit {
}

mod write {
#[legacy_exports];

use back::link::jit;
use back::link::{ModuleRef, WriteOutputFile, output_type};
use back::link::{output_type_assembly, output_type_bitcode};
Expand All @@ -193,15 +188,15 @@ mod write {
use core::str;
use core::vec;

fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
pub fn is_object_or_assembly_or_exe(ot: output_type) -> bool {
if ot == output_type_assembly || ot == output_type_object ||
ot == output_type_exe {
return true;
}
return false;
}

fn run_passes(sess: Session, llmod: ModuleRef, output: &Path) {
pub fn run_passes(sess: Session, llmod: ModuleRef, output: &Path) {
unsafe {
let opts = sess.opts;
if sess.time_llvm_passes() { llvm::LLVMRustEnableTimePasses(); }
Expand Down
36 changes: 17 additions & 19 deletions src/librustc/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {

#[cfg(unix)]
mod test {
#[legacy_exports];

use core::prelude::*;

use back::rpath::{get_absolute_rpath, get_install_prefix_rpath};
Expand All @@ -221,14 +219,14 @@ mod test {
use core::str;

#[test]
fn test_rpaths_to_flags() {
pub fn test_rpaths_to_flags() {
let flags = rpaths_to_flags(~[Path("path1"),
Path("path2")]);
assert flags == ~[~"-Wl,-rpath,path1", ~"-Wl,-rpath,path2"];
}

#[test]
fn test_prefix_rpath() {
pub fn test_prefix_rpath() {
let res = get_install_prefix_rpath("triple");
let d = Path(env!("CFG_PREFIX"))
.push_rel(&Path("lib/rustc/triple/lib"));
Expand All @@ -239,21 +237,21 @@ mod test {
}

#[test]
fn test_prefix_rpath_abs() {
pub fn test_prefix_rpath_abs() {
let res = get_install_prefix_rpath("triple");
assert res.is_absolute;
}

#[test]
fn test_minimize1() {
pub fn test_minimize1() {
let res = minimize_rpaths([Path("rpath1"),
Path("rpath2"),
Path("rpath1")]);
assert res == ~[Path("rpath1"), Path("rpath2")];
}

#[test]
fn test_minimize2() {
pub fn test_minimize2() {
let res = minimize_rpaths(~[Path("1a"), Path("2"), Path("2"),
Path("1a"), Path("4a"),Path("1a"),
Path("2"), Path("3"), Path("4a"),
Expand All @@ -262,63 +260,63 @@ mod test {
}

#[test]
fn test_relative_to1() {
pub fn test_relative_to1() {
let p1 = Path("/usr/bin/rustc");
let p2 = Path("/usr/lib/mylib");
let res = get_relative_to(&p1, &p2);
assert res == Path("../lib");
}

#[test]
fn test_relative_to2() {
pub fn test_relative_to2() {
let p1 = Path("/usr/bin/rustc");
let p2 = Path("/usr/bin/../lib/mylib");
let res = get_relative_to(&p1, &p2);
assert res == Path("../lib");
}

#[test]
fn test_relative_to3() {
pub fn test_relative_to3() {
let p1 = Path("/usr/bin/whatever/rustc");
let p2 = Path("/usr/lib/whatever/mylib");
let res = get_relative_to(&p1, &p2);
assert res == Path("../../lib/whatever");
}

#[test]
fn test_relative_to4() {
pub fn test_relative_to4() {
let p1 = Path("/usr/bin/whatever/../rustc");
let p2 = Path("/usr/lib/whatever/mylib");
let res = get_relative_to(&p1, &p2);
assert res == Path("../lib/whatever");
}

#[test]
fn test_relative_to5() {
pub fn test_relative_to5() {
let p1 = Path("/usr/bin/whatever/../rustc");
let p2 = Path("/usr/lib/whatever/../mylib");
let res = get_relative_to(&p1, &p2);
assert res == Path("../lib");
}

#[test]
fn test_relative_to6() {
pub fn test_relative_to6() {
let p1 = Path("/1");
let p2 = Path("/2/3");
let res = get_relative_to(&p1, &p2);
assert res == Path("2");
}

#[test]
fn test_relative_to7() {
pub fn test_relative_to7() {
let p1 = Path("/1/2");
let p2 = Path("/3");
let res = get_relative_to(&p1, &p2);
assert res == Path("..");
}

#[test]
fn test_relative_to8() {
pub fn test_relative_to8() {
let p1 = Path("/home/brian/Dev/rust/build/").push_rel(
&Path("stage2/lib/rustc/i686-unknown-linux-gnu/lib/librustc.so"));
let p2 = Path("/home/brian/Dev/rust/build/stage2/bin/..").push_rel(
Expand All @@ -333,7 +331,7 @@ mod test {
#[test]
#[cfg(target_os = "linux")]
#[cfg(target_os = "andorid")]
fn test_rpath_relative() {
pub fn test_rpath_relative() {
let o = session::os_linux;
let res = get_rpath_relative_to_output(o,
&Path("bin/rustc"), &Path("lib/libstd.so"));
Expand All @@ -342,7 +340,7 @@ mod test {

#[test]
#[cfg(target_os = "freebsd")]
fn test_rpath_relative() {
pub fn test_rpath_relative() {
let o = session::os_freebsd;
let res = get_rpath_relative_to_output(o,
&Path("bin/rustc"), &Path("lib/libstd.so"));
Expand All @@ -351,7 +349,7 @@ mod test {

#[test]
#[cfg(target_os = "macos")]
fn test_rpath_relative() {
pub fn test_rpath_relative() {
// this is why refinements would be nice
let o = session::os_macos;
let res = get_rpath_relative_to_output(o,
Expand All @@ -361,7 +359,7 @@ mod test {
}

#[test]
fn test_get_absolute_rpath() {
pub fn test_get_absolute_rpath() {
let res = get_absolute_rpath(&Path("lib/libstd.so"));
debug!("test_get_absolute_rpath: %s vs. %s",
res.to_str(),
Expand Down
Loading

0 comments on commit 3105bcf

Please sign in to comment.