Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove export all #7127

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions src/librustc/middle/trans/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,21 @@ pub fn find_reachable(crate_mod: &_mod, exp_map2: resolve::ExportMap2,
method_map: method_map,
rmap: &mut rmap
};
traverse_public_mod(cx, ast::crate_node_id, crate_mod);
traverse_exports(cx, ast::crate_node_id);
traverse_all_resources_and_impls(cx, crate_mod);
}
return @rmap;
}

fn traverse_exports(cx: @mut ctx, mod_id: node_id) -> bool {
let mut found_export = false;
fn traverse_exports(cx: @mut ctx, mod_id: node_id) {
match cx.exp_map2.find(&mod_id) {
Some(ref exp2s) => {
for (*exp2s).each |e2| {
found_export = true;
traverse_def_id(cx, e2.def_id)
};
}
None => ()
}
return found_export;
}

fn traverse_def_id(cx: @mut ctx, did: def_id) {
Expand All @@ -88,15 +85,6 @@ fn traverse_def_id(cx: @mut ctx, did: def_id) {
}
}

fn traverse_public_mod(cx: @mut ctx, mod_id: node_id, m: &_mod) {
if !traverse_exports(cx, mod_id) {
// No exports, so every local item is exported
for m.items.each |item| {
traverse_public_item(cx, *item);
}
}
}

fn traverse_public_item(cx: @mut ctx, item: @item) {
{
// FIXME #6021: naming rmap shouldn't be necessary
Expand All @@ -107,15 +95,7 @@ fn traverse_public_item(cx: @mut ctx, item: @item) {
}

match item.node {
item_mod(ref m) => traverse_public_mod(cx, item.id, m),
item_foreign_mod(ref nm) => {
if !traverse_exports(cx, item.id) {
for nm.items.each |item| {
let cx = &mut *cx; // FIXME(#6269) reborrow @mut to &mut
cx.rmap.insert(item.id);
}
}
}
item_mod(_) | item_foreign_mod(_) => traverse_exports(cx, item.id),
item_fn(_, _, _, ref generics, ref blk) => {
if generics.ty_params.len() > 0u ||
attr::find_inline_attr(item.attrs) != attr::ia_none {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/borrowck-nested-calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Foo {
}
}

fn main() {
pub fn main() {
let mut f = Foo {a: 22, b: 23};
f.inc_a(f.next_b());
assert_eq!(f.a, 22+23);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/borrowck-unary-move-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn noncopyable() -> noncopyable {

struct wrapper(noncopyable);

fn main() {
pub fn main() {
let x1 = wrapper(noncopyable());
let _x2 = *x1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs


fn main() {
pub fn main() {
let a = @mut [3i];
let b = @mut [a];
let c = @mut b;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/cast-mutable-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn bar(t: @mut T) {
t.foo();
}

fn main() {
pub fn main() {
let s = @mut S { unused: 0 };
let s2 = s as @mut T;
s2.foo();
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/cfgs-on-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn foo2() -> int { 2 }
fn foo2() -> int { 3 }


fn main() {
pub fn main() {
assert_eq!(1, foo1());
assert_eq!(3, foo2());
}
2 changes: 1 addition & 1 deletion src/test/run-pass/cond-macro-no-default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn clamp<T:Copy + Ord + Signed>(x: T, mn: T, mx: T) -> T {
return x;
}

fn main() {
pub fn main() {
assert_eq!(clamp(1, 2, 4), 2);
assert_eq!(clamp(8, 2, 4), 4);
assert_eq!(clamp(3, 2, 4), 3);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/cond-macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn clamp<T:Copy + Ord + Signed>(x: T, mn: T, mx: T) -> T {
)
}

fn main() {
pub fn main() {
assert_eq!(clamp(1, 2, 4), 2);
assert_eq!(clamp(8, 2, 4), 4);
assert_eq!(clamp(3, 2, 4), 3);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-binops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static am: bool = 2 > 1;
static an: bool = 2 > -2;
static ao: bool = 1.0 > -2.0;

fn main() {
pub fn main() {
assert_eq!(a, -1);
assert_eq!(a2, 6);
assert_approx_eq!(b, 5.7);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-cross-crate-const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static foo: &'static str = cci_const::foopy;
static a: uint = cci_const::uint_val;
static b: uint = cci_const::uint_expr + 5;

fn main() {
pub fn main() {
assert_eq!(a, 12);
let foo2 = a;
assert_eq!(foo2, cci_const::uint_val);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/const-struct-offsets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ struct Bar {

static bar: Bar = Bar { i: 0, v: IntVal(0) };

fn main() {}
pub fn main() {}

2 changes: 1 addition & 1 deletion src/test/run-pass/cross-crate-const-pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

extern mod cci_const;

fn main() {
pub fn main() {
let x = cci_const::uint_val;
match x {
cci_const::uint_val => {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/cross-crate-newtype-struct-pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

extern mod newtype_struct_xc;

fn main() {
pub fn main() {
let x = newtype_struct_xc::Au(21);
match x {
newtype_struct_xc::Au(n) => assert_eq!(n, 21)
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/deriving-clone-generic-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum E<T,U> {
C
}

fn main() {
pub fn main() {
let _ = A::<int, int>(1i).clone();
let _ = B(1i, 1.234).deep_clone();
}
2 changes: 1 addition & 1 deletion src/test/run-pass/deriving-clone-generic-tuple-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
#[deriving(Clone, DeepClone)]
struct S<T>(T, ());

fn main() {
pub fn main() {
let _ = S(1i, ()).clone().deep_clone();
}
2 changes: 1 addition & 1 deletion src/test/run-pass/deriving-clone-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ struct S {
_nil: ()
}

fn main() {}
pub fn main() {}
2 changes: 1 addition & 1 deletion src/test/run-pass/deriving-rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum D {
D2 { x: (), y: () }
}

fn main() {
pub fn main() {
// check there's no segfaults
for 20.times {
rand::random::<A>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct A<'self> {
x: &'self int
}

fn main() {
pub fn main() {
let a = A { x: &1 }, b = A { x: &2 };

assert!(a.equals(&a));
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/deriving-self-lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct A<'self> {
x: &'self int
}

fn main() {
pub fn main() {
let a = A { x: &1 };
let b = A { x: &2 };

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/deriving-to-str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum D {
D2 { x: (), y: () }
}

fn main() {
pub fn main() {
macro_rules! t(
($ty:ty) => {{
let x =rand::random::<$ty>();
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/dupe-first-attr.rc
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ mod hello;
#[cfg(target_os = "android")]
mod hello;

fn main() { }
pub fn main() { }
2 changes: 1 addition & 1 deletion src/test/run-pass/expr-repeat-vstore.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::io::println;

fn main() {
pub fn main() {
let v: ~[int] = ~[ 1, ..5 ];
println(v[0].to_str());
println(v[1].to_str());
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/extern-mod-ordering-exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ extern mod extern_mod_ordering_lib;

use extern_mod_ordering_lib::extern_mod_ordering_lib;

fn main() {
pub fn main() {
extern_mod_ordering_lib::f();
}
2 changes: 1 addition & 1 deletion src/test/run-pass/extern-mod-url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
// xfail-test
extern mod test = "github.com/catamorphism/test-pkg";

fn main() {}
pub fn main() {}
2 changes: 1 addition & 1 deletion src/test/run-pass/filter-block-view-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
pub fn main() {
// Make sure that this view item is filtered out because otherwise it would
// trigger a compilation error
#[cfg(not_present)] use foo = bar;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-2611-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ impl A for E {
fn b<F:Copy,G>(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but
}

fn main() {}
pub fn main() {}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-3290.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// xfail-test
fn main() {
pub fn main() {
let mut x = ~3;
x = x;
assert_eq!(*x, 3);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-3796.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// xfail-test
#[deny(dead_assignment)];
fn main() {
pub fn main() {
let mut x = 1;
let f: &fn() -> int = || { x + 20 };
assert_eq!(f(), 21);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-3907-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Foo for S {
fn bar() { }
}

fn main() {
pub fn main() {
let s = S {
name: 0
};
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-4241.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,5 @@ fn query2(cmd: ~[~str]) -> Result {
}


fn main() {
pub fn main() {
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-4252.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<T: X> Drop for Z<T> {
}
}

fn main() {
pub fn main() {
let y = Y;
let _z = Z{x: y};
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-4325.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ impl<'self, T> Node<'self, T> {
}
}

fn main() {}
pub fn main() {}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-4333.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::io;

fn main() {
pub fn main() {
let stdout = &io::stdout() as &io::WriterUtil;
stdout.write_line("Hello!");
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-4735.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Drop for NonCopyable {
}
}

fn main() {
pub fn main() {
let t = ~0;
let p = unsafe { transmute::<~int, *c_void>(t) };
let z = NonCopyable(p);
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-5315.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// xfail-test
struct A(bool);

fn main() {
pub fn main() {
let f = A;
f(true);
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-5353.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ fn gl_err_str(err: u32) -> ~str
}
}

fn main() {}
pub fn main() {}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-5517.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
pub fn main() {
let box1 = @mut 42;
let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337;
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-5550.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
pub fn main() {
let s: ~str = ~"foobar";
let mut t: &str = s;
t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-5572.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn foo<T: ::std::cmp::Eq>(t: T) { }

fn main() { }
pub fn main() { }
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-5741.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::io;

fn main() {
pub fn main() {
return;
while io::stdin().read_line() != ~"quit" { };
}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-6130.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#[deny(type_limits)];

fn main() {
pub fn main() {
let i: uint = 0;
assert!(i <= 0xFFFF_FFFF_u);

Expand Down
Loading