diff options
| author | Steven Fackler <sfackler@gmail.com> | 2014-11-06 00:05:53 -0800 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2014-11-17 07:35:51 -0800 |
| commit | 3dcd2157403163789aaf21a9ab3c4d30a7c6494d (patch) | |
| tree | 30cc4a448fe8380ae7107c6ea9b534a725adaec8 /src/test/debuginfo | |
| parent | 0047dbe59c41b951d34ce6324f3a8c0e15d523e9 (diff) | |
| download | rust-3dcd2157403163789aaf21a9ab3c4d30a7c6494d.tar.gz rust-3dcd2157403163789aaf21a9ab3c4d30a7c6494d.zip | |
Switch to purely namespaced enums
This breaks code that referred to variant names in the same namespace as
their enum. Reexport the variants in the old location or alter code to
refer to the new locations:
```
pub enum Foo {
A,
B
}
fn main() {
let a = A;
}
```
=>
```
pub use self::Foo::{A, B};
pub enum Foo {
A,
B
}
fn main() {
let a = A;
}
```
or
```
pub enum Foo {
A,
B
}
fn main() {
let a = Foo::A;
}
```
[breaking-change]
Diffstat (limited to 'src/test/debuginfo')
19 files changed, 54 insertions, 21 deletions
diff --git a/src/test/debuginfo/borrowed-c-style-enum.rs b/src/test/debuginfo/borrowed-c-style-enum.rs index 214819682f0..bbda6c93eba 100644 --- a/src/test/debuginfo/borrowed-c-style-enum.rs +++ b/src/test/debuginfo/borrowed-c-style-enum.rs @@ -45,13 +45,13 @@ enum ABC { TheA, TheB, TheC } fn main() { - let the_a = TheA; + let the_a = ABC::TheA; let the_a_ref: &ABC = &the_a; - let the_b = TheB; + let the_b = ABC::TheB; let the_b_ref: &ABC = &the_b; - let the_c = TheC; + let the_c = ABC::TheC; let the_c_ref: &ABC = &the_c; zzz(); // #break diff --git a/src/test/debuginfo/borrowed-enum.rs b/src/test/debuginfo/borrowed-enum.rs index 77dd502e113..d1ace0fbe3d 100644 --- a/src/test/debuginfo/borrowed-enum.rs +++ b/src/test/debuginfo/borrowed-enum.rs @@ -61,17 +61,17 @@ fn main() { // 0b01111100011111000111110001111100 = 2088533116 // 0b0111110001111100 = 31868 // 0b01111100 = 124 - let the_a = TheA { x: 0, y: 8970181431921507452 }; + let the_a = ABC::TheA { x: 0, y: 8970181431921507452 }; let the_a_ref: &ABC = &the_a; // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441 // 0b00010001000100010001000100010001 = 286331153 // 0b0001000100010001 = 4369 // 0b00010001 = 17 - let the_b = TheB (0, 286331153, 286331153); + let the_b = ABC::TheB (0, 286331153, 286331153); let the_b_ref: &ABC = &the_b; - let univariant = TheOnlyCase(4820353753753434); + let univariant = Univariant::TheOnlyCase(4820353753753434); let univariant_ref: &Univariant = &univariant; zzz(); // #break diff --git a/src/test/debuginfo/by-value-non-immediate-argument.rs b/src/test/debuginfo/by-value-non-immediate-argument.rs index 098695f1459..78101d669dc 100644 --- a/src/test/debuginfo/by-value-non-immediate-argument.rs +++ b/src/test/debuginfo/by-value-non-immediate-argument.rs @@ -125,7 +125,7 @@ fn main() { // 0b01111100011111000111110001111100 = 2088533116 // 0b0111110001111100 = 31868 // 0b01111100 = 124 - by_val_enum(Case1 { x: 0, y: 8970181431921507452 }); + by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 }); } fn zzz() { () } diff --git a/src/test/debuginfo/c-style-enum-in-composite.rs b/src/test/debuginfo/c-style-enum-in-composite.rs index 1c76540f9dc..17e4110c2f1 100644 --- a/src/test/debuginfo/c-style-enum-in-composite.rs +++ b/src/test/debuginfo/c-style-enum-in-composite.rs @@ -66,6 +66,9 @@ #![allow(unused_variables)] +use self::AnEnum::{OneHundred, OneThousand, OneMillion}; +use self::AnotherEnum::{MountainView, Toronto, Vienna}; + enum AnEnum { OneHundred = 100, OneThousand = 1000, diff --git a/src/test/debuginfo/c-style-enum.rs b/src/test/debuginfo/c-style-enum.rs index 2f3981bd9dc..fec1d1b2789 100644 --- a/src/test/debuginfo/c-style-enum.rs +++ b/src/test/debuginfo/c-style-enum.rs @@ -100,6 +100,10 @@ #![allow(unused_variables)] #![allow(dead_code)] +use self::AutoDiscriminant::{One, Two, Three}; +use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion}; +use self::SingleVariant::TheOnlyVariant; + enum AutoDiscriminant { One, Two, diff --git a/src/test/debuginfo/destructured-fn-argument.rs b/src/test/debuginfo/destructured-fn-argument.rs index 959c423119a..17e1651f9f6 100644 --- a/src/test/debuginfo/destructured-fn-argument.rs +++ b/src/test/debuginfo/destructured-fn-argument.rs @@ -312,6 +312,7 @@ #![allow(unused_variables)] +use self::Univariant::Unit; struct Struct { a: i64, diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs index 00069bae7cf..58db37888e6 100644 --- a/src/test/debuginfo/destructured-local.rs +++ b/src/test/debuginfo/destructured-local.rs @@ -245,6 +245,8 @@ #![allow(unused_variables)] +use self::Univariant::Unit; + struct Struct { a: i64, b: i32 diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs index d264027b27f..8abb2cd5c26 100644 --- a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs +++ b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs @@ -60,9 +60,9 @@ fn main() { let empty_struct = EmptyStruct; - let c_style_enum1 = CStyleEnumVar1; - let c_style_enum2 = CStyleEnumVar2; - let c_style_enum3 = CStyleEnumVar3; + let c_style_enum1 = CStyleEnum::CStyleEnumVar1; + let c_style_enum2 = CStyleEnum::CStyleEnumVar2; + let c_style_enum3 = CStyleEnum::CStyleEnumVar3; zzz(); // #break } diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs index b8e7ade5d4b..00b157d49d1 100644 --- a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs +++ b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs @@ -66,6 +66,10 @@ #![feature(struct_variant)] +use self::CStyleEnum::{CStyleEnumVar1, CStyleEnumVar2, CStyleEnumVar3}; +use self::MixedEnum::{MixedEnumCStyleVar, MixedEnumTupleVar, MixedEnumStructVar}; +use self::NestedEnum::{NestedVariant1, NestedVariant2}; + struct RegularStruct { the_first_field: int, the_second_field: f64, diff --git a/src/test/debuginfo/generic-struct-style-enum.rs b/src/test/debuginfo/generic-struct-style-enum.rs index 698fc3d9d7d..fe5c13e4b8d 100644 --- a/src/test/debuginfo/generic-struct-style-enum.rs +++ b/src/test/debuginfo/generic-struct-style-enum.rs @@ -31,6 +31,9 @@ #![feature(struct_variant)] +use self::Regular::{Case1, Case2, Case3}; +use self::Univariant::TheOnlyCase; + // NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be // substituted with something of size `xx` bits and the same alignment as an integer type of the // same size. diff --git a/src/test/debuginfo/generic-tuple-style-enum.rs b/src/test/debuginfo/generic-tuple-style-enum.rs index d359f73e483..74d5dd2adc8 100644 --- a/src/test/debuginfo/generic-tuple-style-enum.rs +++ b/src/test/debuginfo/generic-tuple-style-enum.rs @@ -48,6 +48,8 @@ // lldb-command:print univariant // lldb-check:[...]$3 = TheOnlyCase(-1) +use self::Regular::{Case1, Case2, Case3}; +use self::Univariant::TheOnlyCase; // NOTE: This is a copy of the non-generic test case. The `Txx` type parameters have to be // substituted with something of size `xx` bits and the same alignment as an integer type of the diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs index f3ea1856502..399d9fabd7a 100644 --- a/src/test/debuginfo/method-on-enum.rs +++ b/src/test/debuginfo/method-on-enum.rs @@ -139,11 +139,11 @@ impl Enum { } fn main() { - let stack = Variant2(117901063); + let stack = Enum::Variant2(117901063); let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned = box Variant1{ x: 1799, y: 1799 }; + let owned = box Enum::Variant1{ x: 1799, y: 1799 }; let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/option-like-enum.rs b/src/test/debuginfo/option-like-enum.rs index c6adce78195..7b8526adba7 100644 --- a/src/test/debuginfo/option-like-enum.rs +++ b/src/test/debuginfo/option-like-enum.rs @@ -101,19 +101,19 @@ fn main() { let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678u) }); let none: Option<&u32> = None; - let full = Full(454545, unsafe { std::mem::transmute(0x87654321u) }, 9988); + let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321u) }, 9988); - let empty = Empty; - let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&Empty) }; + let empty = MoreFields::Empty; + let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&MoreFields::Empty) }; - let droid = Droid { + let droid = NamedFields::Droid { id: 675675, range: 10000001, internals: unsafe { std::mem::transmute(0x43218765u) } }; - let void_droid = Void; - let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&Void) }; + let void_droid = NamedFields::Void; + let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) }; zzz(); // #break } diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index dd55435ea44..b0c01ecce08 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -71,6 +71,8 @@ #![allow(unused_variables)] #![feature(struct_variant)] +use self::Opt::{Empty, Val}; + enum Opt<T> { Empty, Val { val: T } diff --git a/src/test/debuginfo/struct-in-enum.rs b/src/test/debuginfo/struct-in-enum.rs index a2fb87f7b2b..68281cb2230 100644 --- a/src/test/debuginfo/struct-in-enum.rs +++ b/src/test/debuginfo/struct-in-enum.rs @@ -43,6 +43,9 @@ #![allow(unused_variables)] +use self::Regular::{Case1, Case2}; +use self::Univariant::TheOnlyCase; + struct Struct { x: u32, y: i32, diff --git a/src/test/debuginfo/struct-style-enum.rs b/src/test/debuginfo/struct-style-enum.rs index 2bf85cec2b7..899b43ad559 100644 --- a/src/test/debuginfo/struct-style-enum.rs +++ b/src/test/debuginfo/struct-style-enum.rs @@ -51,6 +51,9 @@ #![allow(unused_variables)] #![feature(struct_variant)] +use self::Regular::{Case1, Case2, Case3}; +use self::Univariant::TheOnlyCase; + // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when // datatype layout should be predictable as in this case. diff --git a/src/test/debuginfo/tuple-style-enum.rs b/src/test/debuginfo/tuple-style-enum.rs index d4428d7662d..07a0f169606 100644 --- a/src/test/debuginfo/tuple-style-enum.rs +++ b/src/test/debuginfo/tuple-style-enum.rs @@ -50,6 +50,9 @@ #![allow(unused_variables)] +use self::Regular::{Case1, Case2, Case3}; +use self::Univariant::TheOnlyCase; + // The first element is to ensure proper alignment, irrespective of the machines word size. Since // the size of the discriminant value is machine dependent, this has be taken into account when // datatype layout should be predictable as in this case. diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index 71563f843b0..e7664d1029b 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -176,6 +176,7 @@ // gdb-command:whatis stack_closure2 // gdb-check:type = struct (&mut|i8, f32| -> f32, uint) +use self::Enum1::{Variant1_1, Variant1_2}; use std::ptr; struct Struct1; @@ -187,6 +188,7 @@ enum Enum1 { } mod Mod1 { + pub use self::Enum2::{Variant2_1, Variant2_2}; pub struct Struct2; pub enum Enum2 { @@ -195,6 +197,7 @@ mod Mod1 { } pub mod Mod2 { + pub use self::Enum3::{Variant3_1, Variant3_2}; pub struct Struct3; pub enum Enum3<T> { diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs index 32b1bebee19..01785340744 100644 --- a/src/test/debuginfo/unique-enum.rs +++ b/src/test/debuginfo/unique-enum.rs @@ -67,15 +67,15 @@ fn main() { // 0b01111100011111000111110001111100 = 2088533116 // 0b0111110001111100 = 31868 // 0b01111100 = 124 - let the_a = box TheA { x: 0, y: 8970181431921507452 }; + let the_a = box ABC::TheA { x: 0, y: 8970181431921507452 }; // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441 // 0b00010001000100010001000100010001 = 286331153 // 0b0001000100010001 = 4369 // 0b00010001 = 17 - let the_b = box TheB (0, 286331153, 286331153); + let the_b = box ABC::TheB (0, 286331153, 286331153); - let univariant = box TheOnlyCase(123234); + let univariant = box Univariant::TheOnlyCase(123234); zzz(); // #break } |
