Skip to content

Commit e6f7ff3

Browse files
committed
test: Remove newtype enums from the test suite. rs=deenum
1 parent d1b5b8a commit e6f7ff3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+42
-110
lines changed

src/test/auxiliary/issue_2472_b.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111

12-
enum S = ();
12+
struct S(())
1313

1414
pub impl S {
1515
fn foo() { }

src/test/auxiliary/issue_3136_a.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
trait x {
1212
fn use_x<T>();
1313
}
14-
enum y = ();
14+
struct y(());
1515
impl x for y {
1616
fn use_x<T>() {
1717
struct foo { //~ ERROR quux

src/test/compile-fail/access-mode-in-closures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111

12-
enum sty = ~[int];
12+
struct sty(~[int]);
1313

1414
fn unpack(_unpack: &fn(v: &sty) -> ~[int]) {}
1515

src/test/compile-fail/borrowck-assign-to-enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum foo = int;
11+
struct foo(int);
1212

1313
fn main() {
1414
let x = foo(3);

src/test/compile-fail/borrowck-autoref-3261.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum X = Either<(uint,uint),extern fn()>;
11+
struct X(Either<(uint,uint),extern fn()>);
12+
1213
pub impl &'self X {
1314
fn with(blk: &fn(x: &Either<(uint,uint),extern fn()>)) {
1415
blk(&**self)

src/test/compile-fail/borrowck-loan-in-overloaded-op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// xfail-test #3387
1212

13-
enum foo = ~uint;
13+
struct foo(~uint);
1414

1515
impl Add<foo, foo> for foo {
1616
pure fn add(f: &foo) -> foo {

src/test/compile-fail/borrowck-mut-deref-comp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum foo = ~int;
11+
struct foo(~int);
1212

1313
fn borrow(x: @mut foo) {
1414
let _y = &***x; //~ ERROR illegal borrow unless pure

src/test/compile-fail/borrowck-unary-move-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn noncopyable() -> noncopyable {
2424
}
2525
}
2626

27-
enum wrapper = noncopyable;
27+
struct wrapper(noncopyable);
2828

2929
fn main() {
3030
let x1 = wrapper(noncopyable());

src/test/compile-fail/enum-in-scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum hello = int;
11+
struct hello(int);
1212

1313
fn main() {
1414
let hello = 0; //~ERROR declaration of `hello` shadows

src/test/compile-fail/issue-2063-resource.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct t { //~ ERROR this type cannot be instantiated
1616
to_str: (),
1717
}
1818

19-
enum x = @t; //~ ERROR this type cannot be instantiated
19+
struct x(@t); //~ ERROR this type cannot be instantiated
2020

2121
fn main() {
2222
}

src/test/compile-fail/issue-2063.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// test that autoderef of a type like this does not
1212
// cause compiler to loop. Note that no instances
1313
// of such a type could ever be constructed.
14-
enum t = @t; //~ ERROR this type cannot be instantiated
14+
enum t(@t); //~ ERROR this type cannot be instantiated
1515

1616
trait to_str_2 {
1717
fn to_str() -> ~str;

src/test/compile-fail/issue-2718-a.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub struct send_packet<T> {
1616
mod pingpong {
1717
use send_packet;
1818
pub type ping = send_packet<pong>;
19-
pub enum pong = send_packet<ping>; //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
19+
pub struct pong(send_packet<ping>); //~ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
2020
}
2121

2222
fn main() {}

src/test/compile-fail/issue-3080.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// xfail-test
12-
enum x = ();
12+
struct x(());
1313
pub impl x {
1414
unsafe fn with() { } // This should fail
1515
}

src/test/compile-fail/issue-3344.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum thing = uint;
11+
struct thing(uint);
1212
impl cmp::Ord for thing { //~ ERROR missing method `gt`
1313
pure fn lt(&self, other: &thing) -> bool { **self < **other }
1414
pure fn le(&self, other: &thing) -> bool { **self < **other }

src/test/compile-fail/issue-3953.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trait Hahaha: Eq + Eq + Eq + Eq + Eq + //~ ERROR Duplicate supertrait
2020
Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq +
2121
Eq {}
2222

23-
enum Lol = int;
23+
struct Lol(int);
2424

2525
impl Hahaha for Lol { }
2626

src/test/compile-fail/liveness-use-after-send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn send<T:Owned>(ch: _chan<T>, -data: T) {
1414
fail!();
1515
}
1616

17-
enum _chan<T> = int;
17+
struct _chan<T>(int);
1818

1919
// Tests that "log(debug, message);" is flagged as using
2020
// message after the send deinitializes it

src/test/compile-fail/pat-shadow-in-nested-binding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum foo = uint;
11+
struct foo(uint);
1212

1313
fn main() {
1414
let (foo, _) = (2, 3); //~ ERROR declaration of `foo` shadows

src/test/compile-fail/regions-bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// nominal types (but not on other types) and that they are type
1313
// checked.
1414

15-
enum an_enum = &'self int;
15+
struct an_enum(&'self int);
1616
trait a_trait {
1717
fn foo() -> &'self int;
1818
}

src/test/compile-fail/regions-infer-region-in-fn-but-not-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// check that the &int here does not cause us to think that `foo`
1313
// contains region pointers
14-
enum foo = ~fn(x: &int);
14+
struct foo(~fn(x: &int));
1515

1616
fn take_foo(x: foo/&) {} //~ ERROR no region bound is allowed on `foo`
1717

src/test/compile-fail/tps-invariant-enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct box<T> {
1212
f: T
1313
}
1414

15-
enum box_impl<T> = box<T>;
15+
struct box_impl<T>(box<T>);
1616

1717
fn set_box_impl<T>(b: box_impl<@const T>, v: @const T) {
1818
b.f = v;

src/test/compile-fail/tps-invariant-trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct box<T> {
1717
f: T
1818
}
1919

20-
enum box_impl<T> = box<T>;
20+
struct box_impl<T>(box<T>);
2121

2222
impl<T:Copy> box_trait<T> for box_impl<T> {
2323
fn get() -> T { return self.f; }

src/test/run-pass/alignment-gep-tup-like-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct Pair<A,B> {
1212
a: A, b: B
1313
}
1414

15-
enum RecEnum<A> = Rec<A>;
15+
struct RecEnum<A>(Rec<A>);
1616
struct Rec<A> {
1717
val: A,
1818
rec: Option<@mut RecEnum<A>>

src/test/run-pass/auto-encode.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ impl cmp::Eq for Expr {
8585
pure fn ne(&self, other: &Expr) -> bool { !(*self).eq(other) }
8686
}
8787

88-
impl cmp::Eq for AnEnum {
89-
pure fn eq(&self, other: &AnEnum) -> bool {
90-
(*self).v == other.v
91-
}
92-
pure fn ne(&self, other: &AnEnum) -> bool { !(*self).eq(other) }
93-
}
94-
9588
impl cmp::Eq for Point {
9689
pure fn eq(&self, other: &Point) -> bool {
9790
self.x == other.x && self.y == other.y
@@ -139,10 +132,6 @@ struct Spanned<T> {
139132
#[auto_decode]
140133
struct SomeStruct { v: ~[uint] }
141134

142-
#[auto_encode]
143-
#[auto_decode]
144-
enum AnEnum = SomeStruct;
145-
146135
#[auto_encode]
147136
#[auto_decode]
148137
struct Point {x: uint, y: uint}
@@ -168,10 +157,6 @@ pub fn main() {
168157
test_prettyprint(a, &~"Spanned {lo: 0u, hi: 5u, node: 22u}");
169158
test_ebml(a);
170159

171-
let a = &AnEnum(SomeStruct {v: ~[1u, 2u, 3u]});
172-
test_prettyprint(a, &~"AnEnum(SomeStruct {v: ~[1u, 2u, 3u]})");
173-
test_ebml(a);
174-
175160
let a = &Point {x: 3u, y: 5u};
176161
test_prettyprint(a, &~"Point {x: 3u, y: 5u}");
177162
test_ebml(a);

src/test/run-pass/auto-ref-newtype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// Check that we can define inherent methods on newtype enums that use
1212
// an auto-ref'd receiver.
1313

14-
enum Foo = uint;
14+
struct Foo(uint);
1515

1616
pub impl Foo {
1717
fn len(&self) -> uint { **self }

src/test/run-pass/autoderef-method-newtype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl double for uint {
1616
fn double() -> uint { self * 2u }
1717
}
1818

19-
enum foo = uint;
19+
struct foo(uint);
2020

2121
pub fn main() {
2222
let x = foo(3u);

src/test/run-pass/const-enum-newtype-align.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/test/run-pass/const-newtype-enum.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/test/run-pass/instantiable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// check that we do not report a type like this as uninstantiable,
1313
// even though it would be if the nxt field had type @foo:
14-
enum foo = X;
14+
struct foo(X);
1515

1616
struct X { x: uint, nxt: *foo }
1717

src/test/run-pass/issue-2312.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
trait clam<A> { }
1414

15-
enum foo = int;
15+
struct foo(int);
1616

1717
pub impl foo {
1818
fn bar<B,C:clam<B>>(c: C) -> B { fail!(); }

src/test/run-pass/issue-2718.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ pub mod pingpong {
225225
use core::cast;
226226
use core::ptr;
227227
228-
pub enum ping = ::pipes::send_packet<pong>;
229-
pub enum pong = ::pipes::send_packet<ping>;
228+
pub struct ping(::pipes::send_packet<pong>);
229+
pub struct pong(::pipes::send_packet<ping>);
230230
231231
pub fn liberate_ping(-p: ping) -> ::pipes::send_packet<pong> {
232232
unsafe {

src/test/run-pass/let-destruct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum xx = int;
11+
struct xx(int);
1212

1313
struct X { x: xx, y: int }
1414

src/test/run-pass/log-degen-enum.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/test/run-pass/newtype-polymorphic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum myvec<X> = ~[X];
11+
struct myvec<X>(~[X]);
1212

1313
fn myvec_deref<X:Copy>(mv: myvec<X>) -> ~[X] { return copy *mv; }
1414

src/test/run-pass/newtype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
enum mytype = Mytype;
11+
struct mytype(Mytype);
1212

1313
struct Mytype {compute: extern fn(mytype) -> int, val: int}
1414

src/test/run-pass/pipe-pingpong-bounded.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ mod pingpong {
4343
ptr::addr_of(&(data.ping))
4444
}
4545
}
46-
pub enum ping = server::pong;
47-
pub enum pong = client::ping;
46+
pub struct ping(server::pong);
47+
pub struct pong(client::ping);
4848
pub mod client {
4949
use core::pipes;
5050
use core::pipes::*;

src/test/run-pass/reflect-visit-data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn align(size: uint, align: uint) -> uint {
2828
((size + align) - 1u) & !(align - 1u)
2929
}
3030

31-
enum ptr_visit_adaptor<V> = Inner<V>;
31+
struct ptr_visit_adaptor<V>(Inner<V>);
3232

3333
pub impl<V:TyVisitor + movable_ptr> ptr_visit_adaptor<V> {
3434

@@ -470,7 +470,7 @@ impl<V:TyVisitor + movable_ptr> TyVisitor for ptr_visit_adaptor<V> {
470470
}
471471
}
472472

473-
enum my_visitor = @mut Stuff;
473+
struct my_visitor(@mut Stuff);
474474

475475
struct Stuff {
476476
ptr1: *c_void,

0 commit comments

Comments
 (0)