test: Remove newtype enums from the test suite. rs=deenum

This commit is contained in:
Patrick Walton 2013-03-07 16:36:30 -08:00
parent bd2d17e4a1
commit e48446d060
42 changed files with 42 additions and 110 deletions

View file

@ -9,7 +9,7 @@
// except according to those terms.
enum S = ();
struct S(())
pub impl S {
fn foo() { }

View file

@ -11,7 +11,7 @@
trait x {
fn use_x<T>();
}
enum y = ();
struct y(());
impl x for y {
fn use_x<T>() {
struct foo { //~ ERROR quux

View file

@ -9,7 +9,7 @@
// except according to those terms.
enum sty = ~[int];
struct sty(~[int]);
fn unpack(_unpack: &fn(v: &sty) -> ~[int]) {}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum foo = int;
struct foo(int);
fn main() {
let x = foo(3);

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum X = Either<(uint,uint),extern fn()>;
struct X(Either<(uint,uint),extern fn()>);
pub impl &'self X {
fn with(blk: &fn(x: &Either<(uint,uint),extern fn()>)) {
blk(&**self)

View file

@ -10,7 +10,7 @@
// xfail-test #3387
enum foo = ~uint;
struct foo(~uint);
impl Add<foo, foo> for foo {
pure fn add(f: &foo) -> foo {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum foo = ~int;
struct foo(~int);
fn borrow(x: @mut foo) {
let _y = &***x; //~ ERROR illegal borrow unless pure

View file

@ -24,7 +24,7 @@ fn noncopyable() -> noncopyable {
}
}
enum wrapper = noncopyable;
struct wrapper(noncopyable);
fn main() {
let x1 = wrapper(noncopyable());

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum hello = int;
struct hello(int);
fn main() {
let hello = 0; //~ERROR declaration of `hello` shadows

View file

@ -16,7 +16,7 @@ struct t { //~ ERROR this type cannot be instantiated
to_str: (),
}
enum x = @t; //~ ERROR this type cannot be instantiated
struct x(@t); //~ ERROR this type cannot be instantiated
fn main() {
}

View file

@ -11,7 +11,7 @@
// test that autoderef of a type like this does not
// cause compiler to loop. Note that no instances
// of such a type could ever be constructed.
enum t = @t; //~ ERROR this type cannot be instantiated
enum t(@t); //~ ERROR this type cannot be instantiated
trait to_str_2 {
fn to_str() -> ~str;

View file

@ -16,7 +16,7 @@ pub struct send_packet<T> {
mod pingpong {
use send_packet;
pub type ping = send_packet<pong>;
pub enum pong = send_packet<ping>; //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
pub struct pong(send_packet<ping>); //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
}
fn main() {}

View file

@ -9,7 +9,7 @@
// except according to those terms.
// xfail-test
enum x = ();
struct x(());
pub impl x {
unsafe fn with() { } // This should fail
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum thing = uint;
struct thing(uint);
impl cmp::Ord for thing { //~ ERROR missing method `gt`
pure fn lt(&self, other: &thing) -> bool { **self < **other }
pure fn le(&self, other: &thing) -> bool { **self < **other }

View file

@ -20,7 +20,7 @@ trait Hahaha: Eq + Eq + Eq + Eq + Eq + //~ ERROR Duplicate supertrait
Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq +
Eq {}
enum Lol = int;
struct Lol(int);
impl Hahaha for Lol { }

View file

@ -14,7 +14,7 @@ fn send<T:Owned>(ch: _chan<T>, -data: T) {
fail!();
}
enum _chan<T> = int;
struct _chan<T>(int);
// Tests that "log(debug, message);" is flagged as using
// message after the send deinitializes it

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum foo = uint;
struct foo(uint);
fn main() {
let (foo, _) = (2, 3); //~ ERROR declaration of `foo` shadows

View file

@ -12,7 +12,7 @@
// nominal types (but not on other types) and that they are type
// checked.
enum an_enum = &'self int;
struct an_enum(&'self int);
trait a_trait {
fn foo() -> &'self int;
}

View file

@ -11,7 +11,7 @@
// check that the &int here does not cause us to think that `foo`
// contains region pointers
enum foo = ~fn(x: &int);
struct foo(~fn(x: &int));
fn take_foo(x: foo<'static>) {} //~ ERROR no region bound is allowed on `foo`

View file

@ -12,7 +12,7 @@ struct box<T> {
f: T
}
enum box_impl<T> = box<T>;
struct box_impl<T>(box<T>);
fn set_box_impl<T>(b: box_impl<@const T>, v: @const T) {
b.f = v;

View file

@ -17,7 +17,7 @@ struct box<T> {
f: T
}
enum box_impl<T> = box<T>;
struct box_impl<T>(box<T>);
impl<T:Copy> box_trait<T> for box_impl<T> {
fn get() -> T { return self.f; }

View file

@ -12,7 +12,7 @@ struct Pair<A,B> {
a: A, b: B
}
enum RecEnum<A> = Rec<A>;
struct RecEnum<A>(Rec<A>);
struct Rec<A> {
val: A,
rec: Option<@mut RecEnum<A>>

View file

@ -85,13 +85,6 @@ impl cmp::Eq for Expr {
pure fn ne(&self, other: &Expr) -> bool { !(*self).eq(other) }
}
impl cmp::Eq for AnEnum {
pure fn eq(&self, other: &AnEnum) -> bool {
(*self).v == other.v
}
pure fn ne(&self, other: &AnEnum) -> bool { !(*self).eq(other) }
}
impl cmp::Eq for Point {
pure fn eq(&self, other: &Point) -> bool {
self.x == other.x && self.y == other.y
@ -139,10 +132,6 @@ struct Spanned<T> {
#[auto_decode]
struct SomeStruct { v: ~[uint] }
#[auto_encode]
#[auto_decode]
enum AnEnum = SomeStruct;
#[auto_encode]
#[auto_decode]
struct Point {x: uint, y: uint}
@ -168,10 +157,6 @@ pub fn main() {
test_prettyprint(a, &~"Spanned {lo: 0u, hi: 5u, node: 22u}");
test_ebml(a);
let a = &AnEnum(SomeStruct {v: ~[1u, 2u, 3u]});
test_prettyprint(a, &~"AnEnum(SomeStruct {v: ~[1u, 2u, 3u]})");
test_ebml(a);
let a = &Point {x: 3u, y: 5u};
test_prettyprint(a, &~"Point {x: 3u, y: 5u}");
test_ebml(a);

View file

@ -11,7 +11,7 @@
// Check that we can define inherent methods on newtype enums that use
// an auto-ref'd receiver.
enum Foo = uint;
struct Foo(uint);
pub impl Foo {
fn len(&self) -> uint { **self }

View file

@ -16,7 +16,7 @@ impl double for uint {
fn double() -> uint { self * 2u }
}
enum foo = uint;
struct foo(uint);
pub fn main() {
let x = foo(3u);

View file

@ -1,17 +0,0 @@
// Copyright 2013 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.
enum E = u32;
struct S { a: u8, b: E }
const C: S = S { a: 0xA5, b: E(0xDEADBEEF) };
pub fn main() {
fail_unless!(C.b == 0xDEADBEEF);
}

View file

@ -1,20 +0,0 @@
// Copyright 2013 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.
enum Foo = u32;
const X: Foo = Foo(17);
pub fn main() {
fail_unless!((*X == 17));
fail_unless!((*Y == 23));
}
const Y: Foo = Foo(23);

View file

@ -11,7 +11,7 @@
// check that we do not report a type like this as uninstantiable,
// even though it would be if the nxt field had type @foo:
enum foo = X;
struct foo(X);
struct X { x: uint, nxt: *foo }

View file

@ -12,7 +12,7 @@
trait clam<A> { }
enum foo = int;
struct foo(int);
pub impl foo {
fn bar<B,C:clam<B>>(c: C) -> B { fail!(); }

View file

@ -225,8 +225,8 @@ pub mod pingpong {
use core::cast;
use core::ptr;
pub enum ping = ::pipes::send_packet<pong>;
pub enum pong = ::pipes::send_packet<ping>;
pub struct ping(::pipes::send_packet<pong>);
pub struct pong(::pipes::send_packet<ping>);
pub fn liberate_ping(-p: ping) -> ::pipes::send_packet<pong> {
unsafe {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum xx = int;
struct xx(int);
struct X { x: xx, y: int }

View file

@ -1,17 +0,0 @@
// 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.
enum Foo = uint;
pub fn main() {
let x = Foo(1);
let y = fmt!("%?", x);
fail_unless!(y == ~"Foo(1)");
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum myvec<X> = ~[X];
struct myvec<X>(~[X]);
fn myvec_deref<X:Copy>(mv: myvec<X>) -> ~[X] { return copy *mv; }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum mytype = Mytype;
struct mytype(Mytype);
struct Mytype {compute: extern fn(mytype) -> int, val: int}

View file

@ -43,8 +43,8 @@ mod pingpong {
ptr::addr_of(&(data.ping))
}
}
pub enum ping = server::pong;
pub enum pong = client::ping;
pub struct ping(server::pong);
pub struct pong(client::ping);
pub mod client {
use core::pipes;
use core::pipes::*;

View file

@ -28,7 +28,7 @@ fn align(size: uint, align: uint) -> uint {
((size + align) - 1u) & !(align - 1u)
}
enum ptr_visit_adaptor<V> = Inner<V>;
struct ptr_visit_adaptor<V>(Inner<V>);
pub impl<V:TyVisitor + movable_ptr> ptr_visit_adaptor<V> {
@ -470,7 +470,7 @@ impl<V:TyVisitor + movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
}
}
enum my_visitor = @mut Stuff;
struct my_visitor(@mut Stuff);
struct Stuff {
ptr1: *c_void,

View file

@ -10,7 +10,7 @@
// xfail-test
use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor};
enum my_visitor = @mut { types: ~[str] };
struct my_visitor(@mut { types: ~[str] });
impl TyVisitor for my_visitor {
fn visit_bot() -> bool {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum arena = ();
struct arena(());
struct Bcx {
fcx: &'self Fcx<'self>

View file

@ -34,7 +34,7 @@ fn r(v: *int) -> r {
}
}
enum t = Node;
struct t(Node);
struct Node {
next: Option<@mut t>,

View file

@ -34,7 +34,7 @@ fn r(v: U) -> r {
}
}
enum t = Node;
struct t(Node);
struct Node {
next: Option<@mut t>,

View file

@ -43,7 +43,7 @@ fn r(v: U, w: int, _x: *int) -> R {
}
}
enum t = Node;
struct t(Node);
struct Node {
next: Option<@mut t>,

View file

@ -13,7 +13,7 @@
// Test cyclic detector when using trait instances.
enum Tree = @mut TreeR;
struct Tree(@mut TreeR);
struct TreeR {
left: Option<Tree>,
right: Option<Tree>,