提交 2a65842c 编写于 作者: P Patrick Walton

test: De-export aux, bench, compile-fail, and run-fail. rs=deexporting

上级 77f2aac3
......@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
fn foo(x: &uint) -> uint {
pub fn foo(x: &uint) -> uint {
*x
}
......@@ -8,22 +8,17 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
mod kitties {
#[legacy_exports];
pub mod kitties {
pub struct cat {
priv mut meows : uint,
struct cat {
priv mut meows : uint,
how_hungry : int,
}
how_hungry : int,
}
fn cat(in_x : uint, in_y : int) -> cat {
pub fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
}
......@@ -8,26 +8,23 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
pub mod kitties {
pub struct cat {
priv mut meows : uint,
mod kitties {
#[legacy_exports];
how_hungry : int,
struct cat {
priv mut meows : uint,
how_hungry : int,
}
}
impl cat {
pub impl cat {
fn speak() {}
}
fn cat(in_x : uint, in_y : int) -> cat {
pub fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
}
......@@ -8,28 +8,22 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
pub mod kitties {
pub struct cat {
priv mut meows : uint,
mod kitties {
#[legacy_exports];
struct cat {
priv mut meows : uint,
how_hungry : int,
}
how_hungry : int,
}
impl cat {
pub impl cat {
fn speak() { self.meows += 1u; }
fn meow_count() -> uint { self.meows }
}
fn cat(in_x : uint, in_y : int) -> cat {
pub fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
}
......@@ -8,35 +8,31 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
mod kitties {
#[legacy_exports];
pub mod kitties {
pub struct cat {
priv mut meows : uint,
struct cat {
priv mut meows : uint,
mut how_hungry : int,
name : ~str,
}
impl cat {
mut how_hungry : int,
name : ~str,
}
fn speak() { self.meow(); }
pub impl cat {
fn speak() { self.meow(); }
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
return false;
fn eat() -> bool {
if self.how_hungry > 0 {
error!("OM NOM NOM");
self.how_hungry -= 2;
return true;
}
else {
error!("Not hungry!");
return false;
}
}
}
}
}
priv impl cat {
pub impl cat {
fn meow() {
error!("Meow");
self.meows += 1u;
......@@ -46,12 +42,11 @@ fn meow() {
}
}
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
pub fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
cat {
meows: in_x,
how_hungry: in_y,
name: in_name
}
}
}
......@@ -8,14 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
mod kitties {
pub mod kitties {
pub struct cat {
priv mut meows : uint,
how_hungry : int,
}
impl cat {
pub impl cat {
priv fn nap() { for uint::range(1, 10000u) |_i|{}}
}
......@@ -26,4 +25,4 @@ pub fn cat(in_x : uint, in_y : int) -> cat {
}
}
}
\ No newline at end of file
}
......@@ -8,32 +8,27 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
pub mod kitties {
pub struct cat<U> {
priv mut info : ~[U],
priv mut meows : uint,
mod kitties {
#[legacy_exports];
struct cat<U> {
priv mut info : ~[U],
priv mut meows : uint,
how_hungry : int,
}
how_hungry : int,
}
impl<U> cat<U> {
pub impl<U> cat<U> {
fn speak<T>(stuff: ~[T]) {
self.meows += stuff.len();
}
fn meow_count() -> uint { self.meows }
}
fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {
cat {
meows: in_x,
how_hungry: in_y,
info: move in_info
pub fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {
cat {
meows: in_x,
how_hungry: in_y,
info: move in_info
}
}
}
}
......@@ -8,11 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
mod animals {
#[legacy_exports];
trait noisy {
fn speak();
}
pub mod animals {
pub trait noisy {
fn speak();
}
}
......@@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
pub extern mod rusti {
fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
......@@ -30,7 +28,7 @@
}
#[inline(always)]
fn atomic_xchg(dst: &mut int, src: int) -> int {
pub fn atomic_xchg(dst: &mut int, src: int) -> int {
unsafe {
rusti::atomic_xchg(dst, src)
}
......
......@@ -10,10 +10,9 @@
#[link(name="cci_iter_lib", vers="0.0")];
#[legacy_modes];
#[legacy_exports];
#[inline]
fn iter<T>(v: ~[T], f: fn(T)) {
pub fn iter<T>(v: ~[T], f: fn(T)) {
let mut i = 0u;
let n = vec::len(v);
while i < n {
......
......@@ -9,19 +9,18 @@
// except according to those terms.
#[legacy_modes];
#[legacy_exports];
use dvec::DVec;
struct Entry<A,B> {key: A, value: B}
pub struct Entry<A,B> {key: A, value: B}
struct alist<A,B> { eq_fn: fn@(A,A) -> bool, data: DVec<Entry<A,B>> }
pub struct alist<A,B> { eq_fn: fn@(A,A) -> bool, data: DVec<Entry<A,B>> }
fn alist_add<A: Copy, B: Copy>(lst: alist<A,B>, k: A, v: B) {
pub fn alist_add<A: Copy, B: Copy>(lst: alist<A,B>, k: A, v: B) {
lst.data.push(Entry{key:k, value:v});
}
fn alist_get<A: Copy, B: Copy>(lst: alist<A,B>, k: A) -> B {
pub fn alist_get<A: Copy, B: Copy>(lst: alist<A,B>, k: A) -> B {
let eq_fn = lst.eq_fn;
for lst.data.each |entry| {
if eq_fn(entry.key, k) { return entry.value; }
......@@ -30,13 +29,13 @@ fn alist_get<A: Copy, B: Copy>(lst: alist<A,B>, k: A) -> B {
}
#[inline]
fn new_int_alist<B: Copy>() -> alist<int, B> {
pub fn new_int_alist<B: Copy>() -> alist<int, B> {
fn eq_int(&&a: int, &&b: int) -> bool { a == b }
return alist {eq_fn: eq_int, data: DVec()};
}
#[inline]
fn new_int_alist_2<B: Copy>() -> alist<int, B> {
pub fn new_int_alist_2<B: Copy>() -> alist<int, B> {
#[inline]
fn eq_int(&&a: int, &&b: int) -> bool { a == b }
return alist {eq_fn: eq_int, data: DVec()};
......
......@@ -9,10 +9,9 @@
// except according to those terms.
#[link(name="cci_no_inline_lib", vers="0.0")];
#[legacy_exports];
// same as cci_iter_lib, more-or-less, but not marked inline
fn iter(v: ~[uint], f: fn(uint)) {
pub fn iter(v: ~[uint], f: fn(uint)) {
let mut i = 0u;
let n = vec::len(v);
while i < n {
......@@ -20,3 +19,4 @@ fn iter(v: ~[uint], f: fn(uint)) {
i += 1u;
}
}
......@@ -10,40 +10,31 @@
#[link(name = "crate_method_reexport_grrrrrrr2")];
export rust;
use name_pool::add;
mod name_pool {
#[legacy_exports];
type name_pool = ();
pub type name_pool = ();
trait add {
pub trait add {
fn add(s: ~str);
}
impl name_pool: add {
pub impl name_pool: add {
fn add(s: ~str) {
}
}
}
mod rust {
#[legacy_exports];
pub mod rust {
use name_pool::add;
export add;
export rt;
export cx;
type rt = @();
pub type rt = @();
trait cx {
pub trait cx {
fn cx();
}
impl rt: cx {
pub impl rt: cx {
fn cx() {
}
}
......
......@@ -12,6 +12,5 @@
vers = "0.1")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 10 }
pub fn f() -> int { 10 }
......@@ -12,6 +12,5 @@
vers = "0.2")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 20 }
pub fn f() -> int { 20 }
......@@ -12,6 +12,5 @@
vers = "0.3")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 30 }
pub fn f() -> int { 30 }
......@@ -12,6 +12,5 @@
vers = "0.1")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 10 }
pub fn f() -> int { 10 }
......@@ -12,6 +12,5 @@
vers = "0.2")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 20 }
pub fn f() -> int { 20 }
......@@ -12,6 +12,5 @@
vers = "0.3")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 30 }
pub fn f() -> int { 30 }
......@@ -12,6 +12,5 @@
vers = "0.1")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 10 }
pub fn f() -> int { 10 }
......@@ -12,6 +12,5 @@
vers = "0.2")];
#[crate_type = "lib"];
#[legacy_exports];
fn g() -> int { 20 }
pub fn g() -> int { 20 }
......@@ -10,6 +10,5 @@
#[link(name = "crateresolve4a", vers = "0.1")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 10 }
pub fn f() -> int { 10 }
......@@ -10,6 +10,5 @@
#[link(name = "crateresolve4a", vers= "0.2")];
#[crate_type = "lib"];
#[legacy_exports];
fn g() -> int { 20 }
pub fn g() -> int { 20 }
......@@ -12,8 +12,7 @@
// aux-build:crateresolve4a-2.rs
#[link(name = "crateresolve4b", vers = "0.1")];
#[crate_type = "lib"];
#[legacy_exports];
extern mod crateresolve4a(vers="0.2");
fn f() -> int { crateresolve4a::g() }
pub fn f() -> int { crateresolve4a::g() }
......@@ -12,8 +12,7 @@
// aux-build:crateresolve4a-2.rs
#[link(name = "crateresolve4b", vers = "0.2")];
#[crate_type = "lib"];
#[legacy_exports];
extern mod crateresolve4a(vers="0.1");
fn g() -> int { crateresolve4a::f() }
pub fn g() -> int { crateresolve4a::f() }
......@@ -12,18 +12,17 @@
vers = "0.1")];
#[crate_type = "lib"];
#[legacy_exports];
struct NameVal { name: ~str, val: int }
pub struct NameVal { name: ~str, val: int }
fn struct_nameval() -> NameVal {
pub fn struct_nameval() -> NameVal {
NameVal { name: ~"crateresolve5", val: 10 }
}
enum e {
pub enum e {
e_val
}
fn nominal() -> e { e_val }
pub fn nominal() -> e { e_val }
fn f() -> int { 10 }
pub fn f() -> int { 10 }
......@@ -12,17 +12,16 @@
vers = "0.2")];
#[crate_type = "lib"];
#[legacy_exports];
struct NameVal { name: ~str, val: int }
fn struct_nameval() -> NameVal {
pub struct NameVal { name: ~str, val: int }
pub fn struct_nameval() -> NameVal {
NameVal { name: ~"crateresolve5", val: 10 }
}
enum e {
pub enum e {
e_val
}
fn nominal() -> e { e_val }
pub fn nominal() -> e { e_val }
fn f() -> int { 20 }
pub fn f() -> int { 20 }
......@@ -13,15 +13,12 @@
// aux-build:crateresolve_calories-2.rs
// These both have the same version but differ in other metadata
#[legacy_exports];
mod a {
#[legacy_exports];
pub mod a {
extern mod cr_1 (name = "crateresolve_calories", vers = "0.1", calories="100");
fn f() -> int { cr_1::f() }
pub fn f() -> int { cr_1::f() }
}
mod b {
#[legacy_exports];
pub mod b {
extern mod cr_2 (name = "crateresolve_calories", vers = "0.1", calories="200");
fn f() -> int { cr_2::f() }
pub fn f() -> int { cr_2::f() }
}
......@@ -13,6 +13,5 @@
calories = "100")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 100 }
pub fn f() -> int { 100 }
......@@ -13,6 +13,5 @@
calories = "200")];
#[crate_type = "lib"];
#[legacy_exports];
fn f() -> int { 200 }
pub fn f() -> int { 200 }
......@@ -12,22 +12,20 @@
vers = "0.1")];
#[crate_type = "lib"];
#[legacy_exports];
extern mod rustrt {
#[legacy_exports];
fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
pub extern mod rustrt {
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
}
fn fact(n: uint) -> uint {
pub fn fact(n: uint) -> uint {
unsafe {
debug!("n = %?", n);
rustrt::rust_dbg_call(cb, n)
}
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
pub extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
if data == 1u {
data
} else {
......
......@@ -9,9 +9,7 @@
// except according to those terms.
#[link(name="foreign_lib", vers="0.0")];
#[legacy_exports];
extern mod rustrt {
#[legacy_exports];
fn last_os_error() -> ~str;
}
\ No newline at end of file
pub extern mod rustrt {
pub fn last_os_error() -> ~str;
}
......@@ -10,11 +10,10 @@
#[link(name = "a", vers = "0.0")];
#[crate_type = "lib"];
#[legacy_exports];
trait i<T> { }
pub trait i<T> { }
fn f<T>() -> i<T> {
pub fn f<T>() -> i<T> {
impl<T> (): i<T> { }
() as i::<T>
......
......@@ -10,27 +10,21 @@
#[link(name="socketlib", vers="0.0")];
#[crate_type = "lib"];
#[legacy_exports];
mod socket {
#[legacy_exports];
export socket_handle;
struct socket_handle {
sockfd: libc::c_int,
}
pub mod socket {
pub struct socket_handle {
sockfd: libc::c_int,
}
impl socket_handle : Drop {
fn finalize(&self) {
/* c::close(self.sockfd); */
pub impl socket_handle : Drop {
fn finalize(&self) {
/* c::close(self.sockfd); */
}
}
}
fn socket_handle(x: libc::c_int) -> socket_handle {
pub fn socket_handle(x: libc::c_int) -> socket_handle {
socket_handle {
sockfd: x
}
}
}
......@@ -10,18 +10,12 @@
extern mod issue_2316_a;
mod cloth {
#[legacy_exports];
use issue_2316_a::*;
export calico, gingham, flannel;
export fabric;
enum fabric {
gingham, flannel, calico
}
pub mod cloth {
use issue_2316_a::*;
pub enum fabric {
gingham, flannel, calico
}
}
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
unsafe fn f(xs: ~[int]) {
xs.map(|_x| { unsafe fn q() { fail; } });
}
\ No newline at end of file
pub unsafe fn f(xs: ~[int]) {
xs.map(|_x| { unsafe fn q() { fail; } });
}
......@@ -22,8 +22,7 @@
// an llvm intrinsic.
#[nolink]
extern mod libc {
#[legacy_exports];
fn sqrt(n: float) -> float;
pub fn sqrt(n: float) -> float;
}
fn main() {
......
......@@ -12,5 +12,4 @@
// asterisk is bogus
#[attr*]
mod m {
#[legacy_exports]; }
mod m {}
......@@ -10,7 +10,6 @@
// error-pattern: unresolved name: m1::a
mod m1 {
#[legacy_exports]; }
mod m1 {}
fn main(args: ~[str]) { log(debug, m1::a); }
......@@ -11,9 +11,7 @@
// error-pattern: unresolved name: m1::a
mod m1 {
#[legacy_exports];
mod a {
#[legacy_exports]; }
pub mod a {}
}
fn main(args: ~[str]) { log(debug, m1::a); }
......@@ -16,8 +16,7 @@
extern mod crateresolve2(vers = "0.1");
mod m {
#[legacy_exports];
extern mod crateresolve2(vers = "0.2");
pub extern mod crateresolve2(vers = "0.2");
}
fn main() {
......
......@@ -12,5 +12,4 @@
#[link_name = ""]
extern mod foo {
#[legacy_exports];
}
......@@ -14,5 +14,4 @@
#[link_name = ""]
#[nolink]
extern mod foo {
#[legacy_exports];
}
......@@ -15,11 +15,7 @@
// want to change eventually.
mod foo {
#[legacy_exports];
export bar;
fn bar() { foo::baz(); }
pub fn bar() { foo::baz(); }
fn baz() { }
}
......
......@@ -13,10 +13,7 @@
use m::unexported;
mod m {
#[legacy_exports];
export exported;
fn exported() { }
pub fn exported() { }
fn unexported() { }
}
......
......@@ -11,10 +11,7 @@
// error-pattern: unresolved name
mod foo {
#[legacy_exports];
export x;
fn x() { }
pub fn x() { }
enum y { y1, }
}
......
......@@ -10,9 +10,7 @@
// error-pattern: unresolved name
mod foo {
#[legacy_exports];
export x;
fn x(y: int) { log(debug, y); }
pub fn x(y: int) { log(debug, y); }
fn z(y: int) { log(debug, y); }
}
......
......@@ -11,19 +11,13 @@
// error-pattern: unresolved name
mod foo {
#[legacy_exports];
export x;
fn x() { bar::x(); }
pub fn x() { bar::x(); }
}
mod bar {
#[legacy_exports];
export y;
fn x() { debug!("x"); }
fn y() { }
pub fn y() { }
}
fn main() { foo::x(); }
......@@ -12,8 +12,7 @@
#[abi = "cdecl"]
extern mod test {
#[legacy_exports];
unsafe fn free();
pub unsafe fn free();
}
fn main() {
......
......@@ -12,8 +12,7 @@
#[abi = "cdecl"]
extern mod test {
#[legacy_exports];
unsafe fn free();
pub unsafe fn free();
}
fn main() {
......
......@@ -11,13 +11,11 @@
// Test that we use fully-qualified type names in error messages.
mod x {
#[legacy_exports];
enum foo { }
pub enum foo { }
}
mod y {
#[legacy_exports];
enum foo { }
pub enum foo { }
}
fn bar(x: x::foo) -> y::foo {
......
......@@ -12,8 +12,7 @@
use spam::{ham, eggs};
mod spam {
#[legacy_exports];
fn ham() { }
pub fn ham() { }
}
fn main() { ham(); eggs(); }
......@@ -13,9 +13,8 @@
use baz = foo::{bar};
mod foo {
#[legacy_exports];
fn bar() {}
pub fn bar() {}
}
fn main() {
}
\ No newline at end of file
}
......@@ -13,15 +13,10 @@
use module_of_many_things::*;
mod module_of_many_things {
#[legacy_exports];
export f1;
export f2;
export f4;
fn f1() { debug!("f1"); }
fn f2() { debug!("f2"); }
pub fn f1() { debug!("f1"); }
pub fn f2() { debug!("f2"); }
fn f3() { debug!("f3"); }
fn f4() { debug!("f4"); }
pub fn f4() { debug!("f4"); }
}
......
......@@ -11,27 +11,18 @@
// error-pattern: unresolved
mod circ1 {
#[legacy_exports];
use circ1::*;
export f1;
export f2;
export common;
fn f1() { debug!("f1"); }
fn common() -> uint { return 0u; }
pub use circ2::f2;
pub fn f1() { debug!("f1"); }
pub fn common() -> uint { return 0u; }
}
mod circ2 {
#[legacy_exports];
use circ2::*;
export f1;
export f2;
export common;
fn f2() { debug!("f2"); }
fn common() -> uint { return 1u; }
pub use circ1::f1;
pub fn f2() { debug!("f2"); }
pub fn common() -> uint { return 1u; }
}
mod test {
#[legacy_exports];
use circ1::*;
fn test() { f1066(); }
......
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:unresolved name
use m1::*;
mod m1 {
#[legacy_exports];
export f1;
fn f1() { }
fn f2() { }
}
fn main() { f2(); }
......@@ -13,9 +13,8 @@
use baz = foo::*;
mod foo {
#[legacy_exports];
fn bar() {}
pub fn bar() {}
}
fn main() {
}
\ No newline at end of file
}
......@@ -11,15 +11,11 @@
// error-pattern:import
mod a {
#[legacy_exports];
import b::x;
export x;
pub use b::x;
}
mod b {
#[legacy_exports];
import a::x;
export x;
pub use a::x;
fn main() { let y = x; }
}
......@@ -13,9 +13,7 @@
use y::x;
mod y {
#[legacy_exports];
import x;
export x;
pub use y::x;
}
fn main() { }
......@@ -12,7 +12,6 @@
use zed::bar;
use zed::baz;
mod zed {
#[legacy_exports];
fn bar() { debug!("bar"); }
pub fn bar() { debug!("bar"); }
}
fn main(args: ~[str]) { bar(); }
......@@ -10,10 +10,8 @@
// error-pattern: unresolved
use baz::zed::bar;
mod baz {
#[legacy_exports]; }
mod baz {}
mod zed {
#[legacy_exports];
fn bar() { debug!("bar3"); }
pub fn bar() { debug!("bar3"); }
}
fn main(args: ~[str]) { bar(); }
......@@ -10,9 +10,7 @@
// error-pattern: import
mod a {
#[legacy_exports]; import foo = b::foo; export foo; }
mod b {
#[legacy_exports]; import foo = a::foo; export foo; }
mod a { pub use b::foo; }
mod b { pub use a::foo; }
fn main(args: ~[str]) { debug!("loop"); }
......@@ -10,7 +10,6 @@
// error-pattern:expected item
mod blade_runner {
#[legacy_exports];
#~[doc(
brief = "Blade Runner is probably the best movie ever",
desc = "I like that in the world of Blade Runner it is always
......
......@@ -11,7 +11,6 @@
use x = m::f; //~ ERROR failed to resolve import
mod m {
#[legacy_exports];
}
fn main() {
......
......@@ -9,8 +9,7 @@
// except according to those terms.
mod bar {
#[legacy_exports];
enum foo {
pub enum foo {
alpha,
beta,
charlie
......
......@@ -12,7 +12,6 @@
use x = m::f;
mod m {
#[legacy_exports];
}
fn main() {
......
......@@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports]
mod a {}
pub mod a {}
#[legacy_exports]
mod a {} //~ ERROR duplicate definition of type a
pub mod a {} //~ ERROR duplicate definition of type a
fn main() {}
......@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports]
mod break {
pub mod break {
//~^ ERROR found `break` in ident position
}
\ No newline at end of file
}
......@@ -16,7 +16,6 @@
#[link_args = "aFdEfSeVEEE"]
#[nolink]
extern mod m1 {
#[legacy_exports]; }
extern mod m1 {}
fn main() { }
\ No newline at end of file
fn main() { }
......@@ -9,12 +9,11 @@
// except according to those terms.
mod a {
#[legacy_exports];
struct Foo {
pub struct Foo {
x: int
}
impl Foo {
pub impl Foo {
priv fn foo() {}
}
}
......
......@@ -9,7 +9,6 @@
// except according to those terms.
mod a {
#[legacy_exports];
priv fn f() {}
}
......
......@@ -11,25 +11,23 @@
// error-pattern:method `nap` is private
mod kitties {
#[legacy_exports];
struct cat {
priv mut meows : uint,
pub struct cat {
priv mut meows : uint,
how_hungry : int,
}
how_hungry : int,
}
impl cat {
priv fn nap() { uint::range(1u, 10000u, |_i| false)}
}
pub impl cat {
priv fn nap() { uint::range(1u, 10000u, |_i| false)}
}
fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
pub fn cat(in_x : uint, in_y : int) -> cat {
cat {
meows: in_x,
how_hungry: in_y
}
}
}
}
fn main() {
let nyan : kitties::cat = kitties::cat(52u, 99);
......
......@@ -9,8 +9,7 @@
// except according to those terms.
mod a {
#[legacy_exports];
struct Foo {
pub struct Foo {
priv x: int
}
}
......
......@@ -11,12 +11,11 @@
use a::Foo;
mod a {
#[legacy_exports];
struct Foo {
pub struct Foo {
priv x: int
}
fn make() -> Foo {
pub fn make() -> Foo {
Foo { x: 3 }
}
}
......
......@@ -9,12 +9,11 @@
// except according to those terms.
mod cat {
#[legacy_exports];
struct Cat {
pub struct Cat {
priv meows: uint
}
fn new_cat() -> Cat {
pub fn new_cat() -> Cat {
Cat { meows: 52 }
}
}
......
......@@ -9,8 +9,7 @@
// except according to those terms.
mod a {
#[legacy_exports];
enum Waffle {
pub enum Waffle {
Belgian,
Brussels,
priv Liege
......
......@@ -19,11 +19,9 @@
#[link_name= "m"]
#[link_args="-foo"] // this could have been elided.
extern mod m1 {
#[legacy_exports];
}
#[link_name= "m"]
#[link_args="-bar"] // this is the actual error trigger.
extern mod m2 {
#[legacy_exports];
}
......@@ -9,23 +9,22 @@
// except according to those terms.
mod argparse {
#[legacy_exports];
extern mod std;
use either::{Either, Left, Right};
struct Flag {
pub struct Flag {
name: &str,
desc: &str,
max_count: uint,
mut value: uint
}
fn flag(name: &r/str, desc: &r/str) -> Flag/&r {
pub fn flag(name: &r/str, desc: &r/str) -> Flag/&r {
Flag { name: name, desc: desc, max_count: 1, value: 0 }
}
impl Flag {
pub impl Flag {
fn set_desc(self, s: &str) -> Flag {
Flag { //~ ERROR cannot infer an appropriate lifetime
name: self.name,
......
......@@ -13,18 +13,15 @@
use cal = bar::c::cc;
mod foo {
#[legacy_exports];
type point = {x: int, y: int};
type square = {p: point, h: uint, w: uint};
pub type point = {x: int, y: int};
pub type square = {p: point, h: uint, w: uint};
}
mod bar {
#[legacy_exports];
mod c {
#[legacy_exports];
pub mod c {
use foo::point;
use foo::square;
fn cc(p: point) -> str { return 2 * (p.x + p.y); }
pub fn cc(p: point) -> str { return 2 * (p.x + p.y); }
}
}
......
......@@ -13,9 +13,8 @@
#[nolink]
extern mod libc {
#[legacy_exports];
fn malloc(size: int) -> *u8;
pub fn malloc(size: int) -> *u8;
}
fn main() {
}
\ No newline at end of file
}
......@@ -12,9 +12,8 @@
// error-pattern:found rust type
#[nolink]
extern mod libc {
#[legacy_exports];
fn malloc(size: int) -> *u8;
pub fn malloc(size: int) -> *u8;
}
fn main() {
}
\ No newline at end of file
}
......@@ -10,9 +10,8 @@
//error-pattern:libc::c_int or libc::c_long should be used
extern mod xx {
#[legacy_exports];
fn strlen(str: *u8) -> uint;
fn foo(x: int, y: uint);
pub fn strlen(str: *u8) -> uint;
pub fn foo(x: int, y: uint);
}
fn main() {
......
......@@ -13,9 +13,8 @@
// Instead the failure will be delivered after the callbacks return.
extern mod rustrt {
#[legacy_exports];
fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
pub fn rust_dbg_call(cb: *u8,
data: libc::uintptr_t) -> libc::uintptr_t;
}
extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
......
......@@ -18,8 +18,7 @@
extern mod std;
extern mod rustrt {
#[legacy_exports];
fn last_os_error() -> ~str;
pub fn last_os_error() -> ~str;
}
fn getbig_call_c_and_fail(i: int) {
......
......@@ -14,10 +14,7 @@
extern mod std;
mod m {
#[legacy_exports];
export exported;
fn exported() { }
pub fn exported() { }
#[test]
fn unexported() { fail ~"runned an unexported test"; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册