diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index b7d4596b0febf..0a902d970ef32 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Mode::*; use std::fmt; use std::str::FromStr; diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index d49ff0258ab02..f76cefcd94127 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -9,7 +9,7 @@ // except according to those terms. #![crate_type = "bin"] -#![feature(phase, slicing_syntax)] +#![feature(phase, slicing_syntax, globs)] #![deny(warnings)] diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index c56424159f483..75dc45d16eb36 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -7,6 +7,8 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +#[cfg(not(stage0))] +use self::TargetLocation::*; use common::Config; use common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind, DebugInfoGdb}; diff --git a/src/doc/guide-lifetimes.md b/src/doc/guide-lifetimes.md index e3c050f0e9016..7a5c535827c25 100644 --- a/src/doc/guide-lifetimes.md +++ b/src/doc/guide-lifetimes.md @@ -308,8 +308,8 @@ copying. # } fn compute_area(shape: &Shape) -> f64 { match *shape { - Circle(_, radius) => std::f64::consts::PI * radius * radius, - Rectangle(_, ref size) => size.w * size.h + Shape::Circle(_, radius) => std::f64::consts::PI * radius * radius, + Shape::Rectangle(_, ref size) => size.w * size.h } } ~~~ @@ -478,14 +478,14 @@ example: # a: &'r T, b: &'r T) -> &'r T { # if compute_area(shape) > threshold {a} else {b} # } - // -+ r -fn select_based_on_unit_circle<'r, T>( // |-+ B - threshold: f64, a: &'r T, b: &'r T) -> &'r T { // | | - // | | - let shape = Circle(Point {x: 0., y: 0.}, 1.); // | | - select(&shape, threshold, a, b) // | | -} // |-+ - // -+ + // -+ r +fn select_based_on_unit_circle<'r, T>( // |-+ B + threshold: f64, a: &'r T, b: &'r T) -> &'r T { // | | + // | | + let shape = Shape::Circle(Point {x: 0., y: 0.}, 1.); // | | + select(&shape, threshold, a, b) // | | +} // |-+ + // -+ ~~~ In this call to `select()`, the lifetime of the first parameter shape diff --git a/src/doc/guide-macros.md b/src/doc/guide-macros.md index ae020037bc594..65b6014b496e8 100644 --- a/src/doc/guide-macros.md +++ b/src/doc/guide-macros.md @@ -22,15 +22,15 @@ doing nothing otherwise: ~~~~ # enum T { SpecialA(uint), SpecialB(uint) } # fn f() -> uint { -# let input_1 = SpecialA(0); -# let input_2 = SpecialA(0); +# let input_1 = T::SpecialA(0); +# let input_2 = T::SpecialA(0); match input_1 { - SpecialA(x) => { return x; } + T::SpecialA(x) => { return x; } _ => {} } // ... match input_2 { - SpecialB(x) => { return x; } + T::SpecialB(x) => { return x; } _ => {} } # return 0u; @@ -49,10 +49,10 @@ the pattern in the above code: # #![feature(macro_rules)] # enum T { SpecialA(uint), SpecialB(uint) } # fn f() -> uint { -# let input_1 = SpecialA(0); -# let input_2 = SpecialA(0); +# let input_1 = T::SpecialA(0); +# let input_2 = T::SpecialA(0); macro_rules! early_return( - ($inp:expr $sp:ident) => ( // invoke it like `(input_5 SpecialE)` + ($inp:expr $sp:path) => ( // invoke it like `(input_5 SpecialE)` match $inp { $sp(x) => { return x; } _ => {} @@ -60,9 +60,9 @@ macro_rules! early_return( ); ) // ... -early_return!(input_1 SpecialA); +early_return!(input_1 T::SpecialA); // ... -early_return!(input_2 SpecialB); +early_return!(input_2 T::SpecialB); # return 0; # } # fn main() {} @@ -169,10 +169,10 @@ instead of `*` to mean "at least one". # #![feature(macro_rules)] # enum T { SpecialA(uint),SpecialB(uint),SpecialC(uint),SpecialD(uint)} # fn f() -> uint { -# let input_1 = SpecialA(0); -# let input_2 = SpecialA(0); +# let input_1 = T::SpecialA(0); +# let input_2 = T::SpecialA(0); macro_rules! early_return( - ($inp:expr, [ $($sp:ident)|+ ]) => ( + ($inp:expr, [ $($sp:path)|+ ]) => ( match $inp { $( $sp(x) => { return x; } @@ -182,9 +182,9 @@ macro_rules! early_return( ); ) // ... -early_return!(input_1, [SpecialA|SpecialC|SpecialD]); +early_return!(input_1, [T::SpecialA|T::SpecialC|T::SpecialD]); // ... -early_return!(input_2, [SpecialB]); +early_return!(input_2, [T::SpecialB]); # return 0; # } # fn main() {} @@ -234,9 +234,9 @@ Now consider code like the following: # enum T3 { Good2(uint), Bad2} # fn f(x: T1) -> uint { match x { - Good1(g1, val) => { + T1::Good1(g1, val) => { match g1.body { - Good2(result) => { + T3::Good2(result) => { // complicated stuff goes here return result + val; }, @@ -281,9 +281,9 @@ macro_rules! biased_match ( # struct T2 { body: T3 } # enum T3 { Good2(uint), Bad2} # fn f(x: T1) -> uint { -biased_match!((x) ~ (Good1(g1, val)) else { return 0 }; +biased_match!((x) ~ (T1::Good1(g1, val)) else { return 0 }; binds g1, val ) -biased_match!((g1.body) ~ (Good2(result) ) +biased_match!((g1.body) ~ (T3::Good2(result) ) else { panic!("Didn't get good_2") }; binds result ) // complicated stuff goes here @@ -396,8 +396,8 @@ macro_rules! biased_match ( # enum T3 { Good2(uint), Bad2} # fn f(x: T1) -> uint { biased_match!( - (x) ~ (Good1(g1, val)) else { return 0 }; - (g1.body) ~ (Good2(result) ) else { panic!("Didn't get Good2") }; + (x) ~ (T1::Good1(g1, val)) else { return 0 }; + (g1.body) ~ (T3::Good2(result) ) else { panic!("Didn't get Good2") }; binds val, result ) // complicated stuff goes here return result + val; diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md index 2c6388a618052..cf7ecd7e51ff7 100644 --- a/src/doc/guide-pointers.md +++ b/src/doc/guide-pointers.md @@ -598,7 +598,7 @@ enum List { } fn main() { - let list: List = Cons(1, box Cons(2, box Cons(3, box Nil))); + let list: List = List::Cons(1, box List::Cons(2, box List::Cons(3, box List::Nil))); println!("{}", list); } ``` diff --git a/src/doc/guide.md b/src/doc/guide.md index 473c30ab1c44e..616bf0464b3b5 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -1263,17 +1263,17 @@ enum OptionalInt { } fn main() { - let x = Value(5); - let y = Missing; + let x = OptionalInt::Value(5); + let y = OptionalInt::Missing; match x { - Value(n) => println!("x is {}", n), - Missing => println!("x is missing!"), + OptionalInt::Value(n) => println!("x is {}", n), + OptionalInt::Missing => println!("x is missing!"), } match y { - Value(n) => println!("y is {}", n), - Missing => println!("y is missing!"), + OptionalInt::Value(n) => println!("y is {}", n), + OptionalInt::Missing => println!("y is missing!"), } } ``` @@ -1702,17 +1702,17 @@ enum OptionalInt { } fn main() { - let x = Value(5); - let y = Missing; + let x = OptionalInt::Value(5); + let y = OptionalInt::Missing; match x { - Value(n) => println!("x is {}", n), - Missing => println!("x is missing!"), + OptionalInt::Value(n) => println!("x is {}", n), + OptionalInt::Missing => println!("x is missing!"), } match y { - Value(n) => println!("y is {}", n), - Missing => println!("y is missing!"), + OptionalInt::Value(n) => println!("y is {}", n), + OptionalInt::Missing => println!("y is missing!"), } } ``` @@ -3709,7 +3709,7 @@ enum List { } fn main() { - let list = Node(0, box Node(1, box Nil)); + let list = List::Node(0, box List::Node(1, box List::Nil)); } ``` @@ -3895,11 +3895,11 @@ enum OptionalInt { Missing, } -let x = Value(5i); +let x = OptionalInt::Value(5i); match x { - Value(..) => println!("Got an int!"), - Missing => println!("No such luck."), + OptionalInt::Value(..) => println!("Got an int!"), + OptionalInt::Missing => println!("No such luck."), } ``` @@ -3911,12 +3911,12 @@ enum OptionalInt { Missing, } -let x = Value(5i); +let x = OptionalInt::Value(5i); match x { - Value(i) if i > 5 => println!("Got an int bigger than five!"), - Value(..) => println!("Got an int!"), - Missing => println!("No such luck."), + OptionalInt::Value(i) if i > 5 => println!("Got an int bigger than five!"), + OptionalInt::Value(..) => println!("Got an int!"), + OptionalInt::Missing => println!("No such luck."), } ``` diff --git a/src/doc/reference.md b/src/doc/reference.md index 28cb2de29239a..f31f28d6c08ce 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1331,8 +1331,8 @@ enum Animal { Cat } -let mut a: Animal = Dog; -a = Cat; +let mut a: Animal = Animal::Dog; +a = Animal::Cat; ``` Enumeration constructors can have either named or unnamed fields: @@ -1345,8 +1345,8 @@ enum Animal { Cat { name: String, weight: f64 } } -let mut a: Animal = Dog("Cocoa".to_string(), 37.2); -a = Cat { name: "Spotty".to_string(), weight: 2.7 }; +let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2); +a = Animal::Cat { name: "Spotty".to_string(), weight: 2.7 }; # } ``` @@ -3308,12 +3308,12 @@ fields of a particular variant. For example: ``` enum List { Nil, Cons(X, Box>) } -let x: List = Cons(10, box Cons(11, box Nil)); +let x: List = List::Cons(10, box List::Cons(11, box List::Nil)); match x { - Cons(_, box Nil) => panic!("singleton list"), - Cons(..) => return, - Nil => panic!("empty list") + List::Cons(_, box List::Nil) => panic!("singleton list"), + List::Cons(..) => return, + List::Nil => panic!("empty list") } ``` @@ -3371,16 +3371,16 @@ An example of a `match` expression: enum List { Nil, Cons(X, Box>) } -let x: List = Cons(10, box Cons(11, box Nil)); +let x: List = List::Cons(10, box List::Cons(11, box List::Nil)); match x { - Cons(a, box Cons(b, _)) => { + List::Cons(a, box List::Cons(b, _)) => { process_pair(a, b); } - Cons(10, _) => { + List::Cons(10, _) => { process_ten(); } - Nil => { + List::Nil => { return; } _ => { @@ -3402,10 +3402,10 @@ enum List { Nil, Cons(uint, Box) } fn is_sorted(list: &List) -> bool { match *list { - Nil | Cons(_, box Nil) => true, - Cons(x, ref r @ box Cons(_, _)) => { + List::Nil | List::Cons(_, box List::Nil) => true, + List::Cons(x, ref r @ box List::Cons(_, _)) => { match *r { - box Cons(y, _) => (x <= y) && is_sorted(&**r), + box List::Cons(y, _) => (x <= y) && is_sorted(&**r), _ => panic!() } } @@ -3413,7 +3413,7 @@ fn is_sorted(list: &List) -> bool { } fn main() { - let a = Cons(6, box Cons(7, box Cons(42, box Nil))); + let a = List::Cons(6, box List::Cons(7, box List::Cons(42, box List::Nil))); assert!(is_sorted(&a)); } @@ -3718,7 +3718,7 @@ enum List { Cons(T, Box>) } -let a: List = Cons(7, box Cons(13, box Nil)); +let a: List = List::Cons(7, box List::Cons(13, box List::Nil)); ``` ### Pointer types diff --git a/src/etc/unicode.py b/src/etc/unicode.py index 980d75b29adda..15263919fb9b8 100755 --- a/src/etc/unicode.py +++ b/src/etc/unicode.py @@ -391,6 +391,7 @@ def emit_conversions_module(f, lowerupper, upperlower): def emit_grapheme_module(f, grapheme_table, grapheme_cats): f.write("""pub mod grapheme { use core::slice::SlicePrelude; + pub use self::GraphemeCat::*; use core::slice; #[allow(non_camel_case_types)] diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index 57ca585f15e7b..0b6d9e356b910 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -15,8 +15,11 @@ // writing (August 2014) freely licensed under the following Creative Commons Attribution // License: [CC BY 2.5 CA](http://creativecommons.org/licenses/by/2.5/ca/). +pub use self::Entry::*; + use core::prelude::*; +use self::StackOp::*; use super::node::*; use std::hash::{Writer, Hash}; use core::default::Default; @@ -445,6 +448,7 @@ impl BTreeMap { /// to nodes. By using this module much better safety guarantees can be made, and more search /// boilerplate gets cut out. mod stack { + pub use self::PushResult::*; use core::prelude::*; use super::BTreeMap; use super::super::node::*; diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs index a15d31ba2842a..6e9341231ad69 100644 --- a/src/libcollections/btree/node.rs +++ b/src/libcollections/btree/node.rs @@ -11,6 +11,10 @@ // This module represents all the internal representation and logic for a B-Tree's node // with a safe interface, so that BTreeMap itself does not depend on any of these details. +pub use self::InsertionResult::*; +pub use self::SearchResult::*; +pub use self::TraversalItem::*; + use core::prelude::*; use core::{slice, mem, ptr}; diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index ac8e45f9f9417..3d750a30c2960 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -260,6 +260,7 @@ impl Extend for EnumSet { #[cfg(test)] mod test { use std::prelude::*; + use self::Foo::*; use std::mem; use super::{EnumSet, CLike}; @@ -488,6 +489,6 @@ mod test { } } let mut set = EnumSet::new(); - set.insert(V64); + set.insert(Bar::V64); } } diff --git a/src/libcollections/ring_buf.rs b/src/libcollections/ring_buf.rs index e95660b546ebc..643b500ec3e2b 100644 --- a/src/libcollections/ring_buf.rs +++ b/src/libcollections/ring_buf.rs @@ -845,6 +845,8 @@ impl fmt::Show for RingBuf { #[cfg(test)] mod tests { + use self::Taggy::*; + use self::Taggypar::*; use std::fmt::Show; use std::prelude::*; use std::hash; diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 09a26a1caacd4..000c3e08c677b 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -87,6 +87,7 @@ #![doc(primitive = "slice")] +use self::Direction::*; use alloc::boxed::Box; use core::cmp; use core::kinds::Sized; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 1a57479c8119c..ae8e92fc6cb9d 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -51,6 +51,10 @@ #![doc(primitive = "str")] +pub use self::MaybeOwned::*; +use self::RecompositionState::*; +use self::DecompositionType::*; + use core::default::Default; use core::fmt; use core::cmp; diff --git a/src/libcollections/trie/map.rs b/src/libcollections/trie/map.rs index da53b5e9166ab..8d1fb9e2a86af 100644 --- a/src/libcollections/trie/map.rs +++ b/src/libcollections/trie/map.rs @@ -9,9 +9,10 @@ // except according to those terms. //! Ordered maps and sets, implemented as simple tries. - use core::prelude::*; +pub use self::Entry::*; +use self::TrieNode::*; use alloc::boxed::Box; use core::default::Default; use core::fmt; @@ -105,7 +106,7 @@ struct InternalNode { } // Each child of an InternalNode may be internal, in which case nesting continues, -// external (containing a value), or empty. +// external (containing a value), or empty #[deriving(Clone)] enum TrieNode { Internal(Box>), @@ -1221,8 +1222,9 @@ mod test { use std::uint; use std::hash; - use super::{TrieMap, InternalNode, Internal, External, Nothing}; - use super::{Occupied, Vacant}; + use super::{TrieMap, InternalNode}; + use super::Entry::*; + use super::TrieNode::*; fn check_integrity(trie: &InternalNode) { assert!(trie.count != 0); diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs index d84a7875df1aa..d2bca1e6ec7d0 100644 --- a/src/libcore/atomic.rs +++ b/src/libcore/atomic.rs @@ -12,6 +12,8 @@ #![stable] +pub use self::Ordering::*; + use intrinsics; use std::kinds::marker; use cell::UnsafeCell; diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index dfa339433c846..59d31a0749f11 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -41,6 +41,8 @@ #![stable] +pub use self::Ordering::*; + use kinds::Sized; use option::{Option, Some, None}; diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 44a39aa265b99..269a456542cb0 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -51,7 +51,7 @@ //! } //! //! impl Default for Kind { -//! fn default() -> Kind { A } +//! fn default() -> Kind { Kind::A } //! } //! //! #[deriving(Default)] @@ -127,7 +127,7 @@ pub trait Default { /// } /// /// impl Default for Kind { - /// fn default() -> Kind { A } + /// fn default() -> Kind { Kind::A } /// } /// ``` fn default() -> Self; diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index bb3c8e71a52ca..5fd4e2e326df0 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -10,6 +10,10 @@ #![allow(missing_docs)] +pub use self::ExponentFormat::*; +pub use self::SignificantDigits::*; +pub use self::SignFormat::*; + use char; use fmt; use iter::{range, DoubleEndedIterator}; diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 2d33d5b5525fd..1efb595610155 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -12,6 +12,8 @@ #![allow(unused_variables)] +pub use self::FormatError::*; + use any; use cell::{Cell, Ref, RefMut}; use iter::{Iterator, range}; diff --git a/src/libcore/fmt/rt.rs b/src/libcore/fmt/rt.rs index 1c88eb6ddfa17..0e8504e7ee57c 100644 --- a/src/libcore/fmt/rt.rs +++ b/src/libcore/fmt/rt.rs @@ -14,6 +14,11 @@ //! These definitions are similar to their `ct` equivalents, but differ in that //! these can be statically allocated and are slightly optimized for the runtime +pub use self::Alignment::*; +pub use self::Count::*; +pub use self::Position::*; +pub use self::Flag::*; + #[doc(hidden)] pub struct Argument<'a> { pub position: Position, diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 774aa8a66d288..93d8d7d6e48a9 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -58,6 +58,8 @@ This `for` loop syntax can be applied to any iterator over any type. */ +pub use self::MinMaxResult::*; + use clone::Clone; use cmp; use cmp::Ord; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index f5505ff8e7625..800b0c1a9059f 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -14,6 +14,8 @@ #![allow(missing_docs)] +pub use self::FPCategory::*; + use {int, i8, i16, i32, i64}; use {uint, u8, u16, u32, u64}; use {f32, f64}; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 0c30c4f749a81..5b1590518f88d 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -112,12 +112,12 @@ //! //! // A list of data to search through. //! let all_the_big_things = [ -//! Plant(250, "redwood"), -//! Plant(230, "noble fir"), -//! Plant(229, "sugar pine"), -//! Animal(25, "blue whale"), -//! Animal(19, "fin whale"), -//! Animal(15, "north pacific right whale"), +//! Kingdom::Plant(250, "redwood"), +//! Kingdom::Plant(230, "noble fir"), +//! Kingdom::Plant(229, "sugar pine"), +//! Kingdom::Animal(25, "blue whale"), +//! Kingdom::Animal(19, "fin whale"), +//! Kingdom::Animal(15, "north pacific right whale"), //! ]; //! //! // We're going to search for the name of the biggest animal, @@ -126,12 +126,12 @@ //! let mut size_of_biggest_animal = 0; //! for big_thing in all_the_big_things.iter() { //! match *big_thing { -//! Animal(size, name) if size > size_of_biggest_animal => { +//! Kingdom::Animal(size, name) if size > size_of_biggest_animal => { //! // Now we've found the name of some big animal //! size_of_biggest_animal = size; //! name_of_biggest_animal = Some(name); //! } -//! Animal(..) | Plant(..) => () +//! Kingdom::Animal(..) | Kingdom::Plant(..) => () //! } //! } //! @@ -143,6 +143,8 @@ #![stable] +pub use self::Option::*; + use cmp::{Eq, Ord}; use default::Default; use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize}; diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index 101eb7ac74cdb..9f883d6049623 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -48,14 +48,17 @@ pub use str::from_str; pub use char::Char; pub use clone::Clone; pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; -pub use cmp::{Ordering, Less, Equal, Greater, Equiv}; +pub use cmp::{Ordering, Equiv}; +pub use cmp::Ordering::{Less, Equal, Greater}; pub use iter::{FromIterator, Extend}; pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator}; pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize}; pub use num::{ToPrimitive, FromPrimitive}; -pub use option::{Option, Some, None}; +pub use option::Option; +pub use option::Option::{Some, None}; pub use ptr::RawPtr; -pub use result::{Result, Ok, Err}; +pub use result::Result; +pub use result::Result::{Ok, Err}; pub use str::{Str, StrPrelude}; pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4}; pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8}; diff --git a/src/libcore/result.rs b/src/libcore/result.rs index e88b6b2cf03d8..0dc4fb839659d 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -38,8 +38,8 @@ //! return Err("invalid header length"); //! } //! match header[0] { -//! 1 => Ok(Version1), -//! 2 => Ok(Version2), +//! 1 => Ok(Version::Version1), +//! 2 => Ok(Version::Version2), //! _ => Err("invalid version") //! } //! } @@ -276,6 +276,8 @@ #![stable] +pub use self::Result::*; + use std::fmt::Show; use slice; use slice::AsSlice; diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index a7730b67f1f8d..7923c46717e66 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -34,6 +34,8 @@ // * The `raw` and `bytes` submodules. // * Boilerplate trait implementations. +pub use self::BinarySearchResult::*; + use mem::transmute; use clone::Clone; use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Less, Equal, Greater, Equiv}; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index cde255f10f471..bc30429c05c92 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -16,6 +16,9 @@ #![doc(primitive = "str")] +pub use self::Utf16Item::*; +pub use self::Searcher::{Naive, TwoWay, TwoWayLong}; + use mem; use char; use char::Char; diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 2dd9d00ca1f23..71a3f24babb82 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -20,6 +20,11 @@ #![crate_type = "rlib"] #![crate_type = "dylib"] #![feature(macro_rules, globs, import_shadowing)] +pub use self::Piece::*; +pub use self::Position::*; +pub use self::Alignment::*; +pub use self::Flag::*; +pub use self::Count::*; use std::char; use std::str; diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index c2fb52e5c5dea..ad30bf304fc02 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -93,6 +93,13 @@ #[cfg(test)] #[phase(plugin, link)] extern crate log; +pub use self::Name::*; +pub use self::HasArg::*; +pub use self::Occur::*; +pub use self::Fail_::*; +pub use self::FailType::*; +use self::Optval::*; + use std::fmt; use std::result::{Err, Ok}; use std::result; @@ -831,6 +838,20 @@ pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> String { line } +enum SplitWithinState { + A, // leading whitespace, initial state + B, // words + C, // internal and trailing whitespace +} +enum Whitespace { + Ws, // current char is whitespace + Cr // current char is not whitespace +} +enum LengthLimit { + UnderLim, // current char makes current substring still fit in limit + OverLim // current char makes current substring no longer fit in limit +} + /// Splits a string into substrings with possibly internal whitespace, /// each of them at most `lim` bytes long. The substrings have leading and trailing @@ -845,22 +866,11 @@ pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> String { /// sequence longer than the limit. fn each_split_within<'a>(ss: &'a str, lim: uint, it: |&'a str| -> bool) -> bool { + use self::SplitWithinState::*; + use self::Whitespace::*; + use self::LengthLimit::*; // Just for fun, let's write this as a state machine: - enum SplitWithinState { - A, // leading whitespace, initial state - B, // words - C, // internal and trailing whitespace - } - enum Whitespace { - Ws, // current char is whitespace - Cr // current char is not whitespace - } - enum LengthLimit { - UnderLim, // current char makes current substring still fit in limit - OverLim // current char makes current substring no longer fit in limit - } - let mut slice_start = 0; let mut last_start = 0; let mut last_end = 0; diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 7035809640d4a..eff5345e85e52 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -274,6 +274,9 @@ pub fn main() { #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] +#![feature(globs)] + +pub use self::LabelText::*; use std::io; use std::str; @@ -539,6 +542,7 @@ pub fn render<'a, N:'a, E:'a, G:Labeller<'a,N,E>+GraphWalk<'a,N,E>, W:Writer>( #[cfg(test)] mod tests { + use self::NodeLabels::*; use super::{Id, LabelText, LabelStr, EscStr, Labeller}; use super::{Nodes, Edges, GraphWalk, render}; use std::io::{MemWriter, BufReader, IoResult}; diff --git a/src/libgraphviz/maybe_owned_vec.rs b/src/libgraphviz/maybe_owned_vec.rs index d091a98933c09..5d97e9787e805 100644 --- a/src/libgraphviz/maybe_owned_vec.rs +++ b/src/libgraphviz/maybe_owned_vec.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::MaybeOwnedVector::*; + use std::default::Default; use std::fmt; use std::iter::FromIterator; diff --git a/src/libgreen/basic.rs b/src/libgreen/basic.rs index e2b8eb54ac3ae..aa933f182e545 100644 --- a/src/libgreen/basic.rs +++ b/src/libgreen/basic.rs @@ -14,6 +14,7 @@ //! //! This implementation is also used as the fallback implementation of an event //! loop if no other one is provided (and M:N scheduling is desired). +use self::Message::*; use alloc::arc::Arc; use std::sync::atomic; diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs index ed394fc0de5f9..4e2908dd2b025 100644 --- a/src/libgreen/lib.rs +++ b/src/libgreen/lib.rs @@ -183,8 +183,7 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -// NB this does *not* include globs, please keep it that way. -#![feature(macro_rules, phase, default_type_params)] +#![feature(macro_rules, phase, default_type_params, globs)] #![allow(deprecated)] #[cfg(test)] #[phase(plugin, link)] extern crate log; diff --git a/src/libgreen/message_queue.rs b/src/libgreen/message_queue.rs index d4f2b255158bb..c589a9fb592d8 100644 --- a/src/libgreen/message_queue.rs +++ b/src/libgreen/message_queue.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::PopResult::*; + use alloc::arc::Arc; use std::sync::mpsc_queue as mpsc; use std::kinds::marker; diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index 50b10873faf48..e8cb65d35df6a 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::SchedMessage::*; +use self::EffortLevel::*; + use std::mem; use std::rt::local::Local; use std::rt::mutex::NativeMutex; diff --git a/src/libgreen/task.rs b/src/libgreen/task.rs index 428b64144128b..e159c153bc38c 100644 --- a/src/libgreen/task.rs +++ b/src/libgreen/task.rs @@ -18,6 +18,9 @@ //! contains the rust task itself in order to juggle around ownership of the //! values. +pub use self::TaskType::*; +pub use self::Home::*; + use std::any::Any; use std::mem; use std::raw; diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 6756d4b21ff78..1a86ef2c6e00e 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -85,6 +85,8 @@ extern crate core; #[cfg(test)] extern crate test; #[cfg(test)] extern crate native; +pub use self::Nullable::*; + // Explicit export lists for the intersection (provided here) mean that // you can write more-platform-agnostic code if you stick to just these // symbols. diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index 4e25feb9d7531..ea1136dfe3c43 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -58,7 +58,7 @@ #![deny(unused_results, unused_must_use)] #![allow(non_camel_case_types)] #![allow(unknown_features)] -#![feature(default_type_params, lang_items, slicing_syntax)] +#![feature(default_type_params, lang_items, slicing_syntax, globs)] // NB this crate explicitly does *not* allow glob imports, please seriously // consider whether they're needed before adding that feature here (the diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 8ae7f070ddb25..a8ce2efd5392f 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -12,6 +12,9 @@ //! The Gamma and derived distributions. +use self::GammaRepr::*; +use self::ChiSquaredRepr::*; + use core::num::Float; use {Rng, Open01}; diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 5658fde12044e..ccc7b96b26b82 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -25,7 +25,7 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] -#![feature(macro_rules, phase, slicing_syntax)] +#![feature(macro_rules, phase, slicing_syntax, globs)] #![allow(missing_docs)] extern crate serialize; @@ -33,6 +33,9 @@ extern crate serialize; #[phase(plugin, link)] extern crate log; #[cfg(test)] extern crate test; +pub use self::EbmlEncoderTag::*; +pub use self::Error::*; + use std::str; pub mod io; diff --git a/src/libregex/compile.rs b/src/libregex/compile.rs index 2b82b620e3968..52167ead18ad4 100644 --- a/src/libregex/compile.rs +++ b/src/libregex/compile.rs @@ -11,6 +11,8 @@ // Enable this to squash warnings due to exporting pieces of the representation // for use with the regex! macro. See lib.rs for explanation. +pub use self::Inst::*; + use std::cmp; use parse; use parse::{ diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index b849afbbf54e7..d8f1eeee50b0e 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -370,7 +370,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] -#![feature(macro_rules, phase, slicing_syntax)] +#![feature(macro_rules, phase, slicing_syntax, globs)] #![deny(missing_docs)] #[cfg(test)] diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs index ba3134d7d1619..c6f09e4697182 100644 --- a/src/libregex/parse.rs +++ b/src/libregex/parse.rs @@ -8,6 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Ast::*; +pub use self::Repeater::*; +pub use self::Greed::*; +use self::BuildAst::*; + use std::char; use std::cmp; use std::fmt; diff --git a/src/libregex/re.rs b/src/libregex/re.rs index c7540852970d8..dbdb271874474 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::NamesIter::*; +pub use self::Regex::*; + use std::collections::HashMap; use std::fmt; use std::str::{MaybeOwned, Owned, Slice}; diff --git a/src/libregex/vm.rs b/src/libregex/vm.rs index aa18a65dc58bb..79019d213b8ba 100644 --- a/src/libregex/vm.rs +++ b/src/libregex/vm.rs @@ -33,6 +33,9 @@ // // [1] - http://swtch.com/~rsc/regex/regex3.html +pub use self::MatchKind::*; +pub use self::StepState::*; + use std::cmp; use std::mem; use std::slice::SlicePrelude; diff --git a/src/librustc/back/write.rs b/src/librustc/back/write.rs index a869db9eb6b56..19ddb844bec0f 100644 --- a/src/librustc/back/write.rs +++ b/src/librustc/back/write.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::OutputType::*; + use back::lto; use back::link::{get_cc_prog, remove}; use driver::driver::{CrateTranslation, ModuleTranslation, OutputFilenames}; diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index e42d17c119f8a..1a40a04350d51 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -11,6 +11,12 @@ //! Contains infrastructure for configuring the compiler, including parsing //! command line options. +pub use self::EntryFnType::*; +pub use self::CrateType::*; +pub use self::Passes::*; +pub use self::OptLevel::*; +pub use self::DebugInfoLevel::*; + use driver::{early_error, early_warn}; use driver::driver; use driver::session::Session; diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 79a65ac579542..498e676474c27 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Input::*; use back::link; use back::write; diff --git a/src/librustc/driver/pretty.rs b/src/librustc/driver/pretty.rs index 7b6de088319f4..8099bf314c27c 100644 --- a/src/librustc/driver/pretty.rs +++ b/src/librustc/driver/pretty.rs @@ -10,6 +10,11 @@ //! The various pretty print routines. +pub use self::UserIdentifiedItem::*; +pub use self::PpSourceMode::*; +pub use self::PpMode::*; +use self::NodesMatchingUII::*; + use back::link; use driver::config; diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index ac2f6dd9d376a..4247d192d6d4c 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -24,6 +24,7 @@ //! `add_builtin!` or `add_builtin_with_new!` invocation in `context.rs`. //! Use the former for unit-like structs and the latter for structs with //! a `pub fn new()`. +use self::MethodContext::*; use metadata::csearch; use middle::def::*; diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 917f05365ec0e..85cc413a1b801 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -23,6 +23,7 @@ //! previous lint state is pushed onto a stack and the ast is then recursed //! upon. As the ast is traversed, this keeps track of the current lint level //! for all lint attributes. +use self::TargetLint::*; use middle::privacy::ExportedItems; use middle::subst; diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 3ea4c9c720c8f..315462235bebd 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -30,6 +30,9 @@ #![macro_escape] +pub use self::Level::*; +pub use self::LintSource::*; + use std::hash; use std::ascii::AsciiExt; use syntax::codemap::Span; diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index a04f94c31bfc5..0da3b1b7a4e3e 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -10,6 +10,8 @@ #![allow(non_camel_case_types, non_upper_case_globals)] +pub use self::astencode_tag::*; + use std::mem; use back::svh::Svh; diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index ff78491c2ad9d..50c4178601f2f 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -12,6 +12,8 @@ #![allow(non_camel_case_types)] +pub use self::found_ast::*; + use metadata::common::*; use metadata::cstore; use metadata::decoder; diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index f2c84bdabfc4a..c844c8940fe62 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -13,6 +13,10 @@ // The crate store - a central repo for information collected about external // crates and libraries +pub use self::MetadataBlob::*; +pub use self::LinkagePreference::*; +pub use self::NativeLibaryKind::*; + use back::svh::Svh; use metadata::decoder; use metadata::loader; diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index f23e1a29c2fd4..2af1f12a2cd82 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -12,6 +12,9 @@ #![allow(non_camel_case_types)] +pub use self::DefLike::*; +use self::Family::*; + use back::svh::Svh; use metadata::cstore::crate_metadata; use metadata::common::*; diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 322191701e290..e7a31520915ca 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -13,6 +13,8 @@ #![allow(unused_must_use)] // everything is just a MemWriter, can't fail #![allow(non_camel_case_types)] +pub use self::InlinedItemRef::*; + use back::svh::Svh; use driver::config; use metadata::common::*; @@ -151,6 +153,10 @@ fn encode_variant_id(rbml_w: &mut Encoder, vid: DefId) { let s = def_to_string(vid); rbml_w.writer.write(s.as_bytes()); rbml_w.end_tag(); + + rbml_w.start_tag(tag_mod_child); + rbml_w.wr_str(s.as_slice()); + rbml_w.end_tag(); } pub fn write_closure_type(ecx: &EncodeContext, diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 99e9deb46376c..aeed829f8055b 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -10,6 +10,8 @@ #![allow(non_camel_case_types)] +pub use self::FileMatch::*; + use std::cell::RefCell; use std::collections::HashSet; use std::io::fs::PathExtensions; diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index 6ef970b9986bb..e1b0797e98253 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -16,6 +16,8 @@ #![allow(non_camel_case_types)] +pub use self::DefIdSource::*; + use middle::subst; use middle::subst::VecPerParamSpace; use middle::ty; diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 073b6dae0c385..c7fe1ce731946 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -16,7 +16,7 @@ // 2. loans made in overlapping scopes do not conflict // 3. assignments do not affect things loaned out as immutable // 4. moves do not affect things loaned out in any way - +use self::UseError::*; use middle::borrowck::*; use middle::expr_use_visitor as euv; diff --git a/src/librustc/middle/borrowck/gather_loans/restrictions.rs b/src/librustc/middle/borrowck/gather_loans/restrictions.rs index 6a6fc1760f2bb..1c8f1effcf6d4 100644 --- a/src/librustc/middle/borrowck/gather_loans/restrictions.rs +++ b/src/librustc/middle/borrowck/gather_loans/restrictions.rs @@ -12,6 +12,8 @@ * Computes the restrictions that result from a borrow. */ +pub use self::RestrictionResult::*; + use middle::borrowck::*; use middle::expr_use_visitor as euv; use middle::mem_categorization as mc; diff --git a/src/librustc/middle/borrowck/graphviz.rs b/src/librustc/middle/borrowck/graphviz.rs index 6c6750ad24b2e..4a2f57735e18d 100644 --- a/src/librustc/middle/borrowck/graphviz.rs +++ b/src/librustc/middle/borrowck/graphviz.rs @@ -12,6 +12,8 @@ //! libgraphviz traits, specialized to attaching borrowck analysis //! data to rendered labels. +pub use self::Variant::*; + /// For clarity, rename the graphviz crate locally to dot. use graphviz as dot; pub use middle::cfg::graphviz::{Node, Edge}; diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 4e2b280eba686..44206343c1081 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -12,6 +12,12 @@ #![allow(non_camel_case_types)] +pub use self::LoanPath::*; +pub use self::LoanPathElem::*; +pub use self::bckerr_code::*; +pub use self::AliasableViolationKind::*; +pub use self::MovedValueUseKind::*; + use middle::cfg; use middle::dataflow::DataFlowContext; use middle::dataflow::BitwiseOperator; diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index b38246647d6d5..b28d963371e85 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -15,6 +15,8 @@ comments in the section "Moves and initialization" and in `doc.rs`. */ +pub use self::MoveKind::*; + use std::cell::RefCell; use std::rc::Rc; use std::uint; diff --git a/src/librustc/middle/check_loop.rs b/src/librustc/middle/check_loop.rs index 3abf49bdfb292..9fc44744cf903 100644 --- a/src/librustc/middle/check_loop.rs +++ b/src/librustc/middle/check_loop.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +use self::Context::*; use driver::session::Session; diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index e20a67eeb8b1e..d67c5b0dece29 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Constructor::*; +use self::Usefulness::*; +use self::WitnessPreference::*; + use middle::const_eval::{compare_const_vals, const_bool, const_float, const_val}; use middle::const_eval::{const_expr_to_pat, eval_const_expr, lookup_const_by_id}; use middle::def::*; diff --git a/src/librustc/middle/check_static.rs b/src/librustc/middle/check_static.rs index dd862d53c475b..636898187e49e 100644 --- a/src/librustc/middle/check_static.rs +++ b/src/librustc/middle/check_static.rs @@ -23,6 +23,7 @@ // Rules Enforced Elsewhere: // - It's not possible to take the address of a static item with unsafe interior. This is enforced // by borrowck::gather_loans +use self::Mode::*; use middle::ty; use middle::def; diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index a626a028e2eb5..a892744262bbe 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -11,6 +11,9 @@ #![allow(non_camel_case_types)] #![allow(unsigned_negation)] +pub use self::const_val::*; +pub use self::constness::*; + use metadata::csearch; use middle::astencode; use middle::def; diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 97dfa4ecd361a..366f4bd024998 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -16,6 +16,7 @@ * GEN and KILL bits for each expression. */ +pub use self::EntryOrExit::*; use middle::cfg; use middle::cfg::CFGIndex; diff --git a/src/librustc/middle/def.rs b/src/librustc/middle/def.rs index 160bb2238e7db..4a4298f62f226 100644 --- a/src/librustc/middle/def.rs +++ b/src/librustc/middle/def.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Def::*; +pub use self::MethodProvenance::*; + use middle::subst::ParamSpace; use syntax::ast; use syntax::ast_util::local_def; diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index d4c8335d8e55f..41d35969f38be 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -10,6 +10,7 @@ //! Enforces the Rust effect system. Currently there is just one effect, /// `unsafe`. +use self::UnsafeContext::*; use middle::def; use middle::ty; diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 16e8adb8adf89..a8ab4425f1dba 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -14,6 +14,12 @@ * `ExprUseVisitor` determines how expressions are being used. */ +pub use self::MutateMode::*; +pub use self::LoanCause::*; +pub use self::ConsumeMode::*; +pub use self::MoveReason::*; +use self::OverloadedCallType::*; + use middle::mem_categorization as mc; use middle::def; use middle::mem_categorization::Typer; diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index c575d2fc4bf13..4fe770a1e0fb3 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -19,6 +19,7 @@ // // * Functions called by the compiler itself. +pub use self::LangItem::*; use driver::session::Session; use metadata::csearch::each_lang_item; diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index d1f78cf041701..c743b1f57fd71 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -107,6 +107,9 @@ * It is the responsibility of typeck to ensure that there are no * `return` expressions in a function declared as diverging. */ +use self::LoopKind::*; +use self::LiveNodeKind::*; +use self::VarKind::*; use middle::def::*; use middle::mem_categorization::Typer; diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 4c396a5a20510..c9e5bbbc54e1d 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -62,6 +62,17 @@ #![allow(non_camel_case_types)] +pub use self::PointerKind::*; +pub use self::InteriorKind::*; +pub use self::FieldName::*; +pub use self::ElementKind::*; +pub use self::MutabilityCategory::*; +pub use self::InteriorSafety::*; +pub use self::AliasableReason::*; +pub use self::Note::*; +pub use self::deref_kind::*; +pub use self::categorization::*; + use middle::def; use middle::ty; use middle::typeck; diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index d3b70afe39b50..098108b25e5d4 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -11,6 +11,8 @@ //! A pass that checks to make sure private fields and methods aren't used //! outside their scopes. This pass will also generate a set of exported items //! which are available for use externally when compiled as a library. +use self::PrivacyResult::*; +use self::FieldName::*; use std::mem::replace; diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index fd62d0cdc11c6..134e4bc8d1822 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -10,6 +10,32 @@ #![allow(non_camel_case_types)] +pub use self::PrivateDep::*; +pub use self::ImportUse::*; +pub use self::TraitItemKind::*; +pub use self::LastPrivate::*; +use self::PatternBindingMode::*; +use self::Namespace::*; +use self::NamespaceError::*; +use self::NamespaceResult::*; +use self::NameDefinition::*; +use self::ImportDirectiveSubclass::*; +use self::ReducedGraphParent::*; +use self::ResolveResult::*; +use self::FallbackSuggestion::*; +use self::TypeParameters::*; +use self::RibKind::*; +use self::MethodSort::*; +use self::UseLexicalScopeFlag::*; +use self::ModulePrefixResult::*; +use self::NameSearchType::*; +use self::BareIdentifierPatternResolution::*; +use self::DuplicateCheckingMode::*; +use self::ParentLink::*; +use self::ModuleKind::*; +use self::TraitReferenceType::*; +use self::FallbackChecks::*; + use driver::session::Session; use lint; use metadata::csearch; @@ -574,7 +600,6 @@ bitflags! { flags DefModifiers: u8 { const PUBLIC = 0b0000_0001, const IMPORTABLE = 0b0000_0010, - const ENUM_STAGING_HACK = 0b0000_0100, } } @@ -982,6 +1007,13 @@ impl<'a, 'b, 'v> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b> { } } +#[deriving(PartialEq)] +enum FallbackChecks { + Everything, + OnlyTraitAndStatics +} + + impl<'a> Resolver<'a> { fn new(session: &'a Session, crate_span: Span) -> Resolver<'a> { let graph_root = NameBindings::new(); @@ -1320,15 +1352,7 @@ impl<'a> Resolver<'a> { self.build_reduced_graph_for_variant( &**variant, local_def(item.id), - ModuleReducedGraphParent(name_bindings.get_module()), - modifiers); - - // Temporary staging hack - self.build_reduced_graph_for_variant( - &**variant, - local_def(item.id), - parent.clone(), - modifiers | ENUM_STAGING_HACK); + ModuleReducedGraphParent(name_bindings.get_module())); } parent } @@ -1596,8 +1620,7 @@ impl<'a> Resolver<'a> { fn build_reduced_graph_for_variant(&mut self, variant: &Variant, item_id: DefId, - parent: ReducedGraphParent, - modifiers: DefModifiers) { + parent: ReducedGraphParent) { let name = variant.node.name.name; let is_exported = match variant.node.kind { TupleVariantKind(_) => false, @@ -1611,12 +1634,14 @@ impl<'a> Resolver<'a> { let child = self.add_child(name, parent, ForbidDuplicateTypesAndValues, variant.span); + // variants are always treated as importable to allow them to be glob + // used child.define_value(DefVariant(item_id, local_def(variant.node.id), is_exported), - variant.span, modifiers); + variant.span, PUBLIC | IMPORTABLE); child.define_type(DefVariant(item_id, local_def(variant.node.id), is_exported), - variant.span, modifiers); + variant.span, PUBLIC | IMPORTABLE); } /// Constructs the reduced graph for one 'view item'. View items consist @@ -1875,28 +1900,20 @@ impl<'a> Resolver<'a> { match def { DefMod(_) | DefForeignMod(_) => {} - // Still here for staging - DefVariant(enum_did, variant_id, is_struct) => { - debug!("(building reduced graph for external crate) building \ - variant {}", - final_ident); - // If this variant is public, then it was publicly reexported, - // otherwise we need to inherit the visibility of the enum - // definition. - let is_exported = is_public || - self.external_exports.contains(&enum_did); - let modifiers = IMPORTABLE | ENUM_STAGING_HACK | if is_exported { - PUBLIC - } else { - DefModifiers::empty() - }; - if is_struct { - child_name_bindings.define_type(def, DUMMY_SP, modifiers); - // Not adding fields for variants as they are not accessed with a self receiver - self.structs.insert(variant_id, Vec::new()); - } else { - child_name_bindings.define_value(def, DUMMY_SP, modifiers); - } + DefVariant(_, variant_id, is_struct) => { + debug!("(building reduced graph for external crate) building \ + variant {}", + final_ident); + // variants are always treated as importable to allow them to be + // glob used + let modifiers = PUBLIC | IMPORTABLE; + if is_struct { + child_name_bindings.define_type(def, DUMMY_SP, modifiers); + // Not adding fields for variants as they are not accessed with a self receiver + self.structs.insert(variant_id, Vec::new()); + } else { + child_name_bindings.define_value(def, DUMMY_SP, modifiers); + } } DefFn(ctor_id, true) => { child_name_bindings.define_value( @@ -1954,40 +1971,6 @@ impl<'a> Resolver<'a> { is_public, DUMMY_SP) } - DefTy(def_id, true) => { // enums - debug!("(building reduced graph for external crate) building enum {}", final_ident); - child_name_bindings.define_type(def, DUMMY_SP, modifiers); - let enum_module = ModuleReducedGraphParent(child_name_bindings.get_module()); - - let variants = csearch::get_enum_variant_defs(&self.session.cstore, def_id); - for &(v_def, name, vis) in variants.iter() { - let (variant_id, is_struct) = match v_def { - DefVariant(_, variant_id, is_struct) => (variant_id, is_struct), - _ => unreachable!() - }; - let child = self.add_child(name, enum_module.clone(), - OverwriteDuplicates, - DUMMY_SP); - - // If this variant is public, then it was publicly reexported, - // otherwise we need to inherit the visibility of the enum - // definition. - let variant_exported = vis == ast::Public || is_exported; - let modifiers = IMPORTABLE | if variant_exported { - PUBLIC - } else { - DefModifiers::empty() - }; - if is_struct { - child.define_type(v_def, DUMMY_SP, modifiers); - // Not adding fields for variants as they are not accessed with a self - // receiver - self.structs.insert(variant_id, Vec::new()); - } else { - child.define_value(v_def, DUMMY_SP, modifiers); - } - } - } DefTy(..) | DefAssociatedTy(..) => { debug!("(building reduced graph for external \ crate) building type {}", final_ident); @@ -3058,8 +3041,7 @@ impl<'a> Resolver<'a> { match import_resolution.value_target { Some(ref target) if !target.shadowable => { match *name_bindings.value_def.borrow() { - // We want to allow the "flat" def of enum variants to be shadowed - Some(ref value) if !value.modifiers.contains(ENUM_STAGING_HACK) => { + Some(ref value) => { let msg = format!("import `{}` conflicts with value \ in this module", token::get_name(name).get()); @@ -3082,8 +3064,7 @@ impl<'a> Resolver<'a> { match import_resolution.type_target { Some(ref target) if !target.shadowable => { match *name_bindings.type_def.borrow() { - // We want to allow the "flat" def of enum variants to be shadowed - Some(ref ty) if !ty.modifiers.contains(ENUM_STAGING_HACK) => { + Some(ref ty) => { match ty.module_def { None => { let msg = format!("import `{}` conflicts with type in \ @@ -5675,12 +5656,6 @@ impl<'a> Resolver<'a> { } fn find_fallback_in_self_type(&mut self, name: Name) -> FallbackSuggestion { - #[deriving(PartialEq)] - enum FallbackChecks { - Everything, - OnlyTraitAndStatics - } - fn extract_path_and_node_id(t: &Ty, allow: FallbackChecks) -> Option<(Path, NodeId, FallbackChecks)> { match t.node { diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 8ac52b891b99d..359f58a11004f 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -17,6 +17,9 @@ * way. Therefore we break lifetime name resolution into a separate pass. */ +pub use self::DefRegion::*; +use self::ScopeChain::*; + use driver::session::Session; use middle::subst; use std::fmt; diff --git a/src/librustc/middle/save/recorder.rs b/src/librustc/middle/save/recorder.rs index 9dd2e8d143770..b8d495bd49524 100644 --- a/src/librustc/middle/save/recorder.rs +++ b/src/librustc/middle/save/recorder.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Row::*; + use middle::save::escape; use middle::save::span_utils::SpanUtils; diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index a29f99236e0cd..520209257f5b8 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -10,6 +10,9 @@ // Type substitutions. +pub use self::ParamSpace::*; +pub use self::RegionSubsts::*; + use middle::ty; use middle::ty_fold; use middle::ty_fold::{TypeFoldable, TypeFolder}; diff --git a/src/librustc/middle/traits/mod.rs b/src/librustc/middle/traits/mod.rs index c4a5b14303e3f..1db8cf6baf3b6 100644 --- a/src/librustc/middle/traits/mod.rs +++ b/src/librustc/middle/traits/mod.rs @@ -12,6 +12,11 @@ * Trait Resolution. See doc.rs. */ +pub use self::SelectionError::*; +pub use self::FulfillmentErrorCode::*; +pub use self::Vtable::*; +pub use self::ObligationCauseCode::*; + use middle::mem_categorization::Typer; use middle::subst; use middle::ty; diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index b50956ec9dbaf..9ab2f948f9da2 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -11,6 +11,12 @@ /*! See `doc.rs` for high-level documentation */ #![allow(dead_code)] // FIXME -- just temporarily +pub use self::MethodMatchResult::*; +pub use self::MethodMatchedData::*; +use self::Candidate::*; +use self::BuiltinBoundConditions::*; +use self::EvaluationResult::*; + use super::{ErrorReported}; use super::{Obligation, ObligationCause}; use super::{SelectionError, Unimplemented, Overflow, diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 962cbd86c5b27..d7a2e7429f91e 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -186,6 +186,12 @@ * */ +pub use self::BranchKind::*; +pub use self::OptResult::*; +pub use self::TransBindingMode::*; +use self::Opt::*; +use self::FailureHandler::*; + use back::abi; use driver::config::FullDebugInfo; use llvm::{ValueRef, BasicBlockRef}; @@ -544,7 +550,7 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>( &SliceLengthGreaterOrEqual(before, after) => check_match::SliceWithSubslice(before, after), &Variant(_, _, def_id) => - check_match::Variant(def_id) + check_match::Constructor::Variant(def_id) }; let mcx = check_match::MatchCheckCtxt { tcx: bcx.tcx() }; diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 6cad5b5c2e081..d48868c288918 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -45,6 +45,9 @@ #![allow(unsigned_negation)] +pub use self::PointerField::*; +pub use self::Repr::*; + use std::num::Int; use std::rc::Rc; diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index b2ec36f03d9b0..b267d1d7f3e1e 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -25,6 +25,10 @@ #![allow(non_camel_case_types)] +pub use self::IsUnboxedClosureFlag::*; +pub use self::ValueOrigin::*; +pub use self::scalar_type::*; + use back::link::{mangle_exported_name}; use back::{link, abi}; use driver::config; diff --git a/src/librustc/middle/trans/cabi.rs b/src/librustc/middle/trans/cabi.rs index 940964ce9af5c..d69238ae92eab 100644 --- a/src/librustc/middle/trans/cabi.rs +++ b/src/librustc/middle/trans/cabi.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::ArgKind::*; + use llvm::Attribute; use std::option; use middle::trans::context::CrateContext; diff --git a/src/librustc/middle/trans/cabi_x86.rs b/src/librustc/middle/trans/cabi_x86.rs index 6f8651c3e44f0..f779ef3d311bb 100644 --- a/src/librustc/middle/trans/cabi_x86.rs +++ b/src/librustc/middle/trans/cabi_x86.rs @@ -8,12 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use self::Strategy::*; use llvm::*; use middle::trans::cabi::{ArgType, FnType}; use middle::trans::type_::Type; use super::common::*; use super::machine::*; +enum Strategy { RetValue(Type), RetPointer } pub fn compute_abi_info(ccx: &CrateContext, atys: &[Type], rty: Type, @@ -32,7 +34,6 @@ pub fn compute_abi_info(ccx: &CrateContext, // http://www.angelcode.com/dev/callconv/callconv.html // Clang's ABI handling is in lib/CodeGen/TargetInfo.cpp - enum Strategy { RetValue(Type), RetPointer } let t = &ccx.sess().target.target; let strategy = if t.options.is_like_osx || t.options.is_like_windows { match llsize_of_alloc(ccx, rty) { diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index d9819ee729456..1863c16baa011 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -12,6 +12,7 @@ // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp #![allow(non_upper_case_globals)] +use self::RegClass::*; use llvm; use llvm::{Integer, Pointer, Float, Double}; diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 2781a688ca542..956942068d9f3 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -16,6 +16,10 @@ * closure. */ +pub use self::AutorefArg::*; +pub use self::CalleeData::*; +pub use self::CallArgs::*; + use arena::TypedArena; use back::abi; use back::link; diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs index fbdefe6ab948a..1207c995998bc 100644 --- a/src/librustc/middle/trans/cleanup.rs +++ b/src/librustc/middle/trans/cleanup.rs @@ -13,6 +13,11 @@ * drop glue. See discussion in `doc.rs` for a high-level summary. */ +pub use self::ScopeId::*; +pub use self::CleanupScopeKind::*; +pub use self::EarlyExitLabel::*; +pub use self::Heap::*; + use llvm::{BasicBlockRef, ValueRef}; use middle::trans::base; use middle::trans::build; diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 7926f09523f78..e4bfdf74d8575 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -12,6 +12,8 @@ //! Code that is useful in various trans modules. +pub use self::ExprOrMethodCall::*; + use driver::session::Session; use llvm; use llvm::{ValueRef, BasicBlockRef, BuilderRef, ContextRef}; diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index 8ee258e77fa5d..4fba0e4051048 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -13,6 +13,9 @@ * Datums are and how they are intended to be used. */ +pub use self::Expr::*; +pub use self::RvalueMode::*; + use llvm::ValueRef; use middle::trans::base::*; use middle::trans::build::Load; diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 94096d23b3d1f..eaff757679aa0 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -183,6 +183,14 @@ the unique type ID as described above *can* be used as identifier. Since it is comparatively expensive to construct, though, `ty::type_id()` is still used additionally as an optimization for cases where the exact same type has been seen before (which is most of the time). */ +use self::FunctionDebugContextRepr::*; +use self::VariableAccess::*; +use self::VariableKind::*; +use self::MemberOffset::*; +use self::MemberDescriptionFactory::*; +use self::RecursiveTypeDescription::*; +use self::EnumDiscriminantInfo::*; +use self::DebugLocation::*; use driver::config; use driver::config::{FullDebugInfo, LimitedDebugInfo, NoDebugInfo}; diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 86a33a02a6798..4a2ea9c5f63ad 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -33,6 +33,10 @@ #![allow(non_camel_case_types)] +pub use self::cast_kind::*; +pub use self::Dest::*; +use self::lazy_binop_ty::*; + use back::abi; use llvm; use llvm::{ValueRef}; diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs index c871dbc8d29a9..1fff29255dae3 100644 --- a/src/librustc/middle/trans/type_of.rs +++ b/src/librustc/middle/trans/type_of.rs @@ -10,6 +10,8 @@ #![allow(non_camel_case_types)] +pub use self::named_ty::*; + use middle::subst; use middle::trans::adt; use middle::trans::common::*; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index f3cc33df0bc86..134dac9d3a7f6 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -10,6 +10,32 @@ #![allow(non_camel_case_types)] +pub use self::terr_vstore_kind::*; +pub use self::type_err::*; +pub use self::BuiltinBound::*; +pub use self::InferTy::*; +pub use self::InferRegion::*; +pub use self::ImplOrTraitItemId::*; +pub use self::UnboxedClosureKind::*; +pub use self::TraitStore::*; +pub use self::ast_ty_to_ty_cache_entry::*; +pub use self::Variance::*; +pub use self::AutoAdjustment::*; +pub use self::Representability::*; +pub use self::UnsizeKind::*; +pub use self::AutoRef::*; +pub use self::ExprKind::*; +pub use self::DtorKind::*; +pub use self::ExplicitSelfCategory::*; +pub use self::FnOutput::*; +pub use self::Region::*; +pub use self::ImplOrTraitItemContainer::*; +pub use self::BorrowKind::*; +pub use self::ImplOrTraitItem::*; +pub use self::BoundRegion::*; +pub use self::sty::*; +pub use self::IntVarValue::*; + use back::svh::Svh; use driver::session::Session; use lint; diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 17959e2507a85..3ef9a59d8adb4 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -48,7 +48,6 @@ * case but `&a` in the second. Basically, defaults that appear inside * an rptr (`&r.T`) use the region `r` that appears in the rptr. */ - use middle::const_eval; use middle::def; use middle::resolve_lifetime as rl; diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 750013a47e872..59b8309383ce0 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -79,6 +79,10 @@ obtained the type `Foo`, we would never match this method. */ +pub use self::CheckTraitsFlag::*; +pub use self::AutoderefReceiverFlag::*; +pub use self::MethodError::*; +pub use self::CandidateSource::*; use middle::subst; use middle::subst::{Subst, SelfSpace}; diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index d783286272ca0..17c9676a98b98 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -76,6 +76,11 @@ type parameter). */ +pub use self::LvaluePreference::*; +pub use self::DerefArgs::*; +use self::Expectation::*; +use self::IsBinopAssignment::*; +use self::TupleArgumentsFlag::*; use driver::session::Session; use middle::const_eval; diff --git a/src/librustc/middle/typeck/check/regionmanip.rs b/src/librustc/middle/typeck/check/regionmanip.rs index 64ae16f61d24b..b7710ab7bf9b9 100644 --- a/src/librustc/middle/typeck/check/regionmanip.rs +++ b/src/librustc/middle/typeck/check/regionmanip.rs @@ -10,6 +10,8 @@ // #![warn(deprecated_mode)] +pub use self::WfConstraint::*; + use middle::subst::{ParamSpace, Subst, Substs}; use middle::ty; use middle::ty_fold; diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index cf78ef1621986..9ded3265f828e 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -11,6 +11,7 @@ // Type resolution: the phase that finds all the types in the AST with // unresolved type variables and replaces "ty_var" types with their // substitutions. +use self::ResolveReason::*; use middle::def; use middle::pat_util; diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index eed574a1a1d7d..a5ca5179f08b0 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -29,7 +29,8 @@ bounds for each parameter. Type parameters themselves are represented as `ty_param()` instances. */ - +use self::ConvertMethodContext::*; +use self::CreateTypeParametersForAssociatedTypesFlag::*; use metadata::csearch; use middle::def; diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index e12019a15302c..77ee389c7600f 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -58,6 +58,7 @@ ported to this system, and which relies on string concatenation at the time of error detection. */ +use self::FreshOrKept::*; use std::collections::HashSet; use middle::def; diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 2f6f307494a2a..1a64af1270fdd 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -12,6 +12,11 @@ #![allow(non_camel_case_types)] +pub use self::TypeOrigin::*; +pub use self::ValuePairs::*; +pub use self::SubregionOrigin::*; +pub use self::RegionVariableOrigin::*; +pub use self::fixup_err::*; pub use middle::ty::IntVarValue; pub use self::resolve::resolve_and_force_all_but_regions; pub use self::resolve::{force_all, not_regions}; diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index d57343e004bab..c65a930195c7f 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -10,6 +10,13 @@ /*! See doc.rs */ +pub use self::Constraint::*; +pub use self::Verify::*; +pub use self::UndoLogEntry::*; +pub use self::CombineMapType::*; +pub use self::RegionResolutionError::*; +pub use self::VarValue::*; +use self::Classification::*; use middle::ty; use middle::ty::{BoundRegion, FreeRegion, Region, RegionVid}; diff --git a/src/librustc/middle/typeck/infer/type_variable.rs b/src/librustc/middle/typeck/infer/type_variable.rs index 1383f7aa4dc98..4bb2cc2ca5cf4 100644 --- a/src/librustc/middle/typeck/infer/type_variable.rs +++ b/src/librustc/middle/typeck/infer/type_variable.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::RelationDir::*; +use self::TypeVariableValue::*; +use self::UndoEntry::*; + use middle::ty; use std::mem; use util::snapshot_vec as sv; diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index d93e985190cff..eaf1d2805b01e 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::VarValue::*; + use std::kinds::marker; use middle::ty::{expected_found, IntVarValue}; diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index 2c8d1ce3f4fc4..8561594212f14 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -61,6 +61,10 @@ independently: #![allow(non_camel_case_types)] +pub use self::ExprAdjustment::*; +pub use self::vtable_origin::*; +pub use self::MethodOrigin::*; + use driver::config; use middle::def; diff --git a/src/librustc/middle/typeck/variance.rs b/src/librustc/middle/typeck/variance.rs index 97d7f9f18630a..76250d44baf6e 100644 --- a/src/librustc/middle/typeck/variance.rs +++ b/src/librustc/middle/typeck/variance.rs @@ -191,6 +191,8 @@ represents the "variance transform" as defined in the paper: `C` is `V3 = V1.xform(V2)`. */ +use self::VarianceTerm::*; +use self::ParamKind::*; use arena; use arena::Arena; diff --git a/src/librustc/util/snapshot_vec.rs b/src/librustc/util/snapshot_vec.rs index 6d99fc7156ca8..91e67bbacc30f 100644 --- a/src/librustc/util/snapshot_vec.rs +++ b/src/librustc/util/snapshot_vec.rs @@ -23,6 +23,7 @@ * make and also supplying a delegate capable of reversing those * changes. */ +use self::UndoLog::*; use std::kinds::marker; use std::mem; diff --git a/src/librustc_back/svh.rs b/src/librustc_back/svh.rs index 01a5767aeb256..c7a7888c1cd60 100644 --- a/src/librustc_back/svh.rs +++ b/src/librustc_back/svh.rs @@ -130,6 +130,9 @@ impl fmt::Show for Svh { // declaration should be irrelevant to the ABI. mod svh_visitor { + pub use self::SawExprComponent::*; + pub use self::SawStmtComponent::*; + use self::SawAbiComponent::*; use syntax::ast; use syntax::ast::*; use syntax::codemap::Span; diff --git a/src/librustc_llvm/diagnostic.rs b/src/librustc_llvm/diagnostic.rs index 6e1368ec3f90c..d705c82dd9a47 100644 --- a/src/librustc_llvm/diagnostic.rs +++ b/src/librustc_llvm/diagnostic.rs @@ -10,6 +10,9 @@ //! LLVM diagnostic reports. +pub use self::OptimizationDiagnosticKind::*; +pub use self::Diagnostic::*; + use libc::c_char; use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef}; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 48e1e590058bb..02235669c0958 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -27,6 +27,25 @@ extern crate libc; +pub use self::OtherAttribute::*; +pub use self::SpecialAttribute::*; +pub use self::AttributeSet::*; +pub use self::IntPredicate::*; +pub use self::RealPredicate::*; +pub use self::TypeKind::*; +pub use self::AtomicBinOp::*; +pub use self::AtomicOrdering::*; +pub use self::FileType::*; +pub use self::MetadataType::*; +pub use self::AsmDialect::*; +pub use self::CodeGenOptLevel::*; +pub use self::RelocMode::*; +pub use self::CodeGenModel::*; +pub use self::DiagnosticKind::*; +pub use self::CallConv::*; +pub use self::Visibility::*; +pub use self::DiagnosticSeverity::*; + use std::c_str::ToCStr; use std::cell::RefCell; use std::{raw, mem}; @@ -432,6 +451,7 @@ pub type DiagnosticHandler = unsafe extern "C" fn(DiagnosticInfoRef, *mut c_void pub type InlineAsmDiagHandler = unsafe extern "C" fn(SMDiagnosticRef, *const c_void, c_uint); pub mod debuginfo { + pub use self::DIDescriptorFlags::*; use super::{ValueRef}; pub enum DIBuilder_opaque {} diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 24cad1b6d0569..98eeada6f5d8e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -11,6 +11,22 @@ //! This module contains the "cleaned" pieces of the AST, and the functions //! that clean them. +pub use self::ImplMethod::*; +pub use self::Type::*; +pub use self::PrimitiveType::*; +pub use self::TypeKind::*; +pub use self::StructField::*; +pub use self::VariantKind::*; +pub use self::Mutability::*; +pub use self::ViewItemInner::*; +pub use self::ViewPath::*; +pub use self::ItemEnum::*; +pub use self::Attribute::*; +pub use self::TyParamBound::*; +pub use self::SelfTy::*; +pub use self::FunctionRetTy::*; +pub use self::TraitMethod::*; + use syntax; use syntax::ast; use syntax::ast_util; @@ -35,6 +51,8 @@ use rustc::middle::stability; use std::rc::Rc; use std::u32; +use std::str::Str as StrTrait; // Conflicts with Str variant +use std::char::Char as CharTrait; // Conflicts with Char variant use core::DocContext; use doctree; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index c5c9aae89e476..0a748f7e7982f 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::MaybeTyped::*; use rustc::driver::{config, driver, session}; use rustc::middle::{privacy, ty}; diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 7509f96f91675..b78ce21eb06e3 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -10,6 +10,8 @@ //! This module is used to store stuff from Rust's AST in a more convenient //! manner (and with prettier names) before cleaning. +pub use self::StructType::*; +pub use self::TypeBound::*; use syntax; use syntax::codemap::Span; diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 0b35f8ddc6963..901761ba806ff 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -9,6 +9,7 @@ // except according to those terms. //! Item types. +pub use self::ItemType::*; use std::fmt; use clean; diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 264b20ddac121..1dd651481693f 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -32,6 +32,7 @@ //! for creating the corresponding search index and source file renderings. //! These tasks are not parallelized (they haven't been a bottleneck yet), and //! both occur before the crate is rendered. +pub use self::ExternalLocation::*; use std::collections::{HashMap, HashSet}; use std::collections::hash_map::{Occupied, Vacant}; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 1cafc38f826c9..8f0f19fe16d0c 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -249,7 +249,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { self.visit_item(&**i, None, om); } } - _ => { panic!("glob not mapped to a module"); } + ast::ItemEnum(..) => {} + _ => { panic!("glob not mapped to a module or enum"); } } } else { self.visit_item(it, renamed, om); diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs index 2932a3dd4a824..e4565be284f53 100644 --- a/src/librustrt/libunwind.rs +++ b/src/librustrt/libunwind.rs @@ -15,6 +15,12 @@ #![allow(non_snake_case)] #![allow(dead_code)] // these are just bindings +#[cfg(any(not(target_arch = "arm"), target_os = "ios"))] +pub use self::_Unwind_Action::*; +#[cfg(target_arch = "arm")] +pub use self::_Unwind_State::*; +pub use self::_Unwind_Reason_Code::*; + use libc; #[cfg(any(not(target_arch = "arm"), target_os = "ios"))] diff --git a/src/librustrt/local_data.rs b/src/librustrt/local_data.rs index 4a16bcf939e7b..ca0f694676f29 100644 --- a/src/librustrt/local_data.rs +++ b/src/librustrt/local_data.rs @@ -38,6 +38,8 @@ assert_eq!(*key_vector.get().unwrap(), vec![4]); // Casting 'Arcane Sight' reveals an overwhelming aura of Transmutation // magic. +pub use self::KeyValue::*; + use core::prelude::*; use alloc::heap; diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index 554e4784eac51..2c8fca2d5e6d9 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -12,6 +12,9 @@ //! to be available 'everywhere'. Unwinding, local storage, and logging. //! Even a 'freestanding' Rust would likely want to implement this. +pub use self::BlockedTask::*; +use self::TaskState::*; + use alloc::arc::Arc; use alloc::boxed::{BoxAny, Box}; use core::any::Any; diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs index 356273964aff9..7544b93ce522a 100644 --- a/src/librustrt/unwind.rs +++ b/src/librustrt/unwind.rs @@ -398,6 +398,7 @@ pub mod eabi { #[doc(hidden)] #[allow(non_camel_case_types, non_snake_case)] pub mod eabi { + pub use self::EXCEPTION_DISPOSITION::*; use libunwind as uw; use libc::{c_void, c_int}; diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index f287fb99750aa..9b1e285431f6a 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -11,6 +11,10 @@ // ignore-lexer-test FIXME #15679 //! Base64 binary-to-text encoding + +pub use self::FromBase64Error::*; +pub use self::CharacterSet::*; + use std::fmt; use std::string; use std::error; diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index e045f94c08e67..bd49da7667a9b 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -11,6 +11,9 @@ // ignore-lexer-test FIXME #15679 //! Hex binary-to-text encoding + +pub use self::FromHexError::*; + use std::fmt; use std::string; use std::error; diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 79778a85fddde..80238f6df415d 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -194,6 +194,15 @@ fn main() { */ +pub use self::JsonEvent::*; +pub use self::StackElement::*; +pub use self::Json::*; +pub use self::ErrorCode::*; +pub use self::ParserError::*; +pub use self::DecoderError::*; +use self::ParserState::*; +use self::InternalStackElement::*; + use std; use std::collections::{HashMap, TreeMap}; use std::{char, f64, fmt, io, num, str}; @@ -2408,6 +2417,8 @@ impl FromStr for Json { #[cfg(test)] mod tests { extern crate test; + use self::Animal::*; + use self::DecodeEnum::*; use self::test::Bencher; use {Encodable, Decodable}; use super::{List, Encoder, Decoder, Error, Boolean, I64, U64, F64, String, Null, diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index e433868901672..b2a035f4ee5c6 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -24,7 +24,7 @@ Core encoding and decoding interfaces. html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] -#![feature(macro_rules, default_type_params, phase, slicing_syntax)] +#![feature(macro_rules, default_type_params, phase, slicing_syntax, globs)] // test harness access #[cfg(test)] diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 779cd425d2a6e..0471d5e902c21 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -10,6 +10,10 @@ // // ignore-lexer-test FIXME #15883 +pub use self::Entry::*; +use self::SearchResult::*; +use self::VacantEntryState::*; + use clone::Clone; use cmp::{max, Eq, Equiv, PartialEq}; use default::Default; diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 05faba4950b29..76e15f7375c01 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -10,6 +10,8 @@ // // ignore-lexer-test FIXME #15883 +pub use self::BucketState::*; + use clone::Clone; use cmp; use hash::{Hash, Hasher}; diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index e3dfa8cabee3f..8bb82d5bc1e82 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -210,6 +210,7 @@ mod test { target_os = "freebsd", target_os = "dragonfly"))] pub mod dl { + pub use self::Rtld::*; use c_str::{CString, ToCStr}; use libc; diff --git a/src/libstd/error.rs b/src/libstd/error.rs index b048ab13968de..82ad893f88a1a 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -59,13 +59,13 @@ //! //! impl FromError for MyError { //! fn from_error(err: IoError) -> MyError { -//! Io(err) +//! MyError::Io(err) //! } //! } //! //! impl FromError for MyError { //! fn from_error(err: MapError) -> MyError { -//! Map(err) +//! MyError::Map(err) //! } //! } //! diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 66c29db045592..33db3c3766650 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -221,6 +221,12 @@ responding to errors that may occur while attempting to read the numbers. #![experimental] #![deny(unused_must_use)] +pub use self::SeekStyle::*; +pub use self::FileMode::*; +pub use self::FileAccess::*; +pub use self::FileType::*; +pub use self::IoErrorKind::*; + use char::Char; use clone::Clone; use default::Default; @@ -1899,6 +1905,7 @@ impl fmt::Show for FilePermission { #[cfg(test)] mod tests { + use self::BadReaderBehavior::*; use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput}; use prelude::*; use uint; diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 22775d54eff1b..13f602de03a2c 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -19,6 +19,10 @@ getaddrinfo() #![allow(missing_docs)] +pub use self::SocketType::*; +pub use self::Flag::*; +pub use self::Protocol::*; + use iter::Iterator; use io::{IoResult}; use io::net::ip::{SocketAddr, IpAddr}; diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 7ba5e173182e1..d87768a086098 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -15,6 +15,8 @@ #![allow(missing_docs)] +pub use self::IpAddr::*; + use fmt; use io::{mod, IoResult, IoError}; use io::net; diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 5b5bb61815165..16e568f30f2ca 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -13,6 +13,9 @@ #![allow(experimental)] #![allow(non_upper_case_globals)] +pub use self::StdioContainer::*; +pub use self::ProcessExit::*; + use prelude::*; use fmt; diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 00d62f389cae6..362e80f9f12c3 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -27,6 +27,8 @@ out.write(b"Hello, world!"); */ +use self::StdSource::*; + use failure::local_stderr; use fmt; use io::{Reader, Writer, IoResult, IoError, OtherIoError, diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index d1a89d72621a7..f8ba9b720118a 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -12,6 +12,10 @@ #![allow(missing_docs)] +pub use self::ExponentFormat::*; +pub use self::SignificantDigits::*; +pub use self::SignFormat::*; + use char; use num; use num::{Int, Float, FPNaN, FPInfinite, ToPrimitive}; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index d1df2ed9967d6..f5aa2259f8d9c 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -31,6 +31,10 @@ #![allow(missing_docs)] #![allow(non_snake_case)] +pub use self::MemoryMapKind::*; +pub use self::MapOption::*; +pub use self::MapError::*; + use clone::Clone; use error::{FromError, Error}; use fmt; diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index a053f57bf1275..f31ffdab17b61 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -12,6 +12,8 @@ //! Windows file path handling +pub use self::PathPrefix::*; + use ascii::AsciiCast; use c_str::{CString, ToCStr}; use clone::Clone; diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index a9e99940c4689..65f45c3f97e14 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -62,17 +62,20 @@ #[doc(no_inline)] pub use char::{Char, UnicodeChar}; #[doc(no_inline)] pub use clone::Clone; #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; -#[doc(no_inline)] pub use cmp::{Ordering, Less, Equal, Greater, Equiv}; +#[doc(no_inline)] pub use cmp::{Ordering, Equiv}; +#[doc(no_inline)] pub use cmp::Ordering::{Less, Equal, Greater}; #[doc(no_inline)] pub use iter::{FromIterator, Extend, ExactSize}; #[doc(no_inline)] pub use iter::{Iterator, DoubleEndedIterator}; #[doc(no_inline)] pub use iter::{RandomAccessIterator, CloneableIterator}; #[doc(no_inline)] pub use iter::{OrdIterator, MutableDoubleEndedIterator}; #[doc(no_inline)] pub use num::{ToPrimitive, FromPrimitive}; #[doc(no_inline)] pub use boxed::Box; -#[doc(no_inline)] pub use option::{Option, Some, None}; +#[doc(no_inline)] pub use option::Option; +#[doc(no_inline)] pub use option::Option::{Some, None}; #[doc(no_inline)] pub use path::{GenericPath, Path, PosixPath, WindowsPath}; #[doc(no_inline)] pub use ptr::{RawPtr, RawMutPtr}; -#[doc(no_inline)] pub use result::{Result, Ok, Err}; +#[doc(no_inline)] pub use result::Result; +#[doc(no_inline)] pub use result::Result::{Ok, Err}; #[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek, BufferPrelude}; #[doc(no_inline)] pub use str::{Str, StrVector, StrPrelude}; #[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrPrelude}; diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 83ea57e553895..92cfc859cd0f2 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -17,6 +17,8 @@ pub use self::imp::OsRng; mod imp { extern crate libc; + use self::OsRngInner::*; + use io::{IoResult, File}; use path::Path; use rand::Rng; diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index 59a10f79d93c3..0f888bd222c27 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -541,6 +541,8 @@ mod imp { #[allow(non_snake_case)] #[allow(dead_code)] mod uw { + pub use self::_Unwind_Reason_Code::*; + use libc; #[repr(C)] @@ -622,7 +624,8 @@ mod imp { let mut val: _Unwind_Word = 0; let ptr = &mut val as *mut _Unwind_Word; - let _ = _Unwind_VRS_Get(ctx, _UVRSC_CORE, 15, _UVRSD_UINT32, + let _ = _Unwind_VRS_Get(ctx, _Unwind_VRS_RegClass::_UVRSC_CORE, 15, + _Unwind_VRS_DataRepresentation::_UVRSD_UINT32, ptr as *mut libc::c_void); (val & !1) as libc::uintptr_t } @@ -813,11 +816,11 @@ mod imp { pub fn init_frame(frame: &mut super::STACKFRAME64, ctx: &CONTEXT) -> libc::DWORD { frame.AddrPC.Offset = ctx.Eip as u64; - frame.AddrPC.Mode = super::AddrModeFlat; + frame.AddrPC.Mode = super::ADDRESS_MODE::AddrModeFlat; frame.AddrStack.Offset = ctx.Esp as u64; - frame.AddrStack.Mode = super::AddrModeFlat; + frame.AddrStack.Mode = super::ADDRESS_MODE::AddrModeFlat; frame.AddrFrame.Offset = ctx.Ebp as u64; - frame.AddrFrame.Mode = super::AddrModeFlat; + frame.AddrFrame.Mode = super::ADDRESS_MODE::AddrModeFlat; super::IMAGE_FILE_MACHINE_I386 } } @@ -903,11 +906,11 @@ mod imp { pub fn init_frame(frame: &mut super::STACKFRAME64, ctx: &CONTEXT) -> DWORD { frame.AddrPC.Offset = ctx.Rip as u64; - frame.AddrPC.Mode = super::AddrModeFlat; + frame.AddrPC.Mode = super::ADDRESS_MODE::AddrModeFlat; frame.AddrStack.Offset = ctx.Rsp as u64; - frame.AddrStack.Mode = super::AddrModeFlat; + frame.AddrStack.Mode = super::ADDRESS_MODE::AddrModeFlat; frame.AddrFrame.Offset = ctx.Rbp as u64; - frame.AddrFrame.Mode = super::AddrModeFlat; + frame.AddrFrame.Mode = super::ADDRESS_MODE::AddrModeFlat; super::IMAGE_FILE_MACHINE_AMD64 } } diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index be0af3a3f1ae3..e37d1f8387796 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -29,6 +29,7 @@ use core::prelude::*; use core::mem::replace; +use self::FutureState::*; use comm::{Receiver, channel}; use task::spawn; diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index fc3a8230c4c78..9b2b594a9c7cd 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -8,6 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::SocketStatus::*; +pub use self::InAddr::*; + use alloc::arc::Arc; use libc::{mod, c_char, c_int}; use mem; diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index d7de841f95836..81bc138ca9195 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +use self::Req::*; use libc::{mod, pid_t, c_void, c_int}; use c_str::CString; diff --git a/src/libstd/sys/unix/timer.rs b/src/libstd/sys/unix/timer.rs index 184ef3adce1b6..6ebbedb8e9036 100644 --- a/src/libstd/sys/unix/timer.rs +++ b/src/libstd/sys/unix/timer.rs @@ -46,6 +46,8 @@ //! //! Note that all time units in this file are in *milliseconds*. +pub use self::Req::*; + use libc; use mem; use os; diff --git a/src/libstd/sys/windows/timer.rs b/src/libstd/sys/windows/timer.rs index f507be2a985df..9af3a7c8b6e01 100644 --- a/src/libstd/sys/windows/timer.rs +++ b/src/libstd/sys/windows/timer.rs @@ -20,6 +20,8 @@ //! Other than that, the implementation is pretty straightforward in terms of //! the other two implementations of timers with nothing *that* new showing up. +pub use self::Req::*; + use libc; use ptr; use comm; diff --git a/src/libsync/comm/mod.rs b/src/libsync/comm/mod.rs index 65b3e30c2b919..2a9a19a7fa68a 100644 --- a/src/libsync/comm/mod.rs +++ b/src/libsync/comm/mod.rs @@ -323,6 +323,10 @@ use core::prelude::*; +pub use self::TryRecvError::*; +pub use self::TrySendError::*; +use self::Flavor::*; + use alloc::arc::Arc; use alloc::boxed::Box; use core::cell::Cell; diff --git a/src/libsync/comm/oneshot.rs b/src/libsync/comm/oneshot.rs index 447585fb2e087..5d3c59e8a79b4 100644 --- a/src/libsync/comm/oneshot.rs +++ b/src/libsync/comm/oneshot.rs @@ -32,6 +32,11 @@ /// The one caveat to consider is that when a port sees a disconnected channel /// it must check for data because there is no "data plus upgrade" state. +pub use self::Failure::*; +pub use self::UpgradeResult::*; +pub use self::SelectionResult::*; +use self::MyUpgrade::*; + use core::prelude::*; use alloc::boxed::Box; diff --git a/src/libsync/comm/shared.rs b/src/libsync/comm/shared.rs index a82efe76289bf..5ca89ea366675 100644 --- a/src/libsync/comm/shared.rs +++ b/src/libsync/comm/shared.rs @@ -18,6 +18,8 @@ /// module. You'll also note that the implementation of the shared and stream /// channels are quite similar, and this is no coincidence! +pub use self::Failure::*; + use core::prelude::*; use alloc::boxed::Box; diff --git a/src/libsync/comm/stream.rs b/src/libsync/comm/stream.rs index 8e433c6a585f3..67878e3ba5adb 100644 --- a/src/libsync/comm/stream.rs +++ b/src/libsync/comm/stream.rs @@ -17,6 +17,11 @@ /// High level implementation details can be found in the comment of the parent /// module. +pub use self::Failure::*; +pub use self::UpgradeResult::*; +pub use self::SelectionResult::*; +use self::Message::*; + use core::prelude::*; use alloc::boxed::Box; diff --git a/src/libsync/comm/sync.rs b/src/libsync/comm/sync.rs index 42de6f66289a2..27b943624d787 100644 --- a/src/libsync/comm/sync.rs +++ b/src/libsync/comm/sync.rs @@ -35,6 +35,9 @@ use core::prelude::*; +pub use self::Failure::*; +use self::Blocker::*; + use alloc::boxed::Box; use collections::Vec; use core::mem; diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs index ae55642672d26..2f5c455556c8f 100644 --- a/src/libsync/deque.rs +++ b/src/libsync/deque.rs @@ -50,6 +50,8 @@ // FIXME: all atomic operations in this module use a SeqCst ordering. That is // probably overkill +pub use self::Stolen::*; + use core::prelude::*; use alloc::arc::Arc; diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs index 0ef3e77da00b4..d6378c2190ece 100644 --- a/src/libsync/lock.rs +++ b/src/libsync/lock.rs @@ -21,6 +21,8 @@ use core::prelude::*; +use self::Inner::*; + use core::cell::UnsafeCell; use rustrt::local::Local; use rustrt::task::Task; diff --git a/src/libsync/mpsc_queue.rs b/src/libsync/mpsc_queue.rs index 69dc2fe8e607e..63379ad1d9d0c 100644 --- a/src/libsync/mpsc_queue.rs +++ b/src/libsync/mpsc_queue.rs @@ -40,6 +40,8 @@ // http://www.1024cores.net/home/lock-free-algorithms // /queues/non-intrusive-mpsc-node-based-queue +pub use self::PopResult::*; + use core::prelude::*; use alloc::boxed::Box; diff --git a/src/libsync/mutex.rs b/src/libsync/mutex.rs index 7d191eab2d157..e05f3e1910bfe 100644 --- a/src/libsync/mutex.rs +++ b/src/libsync/mutex.rs @@ -58,6 +58,7 @@ // it's locked or not. use core::prelude::*; +use self::Flavor::*; use alloc::boxed::Box; use core::atomic; diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs index facf204983b42..8ab21fe380f6c 100644 --- a/src/libsync/raw.rs +++ b/src/libsync/raw.rs @@ -16,6 +16,7 @@ //! containing data. use core::prelude::*; +use self::ReacquireOrderLock::*; use core::atomic; use core::finally::Finally; @@ -619,6 +620,8 @@ impl<'a> Drop for RWLockReadGuard<'a> { #[cfg(test)] mod tests { + pub use self::RWLockMode::*; + use std::prelude::*; use Arc; diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 912755d0ea0c9..87693f39bbdb1 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -8,6 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Os::*; +pub use self::Abi::*; +pub use self::Architecture::*; +pub use self::AbiArchitecture::*; + use std::fmt; #[deriving(PartialEq)] diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 593d5811553bc..0cb80d4c15397 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -10,6 +10,55 @@ // The Rust abstract syntax tree. +pub use self::AsmDialect::*; +pub use self::AttrStyle::*; +pub use self::BindingMode::*; +pub use self::BinOp::*; +pub use self::BlockCheckMode::*; +pub use self::CaptureClause::*; +pub use self::Decl_::*; +pub use self::ExplicitSelf_::*; +pub use self::Expr_::*; +pub use self::FloatTy::*; +pub use self::FnStyle::*; +pub use self::FunctionRetTy::*; +pub use self::ForeignItem_::*; +pub use self::ImplItem::*; +pub use self::InlinedItem::*; +pub use self::IntTy::*; +pub use self::Item_::*; +pub use self::KleeneOp::*; +pub use self::Lit_::*; +pub use self::LitIntType::*; +pub use self::LocalSource::*; +pub use self::Mac_::*; +pub use self::MatchSource::*; +pub use self::MetaItem_::*; +pub use self::Method_::*; +pub use self::Mutability::*; +pub use self::Onceness::*; +pub use self::Pat_::*; +pub use self::PathListItem_::*; +pub use self::PatWildKind::*; +pub use self::PrimTy::*; +pub use self::Sign::*; +pub use self::Stmt_::*; +pub use self::StrStyle::*; +pub use self::StructFieldKind::*; +pub use self::TokenTree::*; +pub use self::TraitItem::*; +pub use self::Ty_::*; +pub use self::TyParamBound::*; +pub use self::UintTy::*; +pub use self::UnboxedClosureKind::*; +pub use self::UnOp::*; +pub use self::UnsafeSource::*; +pub use self::VariantKind::*; +pub use self::ViewItem_::*; +pub use self::ViewPath_::*; +pub use self::Visibility::*; +pub use self::PathParameters::*; + use codemap::{Span, Spanned, DUMMY_SP, ExpnId}; use abi::Abi; use ast_util; diff --git a/src/libsyntax/ast_map/blocks.rs b/src/libsyntax/ast_map/blocks.rs index 187d94d1fa780..a35ee3ab1d0d5 100644 --- a/src/libsyntax/ast_map/blocks.rs +++ b/src/libsyntax/ast_map/blocks.rs @@ -21,6 +21,8 @@ //! nested within a uniquely determined `FnLike`), and users can ask //! for the `Code` associated with a particular NodeId. +pub use self::Code::*; + use abi; use ast::{Block, FnDecl, NodeId}; use ast; diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs index d65be4c45e8f3..2a2ad9fd66408 100644 --- a/src/libsyntax/ast_map/mod.rs +++ b/src/libsyntax/ast_map/mod.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Node::*; +pub use self::PathElem::*; +use self::MapEntry::*; + use abi; use ast::*; use ast_util; diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 148d986399d3e..12a3bd8990194 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -10,6 +10,11 @@ // Functions dealing with attributes and meta items +pub use self::InlineAttr::*; +pub use self::StabilityLevel::*; +pub use self::ReprAttr::*; +pub use self::IntType::*; + use ast; use ast::{AttrId, Attribute, Attribute_, MetaItem, MetaWord, MetaNameValue, MetaList}; use codemap::{Span, Spanned, spanned, dummy_spanned}; diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 7d303644020a4..7d849ddf1c1ad 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -23,6 +23,8 @@ source code snippets, etc. */ +pub use self::MacroFormat::*; + use serialize::{Encodable, Decodable, Encoder, Decoder}; use std::cell::RefCell; use std::rc::Rc; diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index e24aa0f0b9587..ff600fcc7c24d 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -8,6 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Level::*; +pub use self::RenderSpan::*; +pub use self::ColorConfig::*; +use self::Destination::*; + use codemap::{Pos, Span}; use codemap; use diagnostics; diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index d57d6e52d7fd4..8027d9bfd8a8e 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -11,6 +11,7 @@ /* * Inline assembly support. */ +use self::State::*; use ast; use codemap; diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 0c7a3cf4a6ce3..9292825ffe828 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::SyntaxExtension::*; + use ast; use ast::Name; use codemap; diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs index e653c8aebf447..fccc67bf22093 100644 --- a/src/libsyntax/ext/deriving/clone.rs +++ b/src/libsyntax/ext/deriving/clone.rs @@ -52,7 +52,7 @@ fn cs_clone( name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P { - let ctor_ident; + let ctor_path; let all_fields; let fn_path = vec![ cx.ident_of("std"), @@ -68,11 +68,11 @@ fn cs_clone( match *substr.fields { Struct(ref af) => { - ctor_ident = substr.type_ident; + ctor_path = cx.path(trait_span, vec![substr.type_ident]); all_fields = af; } EnumMatching(_, variant, ref af) => { - ctor_ident = variant.node.name; + ctor_path = cx.path(trait_span, vec![substr.type_ident, variant.node.name]); all_fields = af; }, EnumNonMatchingCollapsed (..) => { @@ -91,7 +91,8 @@ fn cs_clone( if all_fields.len() >= 1 && all_fields[0].name.is_none() { // enum-like let subcalls = all_fields.iter().map(subcall).collect(); - cx.expr_call_ident(trait_span, ctor_ident, subcalls) + let path = cx.expr_path(ctor_path); + cx.expr_call(trait_span, path, subcalls) } else { // struct-like let fields = all_fields.iter().map(|field| { @@ -109,9 +110,9 @@ fn cs_clone( if fields.is_empty() { // no fields, so construct like `None` - cx.expr_ident(trait_span, ctor_ident) + cx.expr_path(ctor_path) } else { - cx.expr_struct_ident(trait_span, ctor_ident, fields) + cx.expr_struct(trait_span, ctor_path, fields) } } } diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index cd44dde7004d8..98345e1dd6724 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::OrderingOp::*; + use ast; use ast::{MetaItem, Item, Expr}; use codemap::Span; diff --git a/src/libsyntax/ext/deriving/decodable.rs b/src/libsyntax/ext/deriving/decodable.rs index 9e4dbf930dbae..d0a0365838604 100644 --- a/src/libsyntax/ext/deriving/decodable.rs +++ b/src/libsyntax/ext/deriving/decodable.rs @@ -13,7 +13,8 @@ The compiler code necessary for `#[deriving(Decodable)]`. See encodable.rs for more. */ -use ast::{MetaItem, Item, Expr, MutMutable, Ident}; +use ast; +use ast::{MetaItem, Item, Expr, MutMutable}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; @@ -82,9 +83,10 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span, }; let read_struct_field = cx.ident_of("read_struct_field"); + let path = cx.path_ident(trait_span, substr.type_ident); let result = decode_static_fields(cx, trait_span, - substr.type_ident, + path, summary, |cx, span, name, field| { cx.expr_try(span, @@ -113,9 +115,10 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span, for (i, &(name, v_span, ref parts)) in fields.iter().enumerate() { variants.push(cx.expr_str(v_span, token::get_ident(name))); + let path = cx.path(trait_span, vec![substr.type_ident, name]); let decoded = decode_static_fields(cx, v_span, - name, + path, parts, |cx, span, _, field| { let idx = cx.expr_uint(span, field); @@ -153,18 +156,19 @@ fn decodable_substructure(cx: &mut ExtCtxt, trait_span: Span, } /// Create a decoder for a single enum variant/struct: -/// - `outer_pat_ident` is the name of this enum variant/struct +/// - `outer_pat_path` is the path to this enum variant/struct /// - `getarg` should retrieve the `uint`-th field with name `@str`. fn decode_static_fields(cx: &mut ExtCtxt, trait_span: Span, - outer_pat_ident: Ident, + outer_pat_path: ast::Path, fields: &StaticFields, getarg: |&mut ExtCtxt, Span, InternedString, uint| -> P) -> P { match *fields { Unnamed(ref fields) => { + let path_expr = cx.expr_path(outer_pat_path); if fields.is_empty() { - cx.expr_ident(trait_span, outer_pat_ident) + path_expr } else { let fields = fields.iter().enumerate().map(|(i, &span)| { getarg(cx, span, @@ -173,7 +177,7 @@ fn decode_static_fields(cx: &mut ExtCtxt, i) }).collect(); - cx.expr_call_ident(trait_span, outer_pat_ident, fields) + cx.expr_call(trait_span, path_expr, fields) } } Named(ref fields) => { @@ -182,7 +186,7 @@ fn decode_static_fields(cx: &mut ExtCtxt, let arg = getarg(cx, span, token::get_ident(name), i); cx.field_imm(span, name, arg) }).collect(); - cx.expr_struct_ident(trait_span, outer_pat_ident, fields) + cx.expr_struct(trait_span, outer_pat_path, fields) } } } diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 4be299994fd21..dccc12e406bdc 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -180,6 +180,10 @@ //! Named(~[(, )]))]) //! ``` +pub use self::StaticFields::*; +pub use self::SubstructureFields::*; +use self::StructType::*; + use std::cell::RefCell; use std::vec; @@ -192,7 +196,7 @@ use attr; use attr::AttrMetaMethods; use ext::base::ExtCtxt; use ext::build::AstBuilder; -use codemap; +use codemap::{mod, DUMMY_SP}; use codemap::Span; use fold::MoveMap; use owned_slice::OwnedSlice; @@ -543,12 +547,12 @@ impl<'a> TraitDef<'a> { } } -fn variant_to_pat(cx: &mut ExtCtxt, sp: Span, variant: &ast::Variant) +fn variant_to_pat(cx: &mut ExtCtxt, sp: Span, enum_ident: ast::Ident, variant: &ast::Variant) -> P { - let ident = cx.path_ident(sp, variant.node.name); + let path = cx.path(sp, vec![enum_ident, variant.node.name]); cx.pat(sp, match variant.node.kind { - ast::TupleVariantKind(..) => ast::PatEnum(ident, None), - ast::StructVariantKind(..) => ast::PatStruct(ident, Vec::new(), true), + ast::TupleVariantKind(..) => ast::PatEnum(path, None), + ast::StructVariantKind(..) => ast::PatStruct(path, Vec::new(), true), }) } @@ -714,9 +718,10 @@ impl<'a> MethodDef<'a> { // [fields of next Self arg], [etc]] let mut patterns = Vec::new(); for i in range(0u, self_args.len()) { + let struct_path= cx.path(DUMMY_SP, vec!( type_ident )); let (pat, ident_expr) = trait_.create_struct_pattern(cx, - type_ident, + struct_path, struct_def, format!("__self_{}", i).as_slice(), @@ -900,7 +905,8 @@ impl<'a> MethodDef<'a> { let mut match_arms: Vec = variants.iter().enumerate() .map(|(index, variant)| { let mk_self_pat = |cx: &mut ExtCtxt, self_arg_name: &str| { - let (p, idents) = trait_.create_enum_variant_pattern(cx, &**variant, + let (p, idents) = trait_.create_enum_variant_pattern(cx, type_ident, + &**variant, self_arg_name, ast::MutImmutable); (cx.pat(sp, ast::PatRegion(p)), idents) @@ -996,7 +1002,7 @@ impl<'a> MethodDef<'a> { if variants.len() > 1 && self_args.len() > 1 { let arms: Vec = variants.iter().enumerate() .map(|(index, variant)| { - let pat = variant_to_pat(cx, sp, &**variant); + let pat = variant_to_pat(cx, sp, type_ident, &**variant); let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyU)); cx.arm(sp, vec![pat], cx.expr_lit(sp, lit)) }).collect(); @@ -1199,20 +1205,15 @@ impl<'a> TraitDef<'a> { fn create_struct_pattern(&self, cx: &mut ExtCtxt, - struct_ident: Ident, + struct_path: ast::Path, struct_def: &StructDef, prefix: &str, mutbl: ast::Mutability) -> (P, Vec<(Span, Option, P)>) { if struct_def.fields.is_empty() { - return ( - cx.pat_ident_binding_mode( - self.span, struct_ident, ast::BindByValue(ast::MutImmutable)), - Vec::new()); + return (cx.pat_enum(self.span, struct_path, vec![]), vec![]); } - let matching_path = cx.path(self.span, vec!( struct_ident )); - let mut paths = Vec::new(); let mut ident_expr = Vec::new(); let mut struct_type = Unknown; @@ -1253,9 +1254,9 @@ impl<'a> TraitDef<'a> { node: ast::FieldPat { ident: id.unwrap(), pat: pat, is_shorthand: false }, } }).collect(); - cx.pat_struct(self.span, matching_path, field_pats) + cx.pat_struct(self.span, struct_path, field_pats) } else { - cx.pat_enum(self.span, matching_path, subpats) + cx.pat_enum(self.span, struct_path, subpats) }; (pattern, ident_expr) @@ -1263,21 +1264,19 @@ impl<'a> TraitDef<'a> { fn create_enum_variant_pattern(&self, cx: &mut ExtCtxt, + enum_ident: ast::Ident, variant: &ast::Variant, prefix: &str, mutbl: ast::Mutability) -> (P, Vec<(Span, Option, P)>) { let variant_ident = variant.node.name; + let variant_path = cx.path(variant.span, vec![enum_ident, variant_ident]); match variant.node.kind { ast::TupleVariantKind(ref variant_args) => { if variant_args.is_empty() { - return (cx.pat_ident_binding_mode(variant.span, variant_ident, - ast::BindByValue(ast::MutImmutable)), - Vec::new()); + return (cx.pat_enum(variant.span, variant_path, vec![]), vec![]); } - let matching_path = cx.path_ident(variant.span, variant_ident); - let mut paths = Vec::new(); let mut ident_expr = Vec::new(); for (i, va) in variant_args.iter().enumerate() { @@ -1292,11 +1291,11 @@ impl<'a> TraitDef<'a> { let subpats = self.create_subpatterns(cx, paths, mutbl); - (cx.pat_enum(variant.span, matching_path, subpats), + (cx.pat_enum(variant.span, variant_path, subpats), ident_expr) } ast::StructVariantKind(ref struct_def) => { - self.create_struct_pattern(cx, variant_ident, &**struct_def, + self.create_struct_pattern(cx, variant_path, &**struct_def, prefix, mutbl) } } diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs index 8b46769d633f3..700ada8b4ad8f 100644 --- a/src/libsyntax/ext/deriving/generic/ty.rs +++ b/src/libsyntax/ext/deriving/generic/ty.rs @@ -13,6 +13,9 @@ A mini version of ast::Ty, which is easier to use, and features an explicit `Self` type to use when specifying impls to be derived. */ +pub use self::PtrTy::*; +pub use self::Ty::*; + use ast; use ast::{Expr,Generics,Ident}; use ext::base::ExtCtxt; diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs index 044a2812c0003..cd2d98b70f105 100644 --- a/src/libsyntax/ext/deriving/primitive.rs +++ b/src/libsyntax/ext/deriving/primitive.rs @@ -102,7 +102,8 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure let span = variant.span; // expr for `$n == $variant as $name` - let variant = cx.expr_ident(span, variant.node.name); + let path = cx.path(span, vec![substr.type_ident, variant.node.name]); + let variant = cx.expr_path(path); let ty = cx.ty_ident(span, cx.ident_of(name)); let cast = cx.expr_cast(span, variant.clone(), ty); let guard = cx.expr_binary(span, ast::BiEq, n.clone(), cast); diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs index 584645bb30639..8ad8436906b3c 100644 --- a/src/libsyntax/ext/deriving/rand.rs +++ b/src/libsyntax/ext/deriving/rand.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use ast::{MetaItem, Item, Expr, Ident}; +use ast::{MetaItem, Item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::{AstBuilder}; @@ -72,7 +72,8 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) return match *substr.fields { StaticStruct(_, ref summary) => { - rand_thing(cx, trait_span, substr.type_ident, summary, rand_call) + let path = cx.path_ident(trait_span, substr.type_ident); + rand_thing(cx, trait_span, path, summary, rand_call) } StaticEnum(_, ref variants) => { if variants.is_empty() { @@ -115,7 +116,8 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) let i_expr = cx.expr_uint(v_span, i); let pat = cx.pat_lit(v_span, i_expr); - let thing = rand_thing(cx, v_span, ident, summary, |cx, sp| rand_call(cx, sp)); + let path = cx.path(v_span, vec![substr.type_ident, ident]); + let thing = rand_thing(cx, v_span, path, summary, |cx, sp| rand_call(cx, sp)); cx.arm(v_span, vec!( pat ), thing) }).collect:: >(); @@ -132,17 +134,18 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) fn rand_thing(cx: &mut ExtCtxt, trait_span: Span, - ctor_ident: Ident, + ctor_path: ast::Path, summary: &StaticFields, rand_call: |&mut ExtCtxt, Span| -> P) -> P { + let path = cx.expr_path(ctor_path.clone()); match *summary { Unnamed(ref fields) => { if fields.is_empty() { - cx.expr_ident(trait_span, ctor_ident) + path } else { let exprs = fields.iter().map(|span| rand_call(cx, *span)).collect(); - cx.expr_call_ident(trait_span, ctor_ident, exprs) + cx.expr_call(trait_span, path, exprs) } } Named(ref fields) => { @@ -150,7 +153,7 @@ fn rand_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) let e = rand_call(cx, span); cx.field_imm(span, ident, e) }).collect(); - cx.expr_struct_ident(trait_span, ctor_ident, rand_fields) + cx.expr_struct(trait_span, ctor_path, rand_fields) } } } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index fa69495fa42aa..081456bebe19c 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +use self::Either::*; use ast::{Block, Crate, DeclLocal, ExprMac, PatMac}; use ast::{Local, Ident, MacInvocTT}; diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index d4248a2c77d90..9a9724de8fb70 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::Invocation::*; +use self::ArgumentType::*; +use self::Position::*; + use ast; use codemap::{Span, respan}; use ext::base::*; diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs index 15fe7fc42b275..b50a4690e420b 100644 --- a/src/libsyntax/ext/mtwt.rs +++ b/src/libsyntax/ext/mtwt.rs @@ -15,6 +15,8 @@ //! and definition contexts*. J. Funct. Program. 22, 2 (March 2012), 181-216. //! DOI=10.1017/S0956796812000093 http://dx.doi.org/10.1017/S0956796812000093 +pub use self::SyntaxContext_::*; + use ast::{Ident, Mrk, Name, SyntaxContext}; use std::cell::RefCell; @@ -278,6 +280,7 @@ fn xor_push(marks: &mut Vec, mark: Mrk) { #[cfg(test)] mod tests { + use self::TestSC::*; use ast::{EMPTY_CTXT, Ident, Mrk, Name, SyntaxContext}; use super::{resolve, xor_push, apply_mark_internal, new_sctable_internal}; use super::{apply_rename_internal, apply_renames, marksof_internal, resolve_internal}; diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 1f0b667259473..b4cd9779ae251 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -76,6 +76,9 @@ //! Remaining input: `` //! eof: [a $( a )* a b ·] +pub use self::NamedMatch::*; +pub use self::ParseResult::*; +use self::TokenTreeOrTokenTreeVec::*; use ast; use ast::{TokenTree, Ident}; diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 3cb861aac20c1..99799fecb7882 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +use self::LockstepIterSize::*; use ast; use ast::{TokenTree, TtDelimited, TtToken, TtSequence, Ident}; diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 019d2315c1a19..0178566fb0621 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -17,6 +17,7 @@ //! //! Features are enabled in programs via the crate-level attributes of //! `#![feature(...)]` with a comma-separated list of features. +use self::Status::*; use abi::RustIntrinsic; use ast::NodeId; diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 5a7679570bf8d..b62d2d744c9e0 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::CommentStyle::*; + use ast; use codemap::{BytePos, CharPos, CodeMap, Pos}; use diagnostic; diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 1b2ab3c235d5f..e2dee607c6925 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -17,6 +17,8 @@ Obsolete syntax that becomes too hard to parse can be removed. */ +pub use self::ObsoleteSyntax::*; + use ast::{Expr, ExprTup}; use codemap::Span; use parse::parser; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 50e3483fb15d2..5c95c369f94a8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -10,6 +10,9 @@ #![macro_escape] +pub use self::PathParsingMode::*; +use self::ItemOrViewItem::*; + use abi; use ast::{AssociatedType, BareFnTy, ClosureTy}; use ast::{RegionTyParamBound, TraitTyParamBound}; diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index f501a5831d2ad..298328d73efb0 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -8,6 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::BinOpToken::*; +pub use self::Nonterminal::*; +pub use self::DelimToken::*; +pub use self::IdentStyle::*; +pub use self::Token::*; + use ast; use ext::mtwt; use ptr::P; @@ -418,6 +424,7 @@ macro_rules! declare_special_idents_and_keywords {( * the language and may not appear as identifiers. */ pub mod keywords { + pub use self::Keyword::*; use ast; pub enum Keyword { diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 5523f85acebc8..7ab3d5dbcd1b5 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -59,6 +59,10 @@ //! line (which it can't) and so naturally place the content on its own line to //! avoid combining it with other lines and making matters even worse. +pub use self::PrintStackBreak::*; +pub use self::Breaks::*; +pub use self::Token::*; + use std::io; use std::string; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 7025555ab4006..390a5cc68d30b 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +pub use self::AnnNode::*; + use abi; use ast::{FnUnboxedClosureKind, FnMutUnboxedClosureKind}; use ast::{FnOnceUnboxedClosureKind}; diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 8b6d752d4848e..f21a3185d6d3e 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -12,6 +12,7 @@ #![allow(dead_code)] #![allow(unused_imports)] +use self::HasTestSignature::*; use std::slice; use std::mem; @@ -276,16 +277,17 @@ fn strip_test_functions(krate: ast::Crate) -> ast::Crate { }) } +#[deriving(PartialEq)] +enum HasTestSignature { + Yes, + No, + NotEvenAFunction, +} + + fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool { let has_test_attr = attr::contains_name(i.attrs.as_slice(), "test"); - #[deriving(PartialEq)] - enum HasTestSignature { - Yes, - No, - NotEvenAFunction, - } - fn has_test_signature(i: &ast::Item) -> HasTestSignature { match &i.node { &ast::ItemFn(ref decl, _, _, ref generics, _) => { diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs index 8aba0014e97bb..c4b3288d44db8 100644 --- a/src/libsyntax/util/small_vector.rs +++ b/src/libsyntax/util/small_vector.rs @@ -7,6 +7,8 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +use self::SmallVectorRepr::*; +use self::MoveItemsRepr::*; use std::mem; use std::slice; diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index f30a4325eb8c0..2960c28a8b71d 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -23,6 +23,8 @@ //! instance, a walker looking for item names in a module will miss all of //! those that are created by the expansion of a macro. +pub use self::FnKind::*; + use abi::Abi; use ast::*; use ast; diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 02a2613d4818a..151a388a13335 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -50,7 +50,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![allow(unknown_features)] -#![feature(macro_rules, phase, slicing_syntax)] +#![feature(macro_rules, phase, slicing_syntax, globs)] #![deny(missing_docs)] @@ -166,6 +166,8 @@ pub mod color { /// Terminal attributes pub mod attr { + pub use self::Attr::*; + /// Terminal attributes for use with term.attr(). /// /// Most attributes can only be turned on and must be turned off with term.reset(). diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index b492a5321ce07..ec6e286b9b961 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -10,6 +10,11 @@ //! Parameterized string expansion +pub use self::Param::*; +use self::States::*; +use self::FormatState::*; +use self::FormatOp::*; + use std::char; use std::mem::replace; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index aa4934fa87a59..8266765ba3f27 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -33,13 +33,22 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(asm, macro_rules, phase)] +#![feature(asm, macro_rules, phase, globs)] extern crate getopts; extern crate regex; extern crate serialize; extern crate term; +pub use self::TestFn::*; +pub use self::MetricChange::*; +pub use self::ColorConfig::*; +pub use self::TestResult::*; +pub use self::TestName::*; +use self::TestEvent::*; +use self::NamePadding::*; +use self::OutputLocation::*; + use std::collections::TreeMap; use stats::Stats; use getopts::{OptGroup, optflag, optopt}; diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index 18302d4a9146f..4fb387db3a2c4 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -21,13 +21,16 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(phase)] +#![feature(phase, globs)] #[cfg(test)] #[phase(plugin, link)] extern crate log; extern crate serialize; extern crate libc; +pub use self::ParseError::*; +use self::Fmt::*; + use std::fmt::Show; use std::fmt; use std::io::BufReader; diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 0db0ffd5cb4ed..7e51c0d429117 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -29,6 +29,7 @@ html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] #![no_std] +#![feature(globs)] extern crate core; diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index 797523540492c..dfba686143f3b 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -7134,6 +7134,7 @@ pub mod charwidth { } pub mod grapheme { + pub use self::GraphemeCat::*; use core::slice::SlicePrelude; use core::slice; diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 50f257c9c859e..99c1ce503cc4d 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -17,6 +17,7 @@ * methods provided by the UnicodeChar trait. */ +use self::GraphemeState::*; use core::cmp; use core::slice::SlicePrelude; use core::iter::{Filter, AdditiveIterator, Iterator, DoubleEndedIterator}; diff --git a/src/test/auxiliary/issue-8044.rs b/src/test/auxiliary/issue-8044.rs index 5a045da4f086e..03f8d49ad627e 100644 --- a/src/test/auxiliary/issue-8044.rs +++ b/src/test/auxiliary/issue-8044.rs @@ -19,7 +19,7 @@ pub enum TreeItem { } pub fn leaf(value: V) -> TreeItem { - TreeLeaf { value: value } + TreeItem::TreeLeaf { value: value } } fn main() { diff --git a/src/test/auxiliary/xc_private_method_lib.rs b/src/test/auxiliary/xc_private_method_lib.rs index ddab6836bb83c..07c99ecefb861 100644 --- a/src/test/auxiliary/xc_private_method_lib.rs +++ b/src/test/auxiliary/xc_private_method_lib.rs @@ -31,13 +31,13 @@ pub enum Enum { impl Enum { fn static_meth_enum() -> Enum { - Variant2(10) + Enum::Variant2(10) } fn meth_enum(&self) -> int { match *self { - Variant1(x) | - Variant2(x) => x + Enum::Variant1(x) | + Enum::Variant2(x) => x } } } diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index c2383add929d7..cea03f13a4bbd 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -37,8 +37,8 @@ fn server(requests: &Receiver, responses: &Sender) { let mut done = false; while !done { match requests.recv_opt() { - Ok(get_count) => { responses.send(count.clone()); } - Ok(bytes(b)) => { + Ok(request::get_count) => { responses.send(count.clone()); } + Ok(request::bytes(b)) => { //println!("server: received {} bytes", b); count += b; } @@ -67,7 +67,7 @@ fn run(args: &[String]) { worker_results.push(task::try_future(proc() { for _ in range(0u, size / workers) { //println!("worker {}: sending {} bytes", i, num_bytes); - to_child.send(bytes(num_bytes)); + to_child.send(request::bytes(num_bytes)); } //println!("worker {} exiting", i); })); @@ -81,7 +81,7 @@ fn run(args: &[String]) { } //println!("sending stop message"); - to_child.send(stop); + to_child.send(request::stop); move_out(to_child); result = Some(from_child.recv()); }); diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 8d05dfdb7cd02..476e7d42d45bb 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -32,8 +32,8 @@ fn server(requests: &Receiver, responses: &Sender) { let mut done = false; while !done { match requests.recv_opt() { - Ok(get_count) => { responses.send(count.clone()); } - Ok(bytes(b)) => { + Ok(request::get_count) => { responses.send(count.clone()); } + Ok(request::bytes(b)) => { //println!("server: received {} bytes", b); count += b; } @@ -61,7 +61,7 @@ fn run(args: &[String]) { worker_results.push(task::try_future(proc() { for _ in range(0u, size / workers) { //println!("worker {}: sending {} bytes", i, num_bytes); - to_child.send(bytes(num_bytes)); + to_child.send(request::bytes(num_bytes)); } //println!("worker {} exiting", i); })); @@ -73,7 +73,7 @@ fn run(args: &[String]) { worker_results.push(task::try_future(proc() { for _ in range(0u, size / workers) { //println!("worker {}: sending {} bytes", i, num_bytes); - to_child.send(bytes(num_bytes)); + to_child.send(request::bytes(num_bytes)); } //println!("worker {} exiting", i); })); diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index a0c69b3736d5b..28075779f8d79 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -51,19 +51,19 @@ enum Tree<'a> { fn item_check(t: &Tree) -> int { match *t { - Nil => 0, - Node(l, r, i) => i + item_check(l) - item_check(r) + Tree::Nil => 0, + Tree::Node(l, r, i) => i + item_check(l) - item_check(r) } } fn bottom_up_tree<'r>(arena: &'r TypedArena>, item: int, depth: int) -> &'r Tree<'r> { if depth > 0 { - arena.alloc(Node(bottom_up_tree(arena, 2 * item - 1, depth - 1), - bottom_up_tree(arena, 2 * item, depth - 1), - item)) + arena.alloc(Tree::Node(bottom_up_tree(arena, 2 * item - 1, depth - 1), + bottom_up_tree(arena, 2 * item, depth - 1), + item)) } else { - arena.alloc(Nil) + arena.alloc(Tree::Nil) } } diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 191f70ac49218..3059a014528ad 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -40,6 +40,7 @@ // no-pretty-expanded +use self::Color::{Red, Yellow, Blue}; use std::string::String; use std::fmt; diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index d8df3eea83b05..ca749d47b63bd 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -79,8 +79,8 @@ impl<'a, T> List<'a, T> { impl<'a, T> Iterator<&'a T> for ListIterator<'a, T> { fn next(&mut self) -> Option<&'a T> { match *self.cur { - Nil => None, - Cons(ref elt, next) => { + List::Nil => None, + List::Cons(ref elt, next) => { self.cur = next; Some(elt) } @@ -295,7 +295,7 @@ fn search( for m in masks_at[id].iter().filter(|&m| board & *m == 0) { // This check is too costly. //if is_board_unfeasible(board | m, masks) {continue;} - search(masks, board | *m, i + 1, Cons(*m, &cur), data); + search(masks, board | *m, i + 1, List::Cons(*m, &cur), data); } } } @@ -312,7 +312,7 @@ fn par_search(masks: Vec>>) -> Data { let m = *m; spawn(proc() { let mut data = Data::new(); - search(&*masks, m, 1, Cons(m, &Nil), &mut data); + search(&*masks, m, 1, List::Cons(m, &List::Nil), &mut data); tx.send(data); }); } diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 19c3045f0e7a1..77078b2c68d39 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -78,18 +78,18 @@ fn recurse_or_panic(depth: int, st: Option) { let st = match st { None => { State { - unique: box Nil, - vec: vec!(box Nil), - res: r(box Nil) + unique: box List::Nil, + vec: vec!(box List::Nil), + res: r(box List::Nil) } } Some(st) => { let mut v = st.vec.clone(); - v.push_all(&[box Cons((), st.vec.last().unwrap().clone())]); + v.push_all(&[box List::Cons((), st.vec.last().unwrap().clone())]); State { - unique: box Cons((), box *st.unique), + unique: box List::Cons((), box *st.unique), vec: v, - res: r(box Cons((), st.res._l.clone())), + res: r(box List::Cons((), st.res._l.clone())), } } }; diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs index ae568a5277ce8..3d3ccb606bfbb 100644 --- a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs +++ b/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs @@ -19,9 +19,10 @@ impl Drop for X { enum double_option { some2(T,U), none2 } fn main() { - let x = some2(X { x: () }, X { x: () }); + let x = double_option::some2(X { x: () }, X { x: () }); match x { - some2(ref _y, _z) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern - none2 => panic!() + double_option::some2(ref _y, _z) => { }, + //~^ ERROR cannot bind by-move and by-ref in the same pattern + double_option::none2 => panic!() } } diff --git a/src/test/compile-fail/borrowck-anon-fields-variant.rs b/src/test/compile-fail/borrowck-anon-fields-variant.rs index 3e0cd05cba346..8b54f146d0412 100644 --- a/src/test/compile-fail/borrowck-anon-fields-variant.rs +++ b/src/test/compile-fail/borrowck-anon-fields-variant.rs @@ -16,16 +16,16 @@ enum Foo { } fn distinct_variant() { - let mut y = Y(1, 2); + let mut y = Foo::Y(1, 2); let a = match y { - Y(ref mut a, _) => a, - X => panic!() + Foo::Y(ref mut a, _) => a, + Foo::X => panic!() }; let b = match y { - Y(_, ref mut b) => b, - X => panic!() + Foo::Y(_, ref mut b) => b, + Foo::X => panic!() }; *a += 1; @@ -33,16 +33,16 @@ fn distinct_variant() { } fn same_variant() { - let mut y = Y(1, 2); + let mut y = Foo::Y(1, 2); let a = match y { - Y(ref mut a, _) => a, - X => panic!() + Foo::Y(ref mut a, _) => a, + Foo::X => panic!() }; let b = match y { - Y(ref mut b, _) => b, //~ ERROR cannot borrow - X => panic!() + Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow + Foo::X => panic!() }; *a += 1; diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs index 4c6088969f359..8c6e76e774619 100644 --- a/src/test/compile-fail/borrowck-autoref-3261.rs +++ b/src/test/compile-fail/borrowck-autoref-3261.rs @@ -20,12 +20,12 @@ impl X { } fn main() { - let mut x = X(Right(main)); + let mut x = X(Either::Right(main)); (&mut x).with( |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time match opt { - &Right(ref f) => { - x = X(Left((0,0))); + &Either::Right(ref f) => { + x = X(Either::Left((0,0))); (*f)() }, _ => panic!() diff --git a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs index 376832ada4ef5..2063d7388a9dd 100644 --- a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs @@ -12,8 +12,8 @@ enum Either { Left(T), Right(U) } fn f(x: &mut Either, y: &Either) -> int { match *y { - Left(ref z) => { - *x = Right(1.0); + Either::Left(ref z) => { + *x = Either::Right(1.0); *z } _ => panic!() @@ -21,12 +21,12 @@ enum Either { Left(T), Right(U) } } fn g() { - let mut x: Either = Left(3); + let mut x: Either = Either::Left(3); println!("{}", f(&mut x, &x)); //~ ERROR cannot borrow } fn h() { - let mut x: Either = Left(3); + let mut x: Either = Either::Left(3); let y: &Either = &x; let z: &mut Either = &mut x; //~ ERROR cannot borrow *z = *y; diff --git a/src/test/compile-fail/borrowck-match-binding-is-assignment.rs b/src/test/compile-fail/borrowck-match-binding-is-assignment.rs index f599f237ba672..fe0519b8198bc 100644 --- a/src/test/compile-fail/borrowck-match-binding-is-assignment.rs +++ b/src/test/compile-fail/borrowck-match-binding-is-assignment.rs @@ -25,8 +25,8 @@ pub fn main() { } } - match Foo(1) { - Foo(x) => { + match E::Foo(1) { + E::Foo(x) => { x += 1; //~ ERROR re-assignment of immutable variable `x` } } diff --git a/src/test/compile-fail/borrowck-move-error-with-note.rs b/src/test/compile-fail/borrowck-move-error-with-note.rs index 167e78d7ed09e..c61ec39ec50d1 100644 --- a/src/test/compile-fail/borrowck-move-error-with-note.rs +++ b/src/test/compile-fail/borrowck-move-error-with-note.rs @@ -16,12 +16,12 @@ enum Foo { } fn blah() { - let f = &Foo1(box 1u32, box 2u32); + let f = &Foo::Foo1(box 1u32, box 2u32); match *f { //~ ERROR cannot move out of - Foo1(num1, //~ NOTE attempting to move value to here - num2) => (), //~ NOTE and here - Foo2(num) => (), //~ NOTE and here - Foo3 => () + Foo::Foo1(num1, //~ NOTE attempting to move value to here + num2) => (), //~ NOTE and here + Foo::Foo2(num) => (), //~ NOTE and here + Foo::Foo3 => () } } diff --git a/src/test/compile-fail/borrowck-mutate-in-guard.rs b/src/test/compile-fail/borrowck-mutate-in-guard.rs index 8a904a3b5fb89..464e42df8aa37 100644 --- a/src/test/compile-fail/borrowck-mutate-in-guard.rs +++ b/src/test/compile-fail/borrowck-mutate-in-guard.rs @@ -15,15 +15,15 @@ enum Enum<'a> { fn foo() -> int { let mut n = 42; - let mut x = A(&mut n); + let mut x = Enum::A(&mut n); match x { - A(_) if { x = B(false); false } => 1, + Enum::A(_) if { x = Enum::B(false); false } => 1, //~^ ERROR cannot assign in a pattern guard - A(_) if { let y = &mut x; *y = B(false); false } => 1, + Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, //~^ ERROR cannot mutably borrow in a pattern guard //~^^ ERROR cannot assign in a pattern guard - A(p) => *p, - B(_) => 2, + Enum::A(p) => *p, + Enum::B(_) => 2, } } diff --git a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs index ad90839b4bc43..db3fa6247db26 100644 --- a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs +++ b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs @@ -18,12 +18,12 @@ enum cycle { empty } fn main() { - let mut x = box node(node_ {a: box empty}); + let mut x = box cycle::node(node_ {a: box cycle::empty}); // Create a cycle! match *x { - node(ref mut y) => { + cycle::node(ref mut y) => { y.a = x; //~ ERROR cannot move out of } - empty => {} + cycle::empty => {} }; } diff --git a/src/test/compile-fail/by-move-pattern-binding.rs b/src/test/compile-fail/by-move-pattern-binding.rs index dd9ab6ca74ed8..a49256d1bfc03 100644 --- a/src/test/compile-fail/by-move-pattern-binding.rs +++ b/src/test/compile-fail/by-move-pattern-binding.rs @@ -20,13 +20,13 @@ struct S { fn f(x: String) {} fn main() { - let s = S { x: Bar("hello".to_string()) }; + let s = S { x: E::Bar("hello".to_string()) }; match &s.x { - &Foo => {} - &Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move + &E::Foo => {} + &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move }; match &s.x { - &Foo => {} - &Bar(ref identifier) => println!("{}", *identifier) + &E::Foo => {} + &E::Bar(ref identifier) => println!("{}", *identifier) }; } diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs index d23aa317247c0..54dccebe69953 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -30,11 +30,11 @@ enum SafeEnum { } // These should be ok -static STATIC1: SafeEnum = Variant1; -static STATIC2: SafeEnum = Variant2(0); +static STATIC1: SafeEnum = SafeEnum::Variant1; +static STATIC2: SafeEnum = SafeEnum::Variant2(0); // This one should fail -static STATIC3: SafeEnum = Variant3(WithDtor); +static STATIC3: SafeEnum = SafeEnum::Variant3(WithDtor); //~^ ERROR statics are not allowed to have destructors @@ -51,9 +51,9 @@ impl Drop for UnsafeEnum { } -static STATIC4: UnsafeEnum = Variant5; +static STATIC4: UnsafeEnum = UnsafeEnum::Variant5; //~^ ERROR statics are not allowed to have destructors -static STATIC5: UnsafeEnum = Variant6(0); +static STATIC5: UnsafeEnum = UnsafeEnum::Variant6(0); //~^ ERROR statics are not allowed to have destructors @@ -64,22 +64,25 @@ struct SafeStruct { // Struct fields are safe, hence this static should be safe -static STATIC6: SafeStruct = SafeStruct{field1: Variant1, field2: Variant2(0)}; +static STATIC6: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, field2: SafeEnum::Variant2(0)}; // field2 has an unsafe value, hence this should fail -static STATIC7: SafeStruct = SafeStruct{field1: Variant1, field2: Variant3(WithDtor)}; +static STATIC7: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, + field2: SafeEnum::Variant3(WithDtor)}; //~^ ERROR statics are not allowed to have destructors // Test variadic constructor for structs. The base struct should be examined // as well as every field present in the constructor. // This example shouldn't fail because all the fields are safe. -static STATIC8: SafeStruct = SafeStruct{field1: Variant1, - ..SafeStruct{field1: Variant1, field2: Variant1}}; +static STATIC8: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, + ..SafeStruct{field1: SafeEnum::Variant1, + field2: SafeEnum::Variant1}}; // This example should fail because field1 in the base struct is not safe -static STATIC9: SafeStruct = SafeStruct{field1: Variant1, - ..SafeStruct{field1: Variant3(WithDtor), field2: Variant1}}; -//~^ ERROR statics are not allowed to have destructors +static STATIC9: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, + ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), + field2: SafeEnum::Variant1}}; +//~^^ ERROR statics are not allowed to have destructors struct UnsafeStruct; @@ -103,14 +106,15 @@ static mut STATIC12: UnsafeStruct = UnsafeStruct; //~^ ERROR mutable statics are not allowed to have destructors //~^^ ERROR statics are not allowed to have destructors -static mut STATIC13: SafeStruct = SafeStruct{field1: Variant1, field2: Variant3(WithDtor)}; +static mut STATIC13: SafeStruct = SafeStruct{field1: SafeEnum::Variant1, //~^ ERROR mutable statics are not allowed to have destructors -//~^^ ERROR: statics are not allowed to have destructors + field2: SafeEnum::Variant3(WithDtor)}; +//~^ ERROR: statics are not allowed to have destructors static mut STATIC14: SafeStruct = SafeStruct { //~^ ERROR mutable statics are not allowed to have destructors - field1: Variant1, - field2: Variant4("str".to_string()) + field1: SafeEnum::Variant1, + field2: SafeEnum::Variant4("str".to_string()) }; static STATIC15: &'static [Box] = &[ @@ -123,7 +127,7 @@ static STATIC16: (&'static Box, &'static Box) = ( &box MyOwned, //~ ERROR statics are not allowed to have custom pointers ); -static mut STATIC17: SafeEnum = Variant1; +static mut STATIC17: SafeEnum = SafeEnum::Variant1; //~^ ERROR mutable statics are not allowed to have destructors static STATIC19: Box = diff --git a/src/test/compile-fail/dup-struct-enum-struct-variant.rs b/src/test/compile-fail/dup-struct-enum-struct-variant.rs deleted file mode 100644 index 7ea114605ce78..0000000000000 --- a/src/test/compile-fail/dup-struct-enum-struct-variant.rs +++ /dev/null @@ -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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum Foo { C { a: int, b: int } } -struct C { a: int, b: int } //~ ERROR error: duplicate definition of type or module `C` - -struct A { x: int } -enum Bar { A { x: int } } //~ ERROR error: duplicate definition of type or module `A` - -fn main() {} diff --git a/src/test/compile-fail/enum-to-float-cast.rs b/src/test/compile-fail/enum-to-float-cast.rs index 9c859cb0dde27..3ad27906552d7 100644 --- a/src/test/compile-fail/enum-to-float-cast.rs +++ b/src/test/compile-fail/enum-to-float-cast.rs @@ -20,13 +20,13 @@ enum F { H1 = 0xFFFFFFFFFFFFFFFF } -static C0: f32 = L0 as f32; //~ ERROR illegal cast -static C1: f32 = H1 as f32; //~ ERROR illegal cast +static C0: f32 = E::L0 as f32; //~ ERROR illegal cast +static C1: f32 = F::H1 as f32; //~ ERROR illegal cast pub fn main() { - let a = L0 as f32; //~ ERROR illegal cast + let a = E::L0 as f32; //~ ERROR illegal cast let b = C0; - let c = H1 as f32; //~ ERROR illegal cast + let c = F::H1 as f32; //~ ERROR illegal cast let d = C1; assert_eq!(a, -1.0f32); assert_eq!(b, -1.0f32); diff --git a/src/test/compile-fail/enum-variant-type-2.rs b/src/test/compile-fail/enum-variant-type-2.rs index bf80626793d6d..6c52d41b99553 100644 --- a/src/test/compile-fail/enum-variant-type-2.rs +++ b/src/test/compile-fail/enum-variant-type-2.rs @@ -14,6 +14,6 @@ enum Foo { Bar } -fn foo(x: Bar) {} //~ERROR found value name used as a type +fn foo(x: Foo::Bar) {} //~ERROR found value name used as a type fn main() {} diff --git a/src/test/compile-fail/enum-variant-type.rs b/src/test/compile-fail/enum-variant-type.rs deleted file mode 100644 index 93d44f96c8aa0..0000000000000 --- a/src/test/compile-fail/enum-variant-type.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that enum variants are in the type namespace. - -enum Foo { - Foo //~ERROR duplicate definition of type or module `Foo` -} - -enum Bar { - Baz -} - -trait Baz {} //~ERROR duplicate definition of type or module `Baz` - -pub fn main() {} diff --git a/src/test/compile-fail/export-tag-variant.rs b/src/test/compile-fail/export-tag-variant.rs index 859cbd8e50bd8..46d872495a6d6 100644 --- a/src/test/compile-fail/export-tag-variant.rs +++ b/src/test/compile-fail/export-tag-variant.rs @@ -14,4 +14,4 @@ mod foo { enum y { y1, } } -fn main() { let z = foo::y1; } //~ ERROR: is inaccessible +fn main() { let z = foo::y::y1; } //~ ERROR: is inaccessible diff --git a/src/test/compile-fail/glob-resolve1.rs b/src/test/compile-fail/glob-resolve1.rs index c522ecc4817f8..459a5d8c9e3cb 100644 --- a/src/test/compile-fail/glob-resolve1.rs +++ b/src/test/compile-fail/glob-resolve1.rs @@ -33,8 +33,7 @@ fn foo() {} fn main() { fpriv(); //~ ERROR: unresolved epriv(); //~ ERROR: unresolved - A1; //~ ERROR: unresolved - B1; + B; //~ ERROR: unresolved C; //~ ERROR: unresolved import(); //~ ERROR: unresolved diff --git a/src/test/compile-fail/infinite-tag-type-recursion.rs b/src/test/compile-fail/infinite-tag-type-recursion.rs index 8a73e70572e9c..f8d89a8269dde 100644 --- a/src/test/compile-fail/infinite-tag-type-recursion.rs +++ b/src/test/compile-fail/infinite-tag-type-recursion.rs @@ -13,4 +13,4 @@ enum mlist { cons(int, mlist), nil, } -fn main() { let a = cons(10, cons(11, nil)); } +fn main() { let a = mlist::cons(10, mlist::cons(11, mlist::nil)); } diff --git a/src/test/compile-fail/inner-static-type-parameter.rs b/src/test/compile-fail/inner-static-type-parameter.rs index 0ec4b62f8d2db..abd7efe0e8ed1 100644 --- a/src/test/compile-fail/inner-static-type-parameter.rs +++ b/src/test/compile-fail/inner-static-type-parameter.rs @@ -13,7 +13,7 @@ enum Bar { What } fn foo() { - static a: Bar = What; + static a: Bar = Bar::What; //~^ ERROR: cannot use an outer type parameter in this context } diff --git a/src/test/compile-fail/issue-11680.rs b/src/test/compile-fail/issue-11680.rs index 86a58783a2a49..0f30243b39a19 100644 --- a/src/test/compile-fail/issue-11680.rs +++ b/src/test/compile-fail/issue-11680.rs @@ -13,9 +13,9 @@ extern crate "issue-11680" as other; fn main() { - let _b = other::Bar(1); + let _b = other::Foo::Bar(1); //~^ ERROR: variant `Bar` is private - let _b = other::test::Bar(1); + let _b = other::test::Foo::Bar(1); //~^ ERROR: variant `Bar` is private } diff --git a/src/test/compile-fail/issue-12116.rs b/src/test/compile-fail/issue-12116.rs index cc0841a6856ca..59e29516a740c 100644 --- a/src/test/compile-fail/issue-12116.rs +++ b/src/test/compile-fail/issue-12116.rs @@ -15,8 +15,8 @@ enum IntList { fn tail(source_list: &IntList) -> IntList { match source_list { - &Cons(val, box ref next_list) => tail(next_list), - &Cons(val, box Nil) => Cons(val, box Nil), + &IntList::Cons(val, box ref next_list) => tail(next_list), + &IntList::Cons(val, box Nil) => IntList::Cons(val, box Nil), //~^ ERROR: unreachable pattern _ => panic!() } diff --git a/src/test/compile-fail/issue-13624.rs b/src/test/compile-fail/issue-13624.rs index 5b9ff06e9c9a3..83612823c591a 100644 --- a/src/test/compile-fail/issue-13624.rs +++ b/src/test/compile-fail/issue-13624.rs @@ -14,7 +14,7 @@ mod a { } pub fn get_enum_struct_variant() -> () { - EnumStructVariant { x: 1, y: 2, z: 3 } + Enum::EnumStructVariant { x: 1, y: 2, z: 3 } //~^ ERROR mismatched types: expected `()`, found `a::Enum` (expected (), found enum a::Enum) } } @@ -26,7 +26,7 @@ mod b { fn test_enum_struct_variant() { let enum_struct_variant = ::a::get_enum_struct_variant(); match enum_struct_variant { - a::EnumStructVariant { x, y, z } => { + a::Enum::EnumStructVariant { x, y, z } => { //~^ ERROR mismatched types: expected `()`, found `a::Enum` // (expected (), found enum a::Enum) } diff --git a/src/test/compile-fail/issue-15129.rs b/src/test/compile-fail/issue-15129.rs index 83d7096087ef8..f56430f42289a 100644 --- a/src/test/compile-fail/issue-15129.rs +++ b/src/test/compile-fail/issue-15129.rs @@ -19,9 +19,9 @@ pub enum V { } fn main() { - match (T1(()), V2(true)) { + match (T::T1(()), V::V2(true)) { //~^ ERROR non-exhaustive patterns: `(T1(()), V2(_))` not covered - (T1(()), V1(i)) => (), - (T2(()), V2(b)) => () + (T::T1(()), V::V1(i)) => (), + (T::T2(()), V::V2(b)) => () } } diff --git a/src/test/compile-fail/issue-15896.rs b/src/test/compile-fail/issue-15896.rs index 5d92208d3e3fb..7b91063e2f98d 100644 --- a/src/test/compile-fail/issue-15896.rs +++ b/src/test/compile-fail/issue-15896.rs @@ -15,9 +15,9 @@ fn main() { struct Tau { t: uint } enum E { B(R, Tau) } - let e = B(REB(()), Tau { t: 3 }); + let e = E::B(R::REB(()), Tau { t: 3 }); let u = match e { - B( + E::B( Tau{t: x}, //~^ ERROR mismatched types: expected `main::R`, found `main::Tau` // (expected enum main::R, found struct main::Tau) diff --git a/src/test/compile-fail/issue-17025.rs b/src/test/compile-fail/issue-17025.rs index 5e076a0dfbb4d..2a1a3397d5447 100644 --- a/src/test/compile-fail/issue-17025.rs +++ b/src/test/compile-fail/issue-17025.rs @@ -14,7 +14,7 @@ enum A { } fn c(c:char) { - B(c); + A::B(c); //~^ ERROR cannot move a value of type A: the size of A cannot be statically determined } diff --git a/src/test/compile-fail/issue-17385.rs b/src/test/compile-fail/issue-17385.rs index bc1495ac45432..62a5c7318b98f 100644 --- a/src/test/compile-fail/issue-17385.rs +++ b/src/test/compile-fail/issue-17385.rs @@ -30,10 +30,10 @@ fn main() { _ => unreachable!() } - let e = Variant2; + let e = Enum::Variant2; drop(e); match e { //~ ERROR use of moved value - Variant1 => unreachable!(), - Variant2 => () + Enum::Variant1 => unreachable!(), + Enum::Variant2 => () } } diff --git a/src/test/compile-fail/issue-17405.rs b/src/test/compile-fail/issue-17405.rs index b0f2e0b666e3d..c956f00c8e77f 100644 --- a/src/test/compile-fail/issue-17405.rs +++ b/src/test/compile-fail/issue-17405.rs @@ -13,7 +13,7 @@ enum Foo { } fn main() { - match Bar(1i) { + match Foo::Bar(1i) { Foo { i } => () //~ ERROR `Foo` does not name a struct or a struct variant } } diff --git a/src/test/compile-fail/issue-17444.rs b/src/test/compile-fail/issue-17444.rs index 33777e820edc8..55570e93a9721 100644 --- a/src/test/compile-fail/issue-17444.rs +++ b/src/test/compile-fail/issue-17444.rs @@ -13,6 +13,6 @@ enum Test { } fn main() { - let _x = Foo as *const int; + let _x = Test::Foo as *const int; //~^ ERROR illegal cast; cast through an integer first: `Test` as `*const int` } diff --git a/src/test/compile-fail/issue-17800.rs b/src/test/compile-fail/issue-17800.rs index 30a8a51ed8c06..9590ef3dab48c 100644 --- a/src/test/compile-fail/issue-17800.rs +++ b/src/test/compile-fail/issue-17800.rs @@ -14,8 +14,9 @@ enum MyOption { } fn main() { - match MySome(42i) { - MySome { x: 42i } => (), //~ ERROR `MySome` does not name a struct or a struct variant + match MyOption::MySome(42i) { + MyOption::MySome { x: 42i } => (), + //~^ ERROR `MyOption::MySome` does not name a struct or a struct variant _ => (), } } diff --git a/src/test/compile-fail/issue-18252.rs b/src/test/compile-fail/issue-18252.rs index 930e96f170e36..a655d61fa56c1 100644 --- a/src/test/compile-fail/issue-18252.rs +++ b/src/test/compile-fail/issue-18252.rs @@ -13,5 +13,5 @@ enum Foo { } fn main() { - let f = Variant(42u); //~ ERROR expected function, found `Foo` + let f = Foo::Variant(42u); //~ ERROR expected function, found `Foo` } diff --git a/src/test/compile-fail/issue-2848.rs b/src/test/compile-fail/issue-2848.rs index 572ceb48fcd57..e5503edfab5e1 100644 --- a/src/test/compile-fail/issue-2848.rs +++ b/src/test/compile-fail/issue-2848.rs @@ -17,7 +17,7 @@ mod bar { } fn main() { - use bar::{alpha, charlie}; + use bar::foo::{alpha, charlie}; match alpha { alpha | beta => {} //~ ERROR variable `beta` from pattern #2 is not bound in pattern #1 charlie => {} diff --git a/src/test/compile-fail/issue-2849.rs b/src/test/compile-fail/issue-2849.rs index f09c2141b4471..5aaeb7e8c6d77 100644 --- a/src/test/compile-fail/issue-2849.rs +++ b/src/test/compile-fail/issue-2849.rs @@ -11,7 +11,8 @@ enum foo { alpha, beta(int) } fn main() { - match alpha { - alpha | beta(i) => {} //~ ERROR variable `i` from pattern #2 is not bound in pattern #1 + match foo::alpha { + foo::alpha | foo::beta(i) => {} + //~^ ERROR variable `i` from pattern #2 is not bound in pattern #1 } } diff --git a/src/test/compile-fail/issue-3038.rs b/src/test/compile-fail/issue-3038.rs index 049c6130d2d8a..d9fe3550c9e75 100644 --- a/src/test/compile-fail/issue-3038.rs +++ b/src/test/compile-fail/issue-3038.rs @@ -18,13 +18,14 @@ enum k { m(int, int) } fn main() { - let _z = match g(1, 2) { - g(x, x) => { println!("{}", x + x); } + let _z = match f::g(1, 2) { + f::g(x, x) => { println!("{}", x + x); } //~^ ERROR identifier `x` is bound more than once in the same pattern }; - let _z = match i(l(1, 2), m(3, 4)) { - i(l(x, _), m(_, x)) //~ ERROR identifier `x` is bound more than once in the same pattern + let _z = match h::i(j::l(1, 2), k::m(3, 4)) { + h::i(j::l(x, _), k::m(_, x)) + //~^ ERROR identifier `x` is bound more than once in the same pattern => { println!("{}", x + x); } }; diff --git a/src/test/compile-fail/issue-3521.rs b/src/test/compile-fail/issue-3521.rs index 2e0006bb1fe64..f3d26c50cc332 100644 --- a/src/test/compile-fail/issue-3521.rs +++ b/src/test/compile-fail/issue-3521.rs @@ -16,5 +16,5 @@ fn main() { Bar = foo //~ ERROR attempt to use a non-constant value in a constant } - println!("{}", Bar); + println!("{}", Stuff::Bar); } diff --git a/src/test/compile-fail/issue-3601.rs b/src/test/compile-fail/issue-3601.rs index 2716d49fe69a8..f10305d017dc3 100644 --- a/src/test/compile-fail/issue-3601.rs +++ b/src/test/compile-fail/issue-3601.rs @@ -31,12 +31,12 @@ struct NodeData { fn main() { let mut id = HTMLImageData { image: None }; - let ed = ElementData { kind: box HTMLImageElement(id) }; - let n = NodeData {kind : box Element(ed)}; + let ed = ElementData { kind: box ElementKind::HTMLImageElement(id) }; + let n = NodeData {kind : box NodeKind::Element(ed)}; // n.b. span could be better match n.kind { - box Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns - box HTMLImageElement(ref d) if d.image.is_some() => { true } + box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns + box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } }, _ => panic!("WAT") //~ ERROR unreachable pattern }; diff --git a/src/test/compile-fail/issue-3993-2.rs b/src/test/compile-fail/issue-3993-2.rs index c5453f79de24b..9d9e91a141be3 100644 --- a/src/test/compile-fail/issue-3993-2.rs +++ b/src/test/compile-fail/issue-3993-2.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use zoo::{duck, goose}; +use zoo::bird::{duck, goose}; mod zoo { pub enum bird { diff --git a/src/test/compile-fail/issue-4972.rs b/src/test/compile-fail/issue-4972.rs index bff167fa391d5..765aec35fc6a8 100644 --- a/src/test/compile-fail/issue-4972.rs +++ b/src/test/compile-fail/issue-4972.rs @@ -17,7 +17,7 @@ pub enum TraitWrapper { fn get_tw_map(tw: &TraitWrapper) -> &MyTrait { match *tw { - A(box ref map) => map, //~ ERROR cannot be dereferenced + TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced } } diff --git a/src/test/compile-fail/issue-5100.rs b/src/test/compile-fail/issue-5100.rs index ddd82af01a71e..df3748ac93468 100644 --- a/src/test/compile-fail/issue-5100.rs +++ b/src/test/compile-fail/issue-5100.rs @@ -12,7 +12,7 @@ enum A { B, C } fn main() { match (true, false) { - B => (), + A::B => (), //~^ ERROR mismatched types: expected `(bool, bool)`, found `A` (expected tuple, found enum A) _ => () } diff --git a/src/test/compile-fail/issue-5358-1.rs b/src/test/compile-fail/issue-5358-1.rs index de715902f2a3d..576dfe8b67bc1 100644 --- a/src/test/compile-fail/issue-5358-1.rs +++ b/src/test/compile-fail/issue-5358-1.rs @@ -12,8 +12,8 @@ enum Either { Left(T), Right(U) } struct S(Either); fn main() { - match S(Left(5)) { - Right(_) => {} //~ ERROR mismatched types: expected `S`, found `Either + match S(Either::Left(5)) { + Either::Right(_) => {} //~ ERROR mismatched types: expected `S`, found `Either _ => {} } } diff --git a/src/test/compile-fail/issue-7867.rs b/src/test/compile-fail/issue-7867.rs index f3915634cc127..f11d5972ee191 100644 --- a/src/test/compile-fail/issue-7867.rs +++ b/src/test/compile-fail/issue-7867.rs @@ -14,7 +14,7 @@ mod foo { pub fn bar() {} } fn main() { match (true, false) { - B => (), //~ ERROR expected `(bool, bool)`, found `A` (expected tuple, found enum A) + A::B => (), //~ ERROR expected `(bool, bool)`, found `A` (expected tuple, found enum A) _ => () } diff --git a/src/test/compile-fail/issue-9814.rs b/src/test/compile-fail/issue-9814.rs index f7609a767a7e0..d6cc493e93656 100644 --- a/src/test/compile-fail/issue-9814.rs +++ b/src/test/compile-fail/issue-9814.rs @@ -14,5 +14,5 @@ enum Foo { Bar(int) } fn main() { - let _ = *Bar(2); //~ ERROR type `Foo` cannot be dereferenced + let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced } diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/compile-fail/lint-dead-code-1.rs index 1283c61e41a00..1a4a87e608b6f 100644 --- a/src/test/compile-fail/lint-dead-code-1.rs +++ b/src/test/compile-fail/lint-dead-code-1.rs @@ -86,7 +86,7 @@ pub fn pub_fn() { let used_struct1 = UsedStruct1 { x: 1 }; let used_struct2 = UsedStruct2(1); let used_struct3 = UsedStruct3; - let e = foo3; + let e = used_enum::foo3; SemiUsedStruct::la_la_la(); let i = 1i; @@ -104,7 +104,7 @@ fn used_fn() {} fn foo() { //~ ERROR: function is never used bar(); - let unused_enum = foo2; + let unused_enum = priv_enum::foo2; } fn bar() { //~ ERROR: function is never used diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/compile-fail/lint-dead-code-4.rs index 7c3242a6a25cc..d3249dcef0f63 100644 --- a/src/test/compile-fail/lint-dead-code-4.rs +++ b/src/test/compile-fail/lint-dead-code-4.rs @@ -37,7 +37,7 @@ enum XYZ { fn field_match_in_patterns(b: XYZ) -> String { match b { - Y { a, .. } => a, + XYZ::Y { a, .. } => a, _ => "".to_string() } } @@ -60,7 +60,7 @@ fn field_match_in_let(f: Bar) -> bool { fn main() { field_read(Foo { x: 1, b: false, marker: std::kinds::marker::NoCopy }); - field_match_in_patterns(Z); + field_match_in_patterns(XYZ::Z); field_match_in_let(Bar { x: 42u, b: true, _guard: () }); let _ = Baz { x: 0 }; } diff --git a/src/test/compile-fail/lint-dead-code-5.rs b/src/test/compile-fail/lint-dead-code-5.rs index 1a3bd82a98108..d6a31c96100f2 100644 --- a/src/test/compile-fail/lint-dead-code-5.rs +++ b/src/test/compile-fail/lint-dead-code-5.rs @@ -31,10 +31,10 @@ enum Enum3 { //~ ERROR: enum is never used } fn main() { - let v = Variant1(1); + let v = Enum1::Variant1(1); match v { - Variant1(_) => (), - Variant2 => () + Enum1::Variant1(_) => (), + Enum1::Variant2 => () } - let x = Variant3(true); + let x = Enum2::Variant3(true); } diff --git a/src/test/compile-fail/lint-shorthand-field.rs b/src/test/compile-fail/lint-shorthand-field.rs index ff9347b9fc516..eb4da4d66f33c 100644 --- a/src/test/compile-fail/lint-shorthand-field.rs +++ b/src/test/compile-fail/lint-shorthand-field.rs @@ -57,8 +57,8 @@ fn main() { enum Foo { x } - match (Bar { x: x }) { - Bar { x: x } => {}, + match (Bar { x: Foo::x }) { + Bar { x: Foo::x } => {}, } } } diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs index ba8559c8008bf..9e397ce9d8d13 100644 --- a/src/test/compile-fail/lint-stability.rs +++ b/src/test/compile-fail/lint-stability.rs @@ -98,13 +98,13 @@ mod cross_crate { let _ = FrozenUnitStruct; let _ = LockedUnitStruct; - let _ = DeprecatedVariant; //~ ERROR use of deprecated item - let _ = ExperimentalVariant; //~ ERROR use of experimental item - let _ = UnstableVariant; //~ ERROR use of unstable item - let _ = UnmarkedVariant; //~ ERROR use of unmarked item - let _ = StableVariant; - let _ = FrozenVariant; - let _ = LockedVariant; + let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item + let _ = Enum::ExperimentalVariant; //~ ERROR use of experimental item + let _ = Enum::UnstableVariant; //~ ERROR use of unstable item + let _ = Enum::UnmarkedVariant; //~ ERROR use of unmarked item + let _ = Enum::StableVariant; + let _ = Enum::FrozenVariant; + let _ = Enum::LockedVariant; let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item let _ = ExperimentalTupleStruct (1); //~ ERROR use of experimental item @@ -171,8 +171,8 @@ mod inheritance { experimental_mod::experimental(); //~ ERROR use of experimental item experimental_mod::stable(); - let _ = ExperimentalVariant; //~ ERROR use of experimental item - let _ = StableVariant; + let _ = Experimental::ExperimentalVariant; //~ ERROR use of experimental item + let _ = Experimental::StableVariant; let x: uint = 0; x.experimental(); //~ ERROR use of experimental item @@ -420,13 +420,13 @@ mod this_crate { let _ = FrozenUnitStruct; let _ = LockedUnitStruct; - let _ = DeprecatedVariant; //~ ERROR use of deprecated item - let _ = ExperimentalVariant; - let _ = UnstableVariant; - let _ = UnmarkedVariant; - let _ = StableVariant; - let _ = FrozenVariant; - let _ = LockedVariant; + let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item + let _ = Enum::ExperimentalVariant; + let _ = Enum::UnstableVariant; + let _ = Enum::UnmarkedVariant; + let _ = Enum::StableVariant; + let _ = Enum::FrozenVariant; + let _ = Enum::LockedVariant; let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item let _ = ExperimentalTupleStruct (1); diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index a747615199e6f..e93872eba0c3e 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -75,8 +75,8 @@ enum tri { } fn f4b() -> int { - match a(3i) { - a(i) | b(i) | c(i) => { + match tri::a(3i) { + tri::a(i) | tri::b(i) | tri::c(i) => { i } } diff --git a/src/test/compile-fail/match-arm-statics.rs b/src/test/compile-fail/match-arm-statics.rs index cedc0098c00f5..9b313f248fcbb 100644 --- a/src/test/compile-fail/match-arm-statics.rs +++ b/src/test/compile-fail/match-arm-statics.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +use self::Direction::{North, East, South, West}; struct NewBool(bool); diff --git a/src/test/compile-fail/match-pattern-field-mismatch-2.rs b/src/test/compile-fail/match-pattern-field-mismatch-2.rs index 3e704ede159e0..ab9efdcc8cc50 100644 --- a/src/test/compile-fail/match-pattern-field-mismatch-2.rs +++ b/src/test/compile-fail/match-pattern-field-mismatch-2.rs @@ -17,9 +17,9 @@ fn main() { fn foo(c: color) { match c { - rgb(_, _, _) => { } - cmyk(_, _, _, _) => { } - no_color(_) => { } + color::rgb(_, _, _) => { } + color::cmyk(_, _, _, _) => { } + color::no_color(_) => { } //~^ ERROR this pattern has 1 field, but the corresponding variant has no fields } } diff --git a/src/test/compile-fail/match-pattern-field-mismatch.rs b/src/test/compile-fail/match-pattern-field-mismatch.rs index ce52d03465e2c..243690bbf31dc 100644 --- a/src/test/compile-fail/match-pattern-field-mismatch.rs +++ b/src/test/compile-fail/match-pattern-field-mismatch.rs @@ -17,10 +17,10 @@ fn main() { fn foo(c: color) { match c { - rgb(_, _) => { } + color::rgb(_, _) => { } //~^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields - cmyk(_, _, _, _) => { } - no_color => { } + color::cmyk(_, _, _, _) => { } + color::no_color => { } } } } diff --git a/src/test/compile-fail/match-struct.rs b/src/test/compile-fail/match-struct.rs index 2491d0b376975..65082f93d3536 100644 --- a/src/test/compile-fail/match-struct.rs +++ b/src/test/compile-fail/match-struct.rs @@ -14,7 +14,7 @@ enum E { C(int) } fn main() { match (S { a: 1 }) { - C(_) => (), //~ ERROR mismatched types: expected `S`, found `E` + E::C(_) => (), //~ ERROR mismatched types: expected `S`, found `E` _ => () } } diff --git a/src/test/compile-fail/match-tag-nullary.rs b/src/test/compile-fail/match-tag-nullary.rs index 2b0c3dbf8e80f..0fb262003592b 100644 --- a/src/test/compile-fail/match-tag-nullary.rs +++ b/src/test/compile-fail/match-tag-nullary.rs @@ -13,4 +13,4 @@ enum a { A, } enum b { B, } -fn main() { let x: a = A; match x { B => { } } } +fn main() { let x: a = a::A; match x { b::B => { } } } diff --git a/src/test/compile-fail/match-tag-unary.rs b/src/test/compile-fail/match-tag-unary.rs index a129ff19ac63e..89012e42bdcc0 100644 --- a/src/test/compile-fail/match-tag-unary.rs +++ b/src/test/compile-fail/match-tag-unary.rs @@ -13,4 +13,4 @@ enum a { A(int), } enum b { B(int), } -fn main() { let x: a = A(0); match x { B(y) => { } } } +fn main() { let x: a = a::A(0); match x { b::B(y) => { } } } diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/compile-fail/moves-based-on-type-block-bad.rs index 1a2fb33eaabfe..ee57377943d12 100644 --- a/src/test/compile-fail/moves-based-on-type-block-bad.rs +++ b/src/test/compile-fail/moves-based-on-type-block-bad.rs @@ -25,13 +25,13 @@ fn f(s: &S, g: |&S|) { } fn main() { - let s = S { x: box Bar(box 42) }; + let s = S { x: box E::Bar(box 42) }; loop { f(&s, |hellothere| { match hellothere.x { //~ ERROR cannot move out - box Foo(_) => {} - box Bar(x) => println!("{}", x.to_string()), //~ NOTE attempting to move value to here - box Baz => {} + box E::Foo(_) => {} + box E::Bar(x) => println!("{}", x.to_string()), //~ NOTE attempting to move value to here + box E::Baz => {} } }) } diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/compile-fail/mutable-enum-indirect.rs index 96937524ad513..af9c5256040dd 100644 --- a/src/test/compile-fail/mutable-enum-indirect.rs +++ b/src/test/compile-fail/mutable-enum-indirect.rs @@ -18,6 +18,6 @@ enum Foo { A(marker::NoSync) } fn bar(_: T) {} fn main() { - let x = A(marker::NoSync); + let x = Foo::A(marker::NoSync); bar(&x); //~ ERROR the trait `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/name-clash-nullary-2.rs b/src/test/compile-fail/name-clash-nullary-2.rs deleted file mode 100644 index b7038800e11f1..0000000000000 --- a/src/test/compile-fail/name-clash-nullary-2.rs +++ /dev/null @@ -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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:declaration of `thpppt` shadows -enum ack { thpppt, ffff, } - -fn main() { - let thpppt: int = 42; - log(debug, thpppt); -} diff --git a/src/test/compile-fail/no_send-enum.rs b/src/test/compile-fail/no_send-enum.rs index 2235a265bba16..8b409cfe89dd8 100644 --- a/src/test/compile-fail/no_send-enum.rs +++ b/src/test/compile-fail/no_send-enum.rs @@ -17,7 +17,7 @@ enum Foo { fn bar(_: T) {} fn main() { - let x = A(marker::NoSend); + let x = Foo::A(marker::NoSend); bar(x); //~^ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/no_share-enum.rs b/src/test/compile-fail/no_share-enum.rs index 1a692dab6d490..cb8ecd7259bb7 100644 --- a/src/test/compile-fail/no_share-enum.rs +++ b/src/test/compile-fail/no_share-enum.rs @@ -15,7 +15,7 @@ enum Foo { A(marker::NoSync) } fn bar(_: T) {} fn main() { - let x = A(marker::NoSync); + let x = Foo::A(marker::NoSync); bar(x); //~^ ERROR the trait `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs index 87fe50c86665c..3ccce591ee728 100644 --- a/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs +++ b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs @@ -11,6 +11,6 @@ enum State { ST_NULL, ST_WHITESPACE } fn main() { - [ST_NULL, ..(ST_WHITESPACE as uint)]; + [State::ST_NULL, ..(State::ST_WHITESPACE as uint)]; //~^ ERROR expected constant integer for repeat count, found non-constant expression } diff --git a/src/test/compile-fail/non-exhaustive-match-nested.rs b/src/test/compile-fail/non-exhaustive-match-nested.rs index eb946a90c376c..8f2cb61f95514 100644 --- a/src/test/compile-fail/non-exhaustive-match-nested.rs +++ b/src/test/compile-fail/non-exhaustive-match-nested.rs @@ -21,9 +21,9 @@ fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'s } fn main() { - let x = a(c); + let x = t::a(u::c); match x { //~ ERROR non-exhaustive patterns: `a(c)` not covered - a(d) => { panic!("hello"); } - b => { panic!("goodbye"); } + t::a(u::d) => { panic!("hello"); } + t::b => { panic!("goodbye"); } } } diff --git a/src/test/compile-fail/non-exhaustive-match.rs b/src/test/compile-fail/non-exhaustive-match.rs index ae5f40d4874c9..8fcf10f1c356d 100644 --- a/src/test/compile-fail/non-exhaustive-match.rs +++ b/src/test/compile-fail/non-exhaustive-match.rs @@ -11,8 +11,8 @@ enum t { a, b, } fn main() { - let x = a; - match x { b => { } } //~ ERROR non-exhaustive patterns: `a` not covered + let x = t::a; + match x { t::b => { } } //~ ERROR non-exhaustive patterns: `a` not covered match true { //~ ERROR non-exhaustive patterns: `false` not covered true => {} } @@ -22,18 +22,18 @@ fn main() { match (2i, 3i, 4i) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered (_, _, 4) => {} } - match (a, a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered - (a, b) => {} - (b, a) => {} + match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered + (t::a, t::b) => {} + (t::b, t::a) => {} } - match a { //~ ERROR non-exhaustive patterns: `b` not covered - a => {} + match t::a { //~ ERROR non-exhaustive patterns: `b` not covered + t::a => {} } // This is exhaustive, though the algorithm got it wrong at one point - match (a, b) { - (a, _) => {} - (_, a) => {} - (b, b) => {} + match (t::a, t::b) { + (t::a, _) => {} + (_, t::a) => {} + (t::b, t::b) => {} } let vec = vec!(Some(42i), None, Some(21i)); let vec: &[Option] = vec.as_slice(); diff --git a/src/test/compile-fail/non-exhaustive-pattern-witness.rs b/src/test/compile-fail/non-exhaustive-pattern-witness.rs index 55cdcdce82ca5..6e1c3db10140f 100644 --- a/src/test/compile-fail/non-exhaustive-pattern-witness.rs +++ b/src/test/compile-fail/non-exhaustive-pattern-witness.rs @@ -32,19 +32,19 @@ fn struct_with_a_nested_enum_and_vector() { } fn enum_with_multiple_missing_variants() { - match Red { + match Color::Red { //~^ ERROR non-exhaustive patterns: `Red` not covered - CustomRGBA { .. } => () + Color::CustomRGBA { .. } => () } } fn enum_struct_variant() { - match Red { + match Color::Red { //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered - Red => (), - Green => (), - CustomRGBA { a: false, r: _, g: _, b: 0 } => (), - CustomRGBA { a: false, r: _, g: _, b: _ } => () + Color::Red => (), + Color::Green => (), + Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (), + Color::CustomRGBA { a: false, r: _, g: _, b: _ } => () } } @@ -54,15 +54,15 @@ enum Enum { } fn vectors_with_nested_enums() { - let x: &'static [Enum] = &[First, Second(false)]; + let x: &'static [Enum] = &[Enum::First, Enum::Second(false)]; match x { //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered [] => (), [_] => (), - [First, _] => (), - [Second(true), First] => (), - [Second(true), Second(true)] => (), - [Second(false), _] => (), + [Enum::First, _] => (), + [Enum::Second(true), Enum::First] => (), + [Enum::Second(true), Enum::Second(true)] => (), + [Enum::Second(false), _] => (), [_, _, tail.., _] => () } } diff --git a/src/test/compile-fail/occurs-check-3.rs b/src/test/compile-fail/occurs-check-3.rs index 05ebbf7e3b41b..4cda97bcb4ac4 100644 --- a/src/test/compile-fail/occurs-check-3.rs +++ b/src/test/compile-fail/occurs-check-3.rs @@ -11,4 +11,4 @@ // error-pattern:mismatched types // From Issue #778 enum clam { a(T), } -fn main() { let c; c = a(c); match c { a::(_) => { } } } +fn main() { let c; c = clam::a(c); match c { clam::a::(_) => { } } } diff --git a/src/test/compile-fail/or-patter-mismatch.rs b/src/test/compile-fail/or-patter-mismatch.rs index 37686565f5fa4..e79113ceb89a5 100644 --- a/src/test/compile-fail/or-patter-mismatch.rs +++ b/src/test/compile-fail/or-patter-mismatch.rs @@ -12,4 +12,4 @@ enum blah { a(int, int, uint), b(int, int), } -fn main() { match a(1, 1, 2u) { a(_, x, y) | b(x, y) => { } } } +fn main() { match blah::a(1, 1, 2u) { blah::a(_, x, y) | blah::b(x, y) => { } } } diff --git a/src/test/compile-fail/pattern-error-continue.rs b/src/test/compile-fail/pattern-error-continue.rs index f438f9973cf11..8b65af00fb1c8 100644 --- a/src/test/compile-fail/pattern-error-continue.rs +++ b/src/test/compile-fail/pattern-error-continue.rs @@ -23,9 +23,9 @@ struct S { fn f(_c: char) {} fn main() { - match B(1, 2) { - B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but - D(_) => (), //~ ERROR this pattern has 1 field, but + match A::B(1, 2) { + A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but + A::D(_) => (), //~ ERROR this pattern has 1 field, but _ => () } match 'c' { diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/compile-fail/pattern-tyvar-2.rs index 7da62ef4db7da..ff898ebd16b9c 100644 --- a/src/test/compile-fail/pattern-tyvar-2.rs +++ b/src/test/compile-fail/pattern-tyvar-2.rs @@ -11,7 +11,7 @@ enum bar { t1((), Option>), t2, } // n.b. my change changes this error message, but I think it's right -- tjc -fn foo(t: bar) -> int { match t { t1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } } +fn foo(t: bar) -> int { match t { bar::t1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } } //~^ ERROR binary operation `*` cannot be applied to fn main() { } diff --git a/src/test/compile-fail/pattern-tyvar.rs b/src/test/compile-fail/pattern-tyvar.rs index 7752ea521f7e3..01b288fdaad1f 100644 --- a/src/test/compile-fail/pattern-tyvar.rs +++ b/src/test/compile-fail/pattern-tyvar.rs @@ -14,7 +14,7 @@ enum bar { t1((), Option >), t2, } fn foo(t: bar) { match t { - t1(_, Some::(x)) => { + bar::t1(_, Some::(x)) => { println!("{}", x); } _ => { panic!(); } diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs index c30261b9d3b50..50261839b16c6 100644 --- a/src/test/compile-fail/privacy1.rs +++ b/src/test/compile-fail/privacy1.rs @@ -66,7 +66,7 @@ mod bar { } fn test() { - self::Pub; + self::Enum::Pub; unsafe { epriv(); epub(); @@ -121,7 +121,7 @@ mod foo { //~^ NOTE: trait `B` is private ::lol(); - ::bar::Pub; + ::bar::Enum::Pub; unsafe { ::bar::epriv(); //~ ERROR: function `epriv` is private diff --git a/src/test/compile-fail/recursion.rs b/src/test/compile-fail/recursion.rs index d6a2fb75fa210..67177eff9f95e 100644 --- a/src/test/compile-fail/recursion.rs +++ b/src/test/compile-fail/recursion.rs @@ -28,6 +28,6 @@ fn test (n:int, i:int, first:T, second:T) ->int { } } pub fn main() { - let n = test(1, 0, NilValue, NilValue); + let n = test(1, 0, Nil::NilValue, Nil::NilValue); println!("{}", n); } diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs index ed3ce1fd0f077..b15f0405d23c6 100644 --- a/src/test/compile-fail/regions-creating-enums.rs +++ b/src/test/compile-fail/regions-creating-enums.rs @@ -14,28 +14,28 @@ enum ast<'a> { } fn build() { - let x = num(3u); - let y = num(4u); - let z = add(&x, &y); + let x = ast::num(3u); + let y = ast::num(4u); + let z = ast::add(&x, &y); compute(&z); } fn compute(x: &ast) -> uint { match *x { - num(x) => { x } - add(x, y) => { compute(x) + compute(y) } + ast::num(x) => { x } + ast::add(x, y) => { compute(x) + compute(y) } } } fn map_nums<'a,'b>(x: &ast, f: |uint| -> uint) -> &'a ast<'b> { match *x { - num(x) => { - return &num(f(x)); //~ ERROR borrowed value does not live long enough + ast::num(x) => { + return &ast::num(f(x)); //~ ERROR borrowed value does not live long enough } - add(x, y) => { + ast::add(x, y) => { let m_x = map_nums(x, |z| f(z)); let m_y = map_nums(y, |z| f(z)); - return &add(m_x, m_y); //~ ERROR borrowed value does not live long enough + return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough } } } diff --git a/src/test/compile-fail/regions-creating-enums3.rs b/src/test/compile-fail/regions-creating-enums3.rs index 2c3f39795a4f0..6f38f29591f32 100644 --- a/src/test/compile-fail/regions-creating-enums3.rs +++ b/src/test/compile-fail/regions-creating-enums3.rs @@ -14,7 +14,7 @@ enum ast<'a> { } fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { - add(x, y) //~ ERROR cannot infer + ast::add(x, y) //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/regions-creating-enums4.rs b/src/test/compile-fail/regions-creating-enums4.rs index 082ba0f0cf103..34a125c809f6b 100644 --- a/src/test/compile-fail/regions-creating-enums4.rs +++ b/src/test/compile-fail/regions-creating-enums4.rs @@ -14,7 +14,7 @@ enum ast<'a> { } fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> { - add(x, y) //~ ERROR cannot infer + ast::add(x, y) //~ ERROR cannot infer } fn main() { diff --git a/src/test/compile-fail/regions-lifetime-of-struct-or-enum-variant.rs b/src/test/compile-fail/regions-lifetime-of-struct-or-enum-variant.rs index 27e2f5582f5a4..9c985839c4d9a 100644 --- a/src/test/compile-fail/regions-lifetime-of-struct-or-enum-variant.rs +++ b/src/test/compile-fail/regions-lifetime-of-struct-or-enum-variant.rs @@ -24,7 +24,7 @@ fn structLifetime<'a>() -> &'a Test { } fn variantLifetime<'a>() -> &'a MyEnum { - let testValue = &Variant1; //~ ERROR borrowed value does not live long enough + let testValue = &MyEnum::Variant1; //~ ERROR borrowed value does not live long enough testValue } diff --git a/src/test/compile-fail/resolve-inconsistent-binding-mode.rs b/src/test/compile-fail/resolve-inconsistent-binding-mode.rs index a230e813a48e0..df54a66f0a266 100644 --- a/src/test/compile-fail/resolve-inconsistent-binding-mode.rs +++ b/src/test/compile-fail/resolve-inconsistent-binding-mode.rs @@ -14,33 +14,33 @@ enum opts { fn matcher1(x: opts) { match x { - a(ref i) | b(i) => {} + opts::a(ref i) | opts::b(i) => {} //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 - c(_) => {} + opts::c(_) => {} } } fn matcher2(x: opts) { match x { - a(ref i) | b(i) => {} + opts::a(ref i) | opts::b(i) => {} //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 - c(_) => {} + opts::c(_) => {} } } fn matcher4(x: opts) { match x { - a(ref mut i) | b(ref i) => {} + opts::a(ref mut i) | opts::b(ref i) => {} //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1 - c(_) => {} + opts::c(_) => {} } } fn matcher5(x: opts) { match x { - a(ref i) | b(ref i) => {} - c(_) => {} + opts::a(ref i) | opts::b(ref i) => {} + opts::c(_) => {} } } diff --git a/src/test/compile-fail/static-mut-not-pat.rs b/src/test/compile-fail/static-mut-not-pat.rs index b3ffcb0b98967..de93422cd7a08 100644 --- a/src/test/compile-fail/static-mut-not-pat.rs +++ b/src/test/compile-fail/static-mut-not-pat.rs @@ -38,16 +38,16 @@ struct Foo { baz: NewBool } -static mut STATIC_MUT_FOO: Foo = Foo { bar: Some(West), baz: NEW_FALSE }; +static mut STATIC_MUT_FOO: Foo = Foo { bar: Some(Direction::West), baz: NEW_FALSE }; fn mutable_statics() { - match (Foo { bar: Some(North), baz: NewBool(true) }) { + match (Foo { bar: Some(Direction::North), baz: NewBool(true) }) { Foo { bar: None, baz: NewBool(true) } => (), STATIC_MUT_FOO => (), //~^ ERROR static variables cannot be referenced in a pattern - Foo { bar: Some(South), .. } => (), + Foo { bar: Some(Direction::South), .. } => (), Foo { bar: Some(EAST), .. } => (), - Foo { bar: Some(North), baz: NewBool(true) } => (), + Foo { bar: Some(Direction::North), baz: NewBool(true) } => (), Foo { bar: Some(EAST), baz: NewBool(false) } => () } } diff --git a/src/test/compile-fail/struct-like-enum-nonexhaustive.rs b/src/test/compile-fail/struct-like-enum-nonexhaustive.rs index 91709e2ea7da0..1115d78e5608d 100644 --- a/src/test/compile-fail/struct-like-enum-nonexhaustive.rs +++ b/src/test/compile-fail/struct-like-enum-nonexhaustive.rs @@ -14,9 +14,9 @@ enum A { } fn main() { - let x = B { x: Some(3) }; + let x = A::B { x: Some(3) }; match x { //~ ERROR non-exhaustive patterns - C => {} - B { x: None } => {} + A::C => {} + A::B { x: None } => {} } } diff --git a/src/test/compile-fail/tag-variant-cast-non-nullary.rs b/src/test/compile-fail/tag-variant-cast-non-nullary.rs index d071e13145886..1d05c5d181da5 100644 --- a/src/test/compile-fail/tag-variant-cast-non-nullary.rs +++ b/src/test/compile-fail/tag-variant-cast-non-nullary.rs @@ -16,6 +16,6 @@ enum non_nullary { } fn main() { - let v = nullary; + let v = non_nullary::nullary; let val = v as int; } diff --git a/src/test/compile-fail/unreachable-arm.rs b/src/test/compile-fail/unreachable-arm.rs index e356f87af69d5..3ff6c733026b5 100644 --- a/src/test/compile-fail/unreachable-arm.rs +++ b/src/test/compile-fail/unreachable-arm.rs @@ -13,4 +13,4 @@ enum foo { a(Box, int), b(uint), } -fn main() { match b(1u) { b(_) | a(box _, 1) => { } a(_, 1) => { } } } +fn main() { match foo::b(1u) { foo::b(_) | foo::a(box _, 1) => { } foo::a(_, 1) => { } } } diff --git a/src/test/compile-fail/unused-attr.rs b/src/test/compile-fail/unused-attr.rs index e797c7eec5f5f..786421c4ef9d4 100644 --- a/src/test/compile-fail/unused-attr.rs +++ b/src/test/compile-fail/unused-attr.rs @@ -37,7 +37,7 @@ mod foo { fn bar(f: foo::Foo) { match f { #[foo] //~ ERROR unused attribute - foo::Bar => {} + foo::Foo::Bar => {} } } diff --git a/src/test/debuginfo/borrowed-c-style-enum.rs b/src/test/debuginfo/borrowed-c-style-enum.rs index 214819682f0ae..bbda6c93ebaf9 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 77dd502e113c4..d1ace0fbe3d33 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 098695f145966..78101d669dc99 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 1c76540f9dcac..17e4110c2f1d3 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 2f3981bd9dcc2..fec1d1b278901 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 959c423119ac7..17e1651f9f6ed 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 00069bae7cf1a..58db37888e6d7 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 d264027b27fe2..8abb2cd5c26f9 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 b8e7ade5d4bb8..00b157d49d117 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 698fc3d9d7db3..fe5c13e4b8d5d 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 d359f73e483fe..74d5dd2adc800 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 f3ea185650267..399d9fabd7a1f 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 c6adce78195a1..7b8526adba769 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 dd55435ea442a..b0c01ecce08c2 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 { Empty, Val { val: T } diff --git a/src/test/debuginfo/struct-in-enum.rs b/src/test/debuginfo/struct-in-enum.rs index a2fb87f7b2b3f..68281cb223028 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 2bf85cec2b796..899b43ad55963 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 d4428d7662dfe..07a0f16960611 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 71563f843b0e8..e7664d1029bd8 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 { diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs index 32b1bebee19e2..0178534074413 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 } diff --git a/src/test/run-make/graphviz-flowgraph/f13.dot-expected.dot b/src/test/run-make/graphviz-flowgraph/f13.dot-expected.dot index aa43ef515343a..76e6651351562 100644 --- a/src/test/run-make/graphviz-flowgraph/f13.dot-expected.dot +++ b/src/test/run-make/graphviz-flowgraph/f13.dot-expected.dot @@ -1,29 +1,29 @@ digraph block { N0[label="entry"]; N1[label="exit"]; - N2[label="expr E13b"]; + N2[label="expr E13::E13b"]; N3[label="expr 13"]; - N4[label="expr E13b(13)"]; + N4[label="expr E13::E13b(13)"]; N5[label="local x"]; - N6[label="stmt let x = E13b(13);"]; + N6[label="stmt let x = E13::E13b(13);"]; N7[label="local _y"]; N8[label="stmt let _y;"]; N9[label="expr x"]; - N10[label="expr match x { E13a => _y = 1, E13b(v) => _y = v + 1, }"]; + N10[label="expr match x { E13::E13a => _y = 1, E13::E13b(v) => _y = v + 1, }"]; N11[label="(dummy_node)"]; - N12[label="local E13a"]; + N12[label="pat E13::E13a"]; N13[label="expr 1"]; N14[label="expr _y"]; N15[label="expr _y = 1"]; N16[label="(dummy_node)"]; N17[label="local v"]; - N18[label="pat E13b(v)"]; + N18[label="pat E13::E13b(v)"]; N19[label="expr v"]; N20[label="expr 1"]; N21[label="expr v + 1"]; N22[label="expr _y"]; N23[label="expr _y = v + 1"]; - N24[label="block {\l let x = E13b(13);\l let _y;\l match x { E13a => _y = 1, E13b(v) => _y = v + 1, }\l}\l"]; + N24[label="block {\l let x = E13::E13b(13);\l let _y;\l match x { E13::E13a => _y = 1, E13::E13b(v) => _y = v + 1, }\l}\l"]; N0 -> N2; N2 -> N3; N3 -> N4; diff --git a/src/test/run-make/graphviz-flowgraph/f13.rs b/src/test/run-make/graphviz-flowgraph/f13.rs index 0817a3210ce42..fdda50b431201 100644 --- a/src/test/run-make/graphviz-flowgraph/f13.rs +++ b/src/test/run-make/graphviz-flowgraph/f13.rs @@ -10,9 +10,9 @@ enum E13 { E13a, E13b(int) } pub fn expr_match_13() { - let x = E13b(13); let _y; + let x = E13::E13b(13); let _y; match x { - E13a => _y = 1, - E13b(v) => _y = v + 1, + E13::E13a => _y = 1, + E13::E13b(v) => _y = v + 1, } } diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index bf5cc833d32f9..61c5312f234c2 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -48,11 +48,11 @@ enum En { fn main() { let x = Foo { f: 237 }; let _f = x.bar(); - let en = Var2; + let en = En::Var2; let _ = match en { - Var1 => x.bar(), - Var2 => 34, - Var3(x, y, f) => f.bar() + En::Var1 => x.bar(), + En::Var2 => 34, + En::Var3(x, y, f) => f.bar() }; } diff --git a/src/test/run-pass-fulldeps/macro-crate.rs b/src/test/run-pass-fulldeps/macro-crate.rs index 1e796d9d724c6..e9b712c914dc5 100644 --- a/src/test/run-pass-fulldeps/macro-crate.rs +++ b/src/test/run-pass-fulldeps/macro-crate.rs @@ -24,7 +24,7 @@ pub fn main() { assert_eq!(1, make_a_1!()); assert_eq!(2, exported_macro!()); - assert_eq!(Bar, Bar); + assert_eq!(Foo::Bar, Foo::Bar); test(None::); } diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index 08522ee6b80c1..fc8c04598ea2a 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -20,4 +20,4 @@ fn mk_raw_ty(st: sty, cname: Option) -> RawT { return RawT {struct_: st, cname: cname, hash: 0u}; } -pub fn main() { mk_raw_ty(ty_nil, None::); } +pub fn main() { mk_raw_ty(sty::ty_nil, None::); } diff --git a/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs b/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs index 415c660221d40..822db63971e21 100644 --- a/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs +++ b/src/test/run-pass/borrowck-macro-interaction-issue-6304.rs @@ -27,11 +27,11 @@ impl Foo { macro_rules! declare( ($id:expr, $rest:expr) => ({ self.check_id($id); - box Bar2($id, $rest) + box Bar::Bar2($id, $rest) }) ); match s { - box Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)), + box Bar::Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)), _ => panic!() } } diff --git a/src/test/run-pass/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck-univariant-enum.rs index 129fa8bf7d926..3d191f6c4b469 100644 --- a/src/test/run-pass/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck-univariant-enum.rs @@ -21,9 +21,9 @@ pub fn main() { // specially. let x = &Cell::new(5); - let y = &Cell::new(newvar(3)); + let y = &Cell::new(newtype::newvar(3)); let z = match y.get() { - newvar(b) => { + newtype::newvar(b) => { x.set(x.get() + 1); x.get() * b } diff --git a/src/test/run-pass/cfg-match-arm.rs b/src/test/run-pass/cfg-match-arm.rs index 9858b804b7b3a..02f02862f6884 100644 --- a/src/test/run-pass/cfg-match-arm.rs +++ b/src/test/run-pass/cfg-match-arm.rs @@ -15,9 +15,9 @@ enum Foo { fn foo(f: Foo) { match f { - Bar => {}, + Foo::Bar => {}, #[cfg(not(asdfa))] - Baz => {}, + Foo::Baz => {}, #[cfg(afsd)] Basdfwe => {} } diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index b5892c3f12305..a0d35fd596b53 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -106,9 +106,9 @@ pub fn main() { for _ in range(1u, 5) { nyan.speak(); } assert!(*nyan.find(&1).unwrap() == "nyan".to_string()); assert_eq!(nyan.find(&10), None); - let mut spotty: cat = cat::new(2, 57, tuxedo); + let mut spotty: cat = cat::new(2, 57, cat_type::tuxedo); for _ in range(0u, 6) { spotty.speak(); } assert_eq!(spotty.len(), 8); assert!((spotty.contains_key(&2))); - assert_eq!(spotty.get(&3), &tuxedo); + assert_eq!(spotty.get(&3), &cat_type::tuxedo); } diff --git a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs index 97134a9d38937..771b34159f261 100644 --- a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs +++ b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs @@ -41,7 +41,7 @@ fn get_bar(x: uint) -> Vec { vec!(x * 2) } pub fn fails() { let x = 2; let mut y = Vec::new(); - y.push(box Bickwick(do_it(get_bar(x).as_slice()))); + y.push(box Conzabble::Bickwick(do_it(get_bar(x).as_slice()))); } pub fn main() { diff --git a/src/test/run-pass/coerce-to-closure-and-proc.rs b/src/test/run-pass/coerce-to-closure-and-proc.rs index 44a3517cc758a..6dbc402e7852c 100644 --- a/src/test/run-pass/coerce-to-closure-and-proc.rs +++ b/src/test/run-pass/coerce-to-closure-and-proc.rs @@ -33,11 +33,11 @@ pub fn main() { let f: proc(int) -> Foo = Foo; assert_eq!(f(5), Foo(5)); - let f: |int| -> Bar = Baz; - assert_eq!(f(5), Baz(5)); + let f: |int| -> Bar = Bar::Baz; + assert_eq!(f(5), Bar::Baz(5)); - let f: proc(int) -> Bar = Baz; - assert_eq!(f(5), Baz(5)); + let f: proc(int) -> Bar = Bar::Baz; + assert_eq!(f(5), Bar::Baz(5)); let f: |int| -> Option = Some; assert_eq!(f(5), Some(5)); diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index e5891b2f48dff..178fc3dcd4f0d 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -87,7 +87,7 @@ pub fn main() { // if they had the bogus definition assert!((b)); let _x: t = true; - let _y: tg = bar; + let _y: tg = tg::bar; test_in_fn_ctxt(); } diff --git a/src/test/run-pass/const-big-enum.rs b/src/test/run-pass/const-big-enum.rs index 1b9bd5e5692af..ca1d79e83e92c 100644 --- a/src/test/run-pass/const-big-enum.rs +++ b/src/test/run-pass/const-big-enum.rs @@ -14,19 +14,19 @@ enum Foo { Quux(u64, u16) } -static X: Foo = Baz; +static X: Foo = Foo::Baz; pub fn main() { match X { - Baz => {} + Foo::Baz => {} _ => panic!() } match Y { - Bar(s) => assert!(s == 2654435769), + Foo::Bar(s) => assert!(s == 2654435769), _ => panic!() } match Z { - Quux(d,h) => { + Foo::Quux(d,h) => { assert_eq!(d, 0x123456789abcdef0); assert_eq!(h, 0x1234); } @@ -34,5 +34,5 @@ pub fn main() { } } -static Y: Foo = Bar(2654435769); -static Z: Foo = Quux(0x123456789abcdef0, 0x1234); +static Y: Foo = Foo::Bar(2654435769); +static Z: Foo = Foo::Quux(0x123456789abcdef0, 0x1234); diff --git a/src/test/run-pass/const-enum-byref-self.rs b/src/test/run-pass/const-enum-byref-self.rs index 465830c6e1298..25145bf363840 100644 --- a/src/test/run-pass/const-enum-byref-self.rs +++ b/src/test/run-pass/const-enum-byref-self.rs @@ -9,13 +9,13 @@ // except according to those terms. enum E { V, VV(int) } -static C: E = V; +static C: E = E::V; impl E { pub fn method(&self) { match *self { - V => {} - VV(..) => panic!() + E::V => {} + E::VV(..) => panic!() } } } diff --git a/src/test/run-pass/const-enum-byref.rs b/src/test/run-pass/const-enum-byref.rs index 4cad4acf147ff..bc5daf41646b8 100644 --- a/src/test/run-pass/const-enum-byref.rs +++ b/src/test/run-pass/const-enum-byref.rs @@ -9,12 +9,12 @@ // except according to those terms. enum E { V, VV(int) } -static C: E = V; +static C: E = E::V; fn f(a: &E) { match *a { - V => {} - VV(..) => panic!() + E::V => {} + E::VV(..) => panic!() } } diff --git a/src/test/run-pass/const-enum-cast.rs b/src/test/run-pass/const-enum-cast.rs index 346d379aa1431..966effab33e68 100644 --- a/src/test/run-pass/const-enum-cast.rs +++ b/src/test/run-pass/const-enum-cast.rs @@ -12,10 +12,10 @@ enum A { A1, A2 } enum B { B1=0, B2=2 } pub fn main () { - static c1: int = A2 as int; - static c2: int = B2 as int; - let a1 = A2 as int; - let a2 = B2 as int; + static c1: int = A::A2 as int; + static c2: int = B::B2 as int; + let a1 = A::A2 as int; + let a2 = B::B2 as int; assert_eq!(c1, 1); assert_eq!(c2, 2); assert_eq!(a1, 1); diff --git a/src/test/run-pass/const-enum-ptr.rs b/src/test/run-pass/const-enum-ptr.rs index 02d8fcf201d83..0953f35e4483e 100644 --- a/src/test/run-pass/const-enum-ptr.rs +++ b/src/test/run-pass/const-enum-ptr.rs @@ -9,11 +9,11 @@ // except according to those terms. enum E { V0, V1(int) } -static C: &'static E = &V0; +static C: &'static E = &E::V0; pub fn main() { match *C { - V0 => (), + E::V0 => (), _ => panic!() } } diff --git a/src/test/run-pass/const-enum-struct.rs b/src/test/run-pass/const-enum-struct.rs index 3229293fd7a46..0c3656e193cb7 100644 --- a/src/test/run-pass/const-enum-struct.rs +++ b/src/test/run-pass/const-enum-struct.rs @@ -10,7 +10,7 @@ enum E { V16(u16), V32(u32) } struct S { a: E, b: u16, c: u16 } -static C: S = S { a: V16(0xDEAD), b: 0x600D, c: 0xBAD }; +static C: S = S { a: E::V16(0xDEAD), b: 0x600D, c: 0xBAD }; pub fn main() { let n = C.b; diff --git a/src/test/run-pass/const-enum-struct2.rs b/src/test/run-pass/const-enum-struct2.rs index 4530a65002772..6996da8bc37e2 100644 --- a/src/test/run-pass/const-enum-struct2.rs +++ b/src/test/run-pass/const-enum-struct2.rs @@ -10,7 +10,7 @@ enum E { V0, V16(u16) } struct S { a: E, b: u16, c: u16 } -static C: S = S { a: V0, b: 0x600D, c: 0xBAD }; +static C: S = S { a: E::V0, b: 0x600D, c: 0xBAD }; pub fn main() { let n = C.b; diff --git a/src/test/run-pass/const-enum-structlike.rs b/src/test/run-pass/const-enum-structlike.rs index 3cd7db69f074a..fa32df2db7392 100644 --- a/src/test/run-pass/const-enum-structlike.rs +++ b/src/test/run-pass/const-enum-structlike.rs @@ -15,11 +15,11 @@ enum E { S1 { u: uint } } -static C: E = S1 { u: 23 }; +static C: E = E::S1 { u: 23 }; pub fn main() { match C { - S0 { .. } => panic!(), - S1 { u } => assert!(u == 23) + E::S0 { .. } => panic!(), + E::S1 { u } => assert!(u == 23) } } diff --git a/src/test/run-pass/const-enum-tuple.rs b/src/test/run-pass/const-enum-tuple.rs index 17d8341457d35..7ea5a3fed7655 100644 --- a/src/test/run-pass/const-enum-tuple.rs +++ b/src/test/run-pass/const-enum-tuple.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V16(u16), V32(u32) } -static C: (E, u16, u16) = (V16(0xDEAD), 0x600D, 0xBAD); +static C: (E, u16, u16) = (E::V16(0xDEAD), 0x600D, 0xBAD); pub fn main() { let (_, n, _) = C; diff --git a/src/test/run-pass/const-enum-tuple2.rs b/src/test/run-pass/const-enum-tuple2.rs index 5d7a161720c18..968c45a3298db 100644 --- a/src/test/run-pass/const-enum-tuple2.rs +++ b/src/test/run-pass/const-enum-tuple2.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V0, V16(u16) } -static C: (E, u16, u16) = (V0, 0x600D, 0xBAD); +static C: (E, u16, u16) = (E::V0, 0x600D, 0xBAD); pub fn main() { let (_, n, _) = C; diff --git a/src/test/run-pass/const-enum-tuplestruct.rs b/src/test/run-pass/const-enum-tuplestruct.rs index 40137afa2eee2..697321e0c77e4 100644 --- a/src/test/run-pass/const-enum-tuplestruct.rs +++ b/src/test/run-pass/const-enum-tuplestruct.rs @@ -10,7 +10,7 @@ enum E { V16(u16), V32(u32) } struct S(E, u16, u16); -static C: S = S(V16(0xDEAD), 0x600D, 0xBAD); +static C: S = S(E::V16(0xDEAD), 0x600D, 0xBAD); pub fn main() { let S(_, n, _) = C; diff --git a/src/test/run-pass/const-enum-tuplestruct2.rs b/src/test/run-pass/const-enum-tuplestruct2.rs index f6345efcb4348..254580c4e69d1 100644 --- a/src/test/run-pass/const-enum-tuplestruct2.rs +++ b/src/test/run-pass/const-enum-tuplestruct2.rs @@ -10,7 +10,7 @@ enum E { V0, V16(u16) } struct S(E, u16, u16); -static C: S = S(V0, 0x600D, 0xBAD); +static C: S = S(E::V0, 0x600D, 0xBAD); pub fn main() { let S(_, n, _) = C; diff --git a/src/test/run-pass/const-enum-vec-index.rs b/src/test/run-pass/const-enum-vec-index.rs index 9177cad9d6241..fef6c8624cf71 100644 --- a/src/test/run-pass/const-enum-vec-index.rs +++ b/src/test/run-pass/const-enum-vec-index.rs @@ -9,29 +9,29 @@ // except according to those terms. enum E { V1(int), V0 } -const C: &'static [E] = &[V0, V1(0xDEADBEE)]; +const C: &'static [E] = &[E::V0, E::V1(0xDEADBEE)]; static C0: E = C[0]; static C1: E = C[1]; -const D: &'static [E, ..2] = &[V0, V1(0xDEADBEE)]; +const D: &'static [E, ..2] = &[E::V0, E::V1(0xDEADBEE)]; static D0: E = C[0]; static D1: E = C[1]; pub fn main() { match C0 { - V0 => (), + E::V0 => (), _ => panic!() } match C1 { - V1(n) => assert!(n == 0xDEADBEE), + E::V1(n) => assert!(n == 0xDEADBEE), _ => panic!() } match D0 { - V0 => (), + E::V0 => (), _ => panic!() } match D1 { - V1(n) => assert!(n == 0xDEADBEE), + E::V1(n) => assert!(n == 0xDEADBEE), _ => panic!() } } diff --git a/src/test/run-pass/const-enum-vec-ptr.rs b/src/test/run-pass/const-enum-vec-ptr.rs index 8723b2815dabe..d5c299fd86eec 100644 --- a/src/test/run-pass/const-enum-vec-ptr.rs +++ b/src/test/run-pass/const-enum-vec-ptr.rs @@ -9,15 +9,15 @@ // except according to those terms. enum E { V1(int), V0 } -static C: &'static [E] = &[V0, V1(0xDEADBEE), V0]; +static C: &'static [E] = &[E::V0, E::V1(0xDEADBEE), E::V0]; pub fn main() { match C[1] { - V1(n) => assert!(n == 0xDEADBEE), + E::V1(n) => assert!(n == 0xDEADBEE), _ => panic!() } match C[2] { - V0 => (), + E::V0 => (), _ => panic!() } } diff --git a/src/test/run-pass/const-enum-vector.rs b/src/test/run-pass/const-enum-vector.rs index e94e1de2e2d1e..83687f8775b34 100644 --- a/src/test/run-pass/const-enum-vector.rs +++ b/src/test/run-pass/const-enum-vector.rs @@ -9,15 +9,15 @@ // except according to those terms. enum E { V1(int), V0 } -static C: [E, ..3] = [V0, V1(0xDEADBEE), V0]; +static C: [E, ..3] = [E::V0, E::V1(0xDEADBEE), E::V0]; pub fn main() { match C[1] { - V1(n) => assert!(n == 0xDEADBEE), + E::V1(n) => assert!(n == 0xDEADBEE), _ => panic!() } match C[2] { - V0 => (), + E::V0 => (), _ => panic!() } } diff --git a/src/test/run-pass/const-nullary-enum.rs b/src/test/run-pass/const-nullary-enum.rs index 2d023317db623..5397a29311a01 100644 --- a/src/test/run-pass/const-nullary-enum.rs +++ b/src/test/run-pass/const-nullary-enum.rs @@ -14,17 +14,17 @@ enum Foo { Boo, } -static X: Foo = Bar; +static X: Foo = Foo::Bar; pub fn main() { match X { - Bar => {} - Baz | Boo => panic!() + Foo::Bar => {} + Foo::Baz | Foo::Boo => panic!() } match Y { - Baz => {} - Bar | Boo => panic!() + Foo::Baz => {} + Foo::Bar | Foo::Boo => panic!() } } -static Y: Foo = Baz; +static Y: Foo = Foo::Baz; diff --git a/src/test/run-pass/const-nullary-univariant-enum.rs b/src/test/run-pass/const-nullary-univariant-enum.rs index 30fbe38aed033..fe171a9f73dc7 100644 --- a/src/test/run-pass/const-nullary-univariant-enum.rs +++ b/src/test/run-pass/const-nullary-univariant-enum.rs @@ -12,11 +12,11 @@ enum Foo { Bar = 0xDEADBEE } -static X: Foo = Bar; +static X: Foo = Foo::Bar; pub fn main() { assert_eq!((X as uint), 0xDEADBEE); assert_eq!((Y as uint), 0xDEADBEE); } -static Y: Foo = Bar; +static Y: Foo = Foo::Bar; diff --git a/src/test/run-pass/const-struct-offsets.rs b/src/test/run-pass/const-struct-offsets.rs index b79d9d6beba87..98dbf1eaa69a4 100644 --- a/src/test/run-pass/const-struct-offsets.rs +++ b/src/test/run-pass/const-struct-offsets.rs @@ -18,6 +18,6 @@ struct Bar { v: Foo } -static bar: Bar = Bar { i: 0, v: IntVal(0) }; +static bar: Bar = Bar { i: 0, v: Foo::IntVal(0) }; pub fn main() {} diff --git a/src/test/run-pass/deriving-clone-enum.rs b/src/test/run-pass/deriving-clone-enum.rs index 1cc20f4e3da0b..875dfa42b5974 100644 --- a/src/test/run-pass/deriving-clone-enum.rs +++ b/src/test/run-pass/deriving-clone-enum.rs @@ -16,5 +16,5 @@ enum E { } pub fn main() { - let _ = A.clone(); + let _ = E::A.clone(); } diff --git a/src/test/run-pass/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving-clone-generic-enum.rs index 1f2e7711eb0ee..34892fb0a3ba1 100644 --- a/src/test/run-pass/deriving-clone-generic-enum.rs +++ b/src/test/run-pass/deriving-clone-generic-enum.rs @@ -16,5 +16,5 @@ enum E { } pub fn main() { - let _ = A::(1i).clone(); + let _ = E::A::(1i).clone(); } diff --git a/src/test/run-pass/deriving-cmp-generic-enum.rs b/src/test/run-pass/deriving-cmp-generic-enum.rs index ccd0d967a51e8..e8b4eec2668f0 100644 --- a/src/test/run-pass/deriving-cmp-generic-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-enum.rs @@ -18,11 +18,11 @@ enum E { } pub fn main() { - let e0 = E0; - let e11 = E1(1i); - let e12 = E1(2i); - let e21 = E2(1i, 1i); - let e22 = E2(1i, 2i); + let e0 = E::E0; + let e11 = E::E1(1i); + let e12 = E::E1(2i); + let e21 = E::E2(1i, 1i); + let e22 = E::E2(1i, 2i); // in order for both PartialOrd and Ord let es = [e0, e11, e12, e21, e22]; diff --git a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs index 2abdf4c7c7e01..a7be1c4b37d83 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs @@ -20,14 +20,14 @@ enum ES { pub fn main() { - let (es11, es12, es21, es22) = (ES1 { + let (es11, es12, es21, es22) = (ES::ES1 { x: 1i - }, ES1 { + }, ES::ES1 { x: 2i - }, ES2 { + }, ES::ES2 { x: 1i, y: 1i - }, ES2 { + }, ES::ES2 { x: 1i, y: 2i }); diff --git a/src/test/run-pass/deriving-primitive.rs b/src/test/run-pass/deriving-primitive.rs index 22d40f30dc8fc..438baef62e50c 100644 --- a/src/test/run-pass/deriving-primitive.rs +++ b/src/test/run-pass/deriving-primitive.rs @@ -21,16 +21,16 @@ enum A { pub fn main() { let x: Option = FromPrimitive::from_int(int::MAX); - assert_eq!(x, Some(Foo)); + assert_eq!(x, Some(A::Foo)); let x: Option = FromPrimitive::from_int(1); - assert_eq!(x, Some(Bar)); + assert_eq!(x, Some(A::Bar)); let x: Option = FromPrimitive::from_int(3); - assert_eq!(x, Some(Baz)); + assert_eq!(x, Some(A::Baz)); let x: Option = FromPrimitive::from_int(4); - assert_eq!(x, Some(Qux)); + assert_eq!(x, Some(A::Qux)); let x: Option = FromPrimitive::from_int(5); assert_eq!(x, None); diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs index fa82e42d793f0..5880066dcece3 100644 --- a/src/test/run-pass/deriving-show-2.rs +++ b/src/test/run-pass/deriving-show-2.rs @@ -41,11 +41,11 @@ impl fmt::Show for Custom { } pub fn main() { - assert_eq!(B1.to_string(), "B1".to_string()); - assert_eq!(B2.to_string(), "B2".to_string()); - assert_eq!(C1(3).to_string(), "C1(3)".to_string()); - assert_eq!(C2(B2).to_string(), "C2(B2)".to_string()); - assert_eq!(D1{ a: 2 }.to_string(), "D1 { a: 2 }".to_string()); + assert_eq!(B::B1.to_string(), "B1".to_string()); + assert_eq!(B::B2.to_string(), "B2".to_string()); + assert_eq!(C::C1(3).to_string(), "C1(3)".to_string()); + assert_eq!(C::C2(B::B2).to_string(), "C2(B2)".to_string()); + assert_eq!(D::D1{ a: 2 }.to_string(), "D1 { a: 2 }".to_string()); assert_eq!(E.to_string(), "E".to_string()); assert_eq!(F(3).to_string(), "F(3)".to_string()); assert_eq!(G(3, 4).to_string(), "G(3, 4)".to_string()); diff --git a/src/test/run-pass/deriving-show.rs b/src/test/run-pass/deriving-show.rs index a44bb61a1ccd8..1107986c42ba2 100644 --- a/src/test/run-pass/deriving-show.rs +++ b/src/test/run-pass/deriving-show.rs @@ -36,7 +36,7 @@ pub fn main() { t!(Unit, "Unit"); t!(Tuple(1, 2), "Tuple(1, 2)"); t!(Struct { x: 1, y: 2 }, "Struct { x: 1, y: 2 }"); - t!(Nullary, "Nullary"); - t!(Variant(1, 2), "Variant(1, 2)"); - t!(StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }"); + t!(Enum::Nullary, "Nullary"); + t!(Enum::Variant(1, 2), "Variant(1, 2)"); + t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }"); } diff --git a/src/test/run-pass/deriving-via-extension-c-enum.rs b/src/test/run-pass/deriving-via-extension-c-enum.rs index 3665a0a79fa06..ebbf7972f9cac 100644 --- a/src/test/run-pass/deriving-via-extension-c-enum.rs +++ b/src/test/run-pass/deriving-via-extension-c-enum.rs @@ -16,8 +16,8 @@ enum Foo { } pub fn main() { - let a = Bar; - let b = Bar; + let a = Foo::Bar; + let b = Foo::Bar; assert_eq!(a, b); assert!(!(a != b)); assert!(a.eq(&b)); diff --git a/src/test/run-pass/deriving-via-extension-enum.rs b/src/test/run-pass/deriving-via-extension-enum.rs index d34b17923c587..51aba88157a98 100644 --- a/src/test/run-pass/deriving-via-extension-enum.rs +++ b/src/test/run-pass/deriving-via-extension-enum.rs @@ -15,8 +15,8 @@ enum Foo { } pub fn main() { - let a = Bar(1, 2); - let b = Bar(1, 2); + let a = Foo::Bar(1, 2); + let b = Foo::Bar(1, 2); assert_eq!(a, b); assert!(!(a != b)); assert!(a.eq(&b)); diff --git a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs index b8cc6ccb69c24..790d002705b8c 100644 --- a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs +++ b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs @@ -17,7 +17,7 @@ enum S { } pub fn main() { - let x = X { x: 1, y: 2 }; + let x = S::X { x: 1, y: 2 }; assert_eq!(x, x); assert!(!(x != x)); } diff --git a/src/test/run-pass/drop-on-empty-block-exit.rs b/src/test/run-pass/drop-on-empty-block-exit.rs index c52549d286fd5..e3927bd536773 100644 --- a/src/test/run-pass/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop-on-empty-block-exit.rs @@ -12,6 +12,6 @@ enum t { foo(Box), } pub fn main() { - let tt = foo(box 10); - match tt { foo(_z) => { } } + let tt = t::foo(box 10); + match tt { t::foo(_z) => { } } } diff --git a/src/test/run-pass/drop-trait-enum.rs b/src/test/run-pass/drop-trait-enum.rs index 6f4e927abd5da..fb543c86d5dad 100644 --- a/src/test/run-pass/drop-trait-enum.rs +++ b/src/test/run-pass/drop-trait-enum.rs @@ -24,7 +24,7 @@ struct SendOnDrop { impl Drop for SendOnDrop { fn drop(&mut self) { - self.sender.send(Dropped); + self.sender.send(Message::Dropped); } } @@ -37,13 +37,13 @@ enum Foo { impl Drop for Foo { fn drop(&mut self) { match self { - &SimpleVariant(ref mut sender) => { - sender.send(DestructorRan); + &Foo::SimpleVariant(ref mut sender) => { + sender.send(Message::DestructorRan); } - &NestedVariant(_, _, ref mut sender) => { - sender.send(DestructorRan); + &Foo::NestedVariant(_, _, ref mut sender) => { + sender.send(Message::DestructorRan); } - &FailingVariant { .. } => { + &Foo::FailingVariant { .. } => { panic!("Failed"); } } @@ -53,42 +53,42 @@ impl Drop for Foo { pub fn main() { let (sender, receiver) = channel(); { - let v = SimpleVariant(sender); + let v = Foo::SimpleVariant(sender); } - assert_eq!(receiver.recv(), DestructorRan); + assert_eq!(receiver.recv(), Message::DestructorRan); assert_eq!(receiver.recv_opt().ok(), None); let (sender, receiver) = channel(); { - let v = NestedVariant(box 42u, SendOnDrop { sender: sender.clone() }, sender); + let v = Foo::NestedVariant(box 42u, SendOnDrop { sender: sender.clone() }, sender); } - assert_eq!(receiver.recv(), DestructorRan); - assert_eq!(receiver.recv(), Dropped); + assert_eq!(receiver.recv(), Message::DestructorRan); + assert_eq!(receiver.recv(), Message::Dropped); assert_eq!(receiver.recv_opt().ok(), None); let (sender, receiver) = channel(); task::spawn(proc() { - let v = FailingVariant { on_drop: SendOnDrop { sender: sender } }; + let v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; }); - assert_eq!(receiver.recv(), Dropped); + assert_eq!(receiver.recv(), Message::Dropped); assert_eq!(receiver.recv_opt().ok(), None); let (sender, receiver) = channel(); { task::spawn(proc() { - let mut v = NestedVariant(box 42u, SendOnDrop { + let mut v = Foo::NestedVariant(box 42u, SendOnDrop { sender: sender.clone() }, sender.clone()); - v = NestedVariant(box 42u, SendOnDrop { sender: sender.clone() }, sender.clone()); - v = SimpleVariant(sender.clone()); - v = FailingVariant { on_drop: SendOnDrop { sender: sender } }; + v = Foo::NestedVariant(box 42u, SendOnDrop { sender: sender.clone() }, sender.clone()); + v = Foo::SimpleVariant(sender.clone()); + v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; }); } - assert_eq!(receiver.recv(), DestructorRan); - assert_eq!(receiver.recv(), Dropped); - assert_eq!(receiver.recv(), DestructorRan); - assert_eq!(receiver.recv(), Dropped); - assert_eq!(receiver.recv(), DestructorRan); - assert_eq!(receiver.recv(), Dropped); + assert_eq!(receiver.recv(), Message::DestructorRan); + assert_eq!(receiver.recv(), Message::Dropped); + assert_eq!(receiver.recv(), Message::DestructorRan); + assert_eq!(receiver.recv(), Message::Dropped); + assert_eq!(receiver.recv(), Message::DestructorRan); + assert_eq!(receiver.recv(), Message::Dropped); assert_eq!(receiver.recv_opt().ok(), None); } diff --git a/src/test/run-pass/empty-tag.rs b/src/test/run-pass/empty-tag.rs index 64571be341802..6b780d854599e 100644 --- a/src/test/run-pass/empty-tag.rs +++ b/src/test/run-pass/empty-tag.rs @@ -19,10 +19,10 @@ impl PartialEq for chan { } fn wrapper3(i: chan) { - assert_eq!(i, chan_t); + assert_eq!(i, chan::chan_t); } pub fn main() { - let wrapped = {||wrapper3(chan_t)}; + let wrapped = {||wrapper3(chan::chan_t)}; wrapped(); } diff --git a/src/test/run-pass/enum-clike-ffi-as-int.rs b/src/test/run-pass/enum-clike-ffi-as-int.rs index 41e5381d73c2b..1cbcaac379f09 100644 --- a/src/test/run-pass/enum-clike-ffi-as-int.rs +++ b/src/test/run-pass/enum-clike-ffi-as-int.rs @@ -29,11 +29,11 @@ enum Foo { } #[inline(never)] -extern "C" fn foo(_x: uint) -> Foo { B } +extern "C" fn foo(_x: uint) -> Foo { Foo::B } pub fn main() { unsafe { let f: extern "C" fn(uint) -> u32 = ::std::mem::transmute(foo); - assert_eq!(f(0xDEADBEEF), B as u32); + assert_eq!(f(0xDEADBEEF), Foo::B as u32); } } diff --git a/src/test/run-pass/enum-discr.rs b/src/test/run-pass/enum-discr.rs index 5fe8bb27e1549..97997bec2616a 100644 --- a/src/test/run-pass/enum-discr.rs +++ b/src/test/run-pass/enum-discr.rs @@ -23,8 +23,8 @@ enum Hero { } pub fn main() { - let pet: Animal = Snake; - let hero: Hero = Superman; + let pet: Animal = Animal::Snake; + let hero: Hero = Hero::Superman; assert!(pet as uint == 3); assert!(hero as int == -2); } diff --git a/src/test/run-pass/enum-discrim-range-overflow.rs b/src/test/run-pass/enum-discrim-range-overflow.rs index 37e457d547bf9..b45040f6a1c53 100644 --- a/src/test/run-pass/enum-discrim-range-overflow.rs +++ b/src/test/run-pass/enum-discrim-range-overflow.rs @@ -19,12 +19,12 @@ pub enum E32 { pub fn f(e64: E64, e32: E32) -> (bool,bool) { (match e64 { - H64 => true, - L64 => false + E64::H64 => true, + E64::L64 => false }, match e32 { - H32 => true, - L32 => false + E32::H32 => true, + E32::L32 => false }) } diff --git a/src/test/run-pass/enum-discrim-width-stuff.rs b/src/test/run-pass/enum-discrim-width-stuff.rs index e079916814082..deb3f6b6c7c3e 100644 --- a/src/test/run-pass/enum-discrim-width-stuff.rs +++ b/src/test/run-pass/enum-discrim-width-stuff.rs @@ -19,12 +19,12 @@ macro_rules! check { V = $v, A = 0 } - static C: E = V; + static C: E = E::V; pub fn check() { assert_eq!(size_of::(), size_of::<$t>()); - assert_eq!(V as $t, $v as $t); + assert_eq!(E::V as $t, $v as $t); assert_eq!(C as $t, $v as $t); - assert_eq!(format!("{}", V), "V".to_string()); + assert_eq!(format!("{}", E::V), "V".to_string()); assert_eq!(format!("{}", C), "V".to_string()); } } diff --git a/src/test/run-pass/enum-disr-val-pretty.rs b/src/test/run-pass/enum-disr-val-pretty.rs index c34b2be6fb5e2..a4bd361f1828e 100644 --- a/src/test/run-pass/enum-disr-val-pretty.rs +++ b/src/test/run-pass/enum-disr-val-pretty.rs @@ -13,10 +13,10 @@ enum color { red = 1, green, blue, imaginary = -1, } pub fn main() { - test_color(red, 1, "red".to_string()); - test_color(green, 2, "green".to_string()); - test_color(blue, 3, "blue".to_string()); - test_color(imaginary, -1, "imaginary".to_string()); + test_color(color::red, 1, "red".to_string()); + test_color(color::green, 2, "green".to_string()); + test_color(color::blue, 3, "blue".to_string()); + test_color(color::imaginary, -1, "imaginary".to_string()); } fn test_color(color: color, val: int, _name: String) { diff --git a/src/test/run-pass/enum-export-inheritance.rs b/src/test/run-pass/enum-export-inheritance.rs index 09834269d0b7b..6330d6196a361 100644 --- a/src/test/run-pass/enum-export-inheritance.rs +++ b/src/test/run-pass/enum-export-inheritance.rs @@ -17,5 +17,5 @@ mod a { } pub fn main() { - let _x = a::Bar; + let _x = a::Foo::Bar; } diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs index d6cdce7390a60..7d856fd5656c7 100644 --- a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs @@ -17,9 +17,9 @@ enum List { Nil, Cons(X, Box>) } pub fn main() { - match Cons(10i, box Nil) { - Cons(10i, _) => {} - Nil => {} + match List::Cons(10i, box List::Nil) { + List::Cons(10i, _) => {} + List::Nil => {} _ => panic!() } } diff --git a/src/test/run-pass/enum-variants.rs b/src/test/run-pass/enum-variants.rs index 4e283b5480849..65e0e9ecb379d 100644 --- a/src/test/run-pass/enum-variants.rs +++ b/src/test/run-pass/enum-variants.rs @@ -18,8 +18,8 @@ enum Animal { } pub fn main() { - let mut a: Animal = Dog("Cocoa".to_string(), 37.2); - a = Cat{ name: "Spotty".to_string(), weight: 2.7 }; + let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2); + a = Animal::Cat{ name: "Spotty".to_string(), weight: 2.7 }; // permuting the fields should work too - let _c = Cat { weight: 3.1, name: "Spreckles".to_string() }; + let _c = Animal::Cat { weight: 3.1, name: "Spreckles".to_string() }; } diff --git a/src/test/run-pass/enum-vec-initializer.rs b/src/test/run-pass/enum-vec-initializer.rs index d51562d2490de..0256420ac4c3d 100644 --- a/src/test/run-pass/enum-vec-initializer.rs +++ b/src/test/run-pass/enum-vec-initializer.rs @@ -12,11 +12,11 @@ enum Flopsy { Bunny = 2 } -const BAR:uint = Bunny as uint; +const BAR:uint = Flopsy::Bunny as uint; const BAR2:uint = BAR; pub fn main() { - let _v = [0i, .. Bunny as uint]; + let _v = [0i, .. Flopsy::Bunny as uint]; let _v = [0i, .. BAR]; let _v = [0i, .. BAR2]; const BAR3:uint = BAR2; diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs index e95b1ed2f0efb..829870930a456 100644 --- a/src/test/run-pass/explicit-self-generic.rs +++ b/src/test/run-pass/explicit-self-generic.rs @@ -23,7 +23,7 @@ enum HashMap { } fn linear_map() -> HashMap { - HashMap_(LM{ + HashMap::HashMap_(LM{ resize_at: 32, size: 0}) } @@ -31,7 +31,7 @@ fn linear_map() -> HashMap { impl HashMap { pub fn len(&mut self) -> uint { match *self { - HashMap_(l) => l.size + HashMap::HashMap_(l) => l.size } } } diff --git a/src/test/run-pass/explicit-self.rs b/src/test/run-pass/explicit-self.rs index 32ac14ab18074..b13819717d791 100644 --- a/src/test/run-pass/explicit-self.rs +++ b/src/test/run-pass/explicit-self.rs @@ -20,8 +20,8 @@ enum shape { fn compute_area(shape: &shape) -> f64 { match *shape { - circle(_, radius) => 0.5 * tau * radius * radius, - rectangle(_, ref size) => size.w * size.h + shape::circle(_, radius) => 0.5 * tau * radius * radius, + shape::rectangle(_, ref size) => size.w * size.h } } @@ -36,7 +36,7 @@ impl shape { fn select_based_on_unit_circle<'r, T>( threshold: f64, a: &'r T, b: &'r T) -> &'r T { - let shape = &circle(Point{x: 0.0, y: 0.0}, 1.0); + let shape = &shape::circle(Point{x: 0.0, y: 0.0}, 1.0); shape.select(threshold, a, b) } diff --git a/src/test/run-pass/export-abstract-tag.rs b/src/test/run-pass/export-abstract-tag.rs index adc4b553d0959..983ebbee9872f 100644 --- a/src/test/run-pass/export-abstract-tag.rs +++ b/src/test/run-pass/export-abstract-tag.rs @@ -14,7 +14,7 @@ mod foo { pub enum t { t1, } - pub fn f() -> t { return t1; } + pub fn f() -> t { return t::t1; } } pub fn main() { let _v: foo::t = foo::f(); } diff --git a/src/test/run-pass/export-tag-variant.rs b/src/test/run-pass/export-tag-variant.rs index d0aa23e81fa1d..01fcf02ec12f6 100644 --- a/src/test/run-pass/export-tag-variant.rs +++ b/src/test/run-pass/export-tag-variant.rs @@ -12,4 +12,4 @@ mod foo { pub enum t { t1, } } -pub fn main() { let _v = foo::t1; } +pub fn main() { let _v = foo::t::t1; } diff --git a/src/test/run-pass/export-unexported-dep.rs b/src/test/run-pass/export-unexported-dep.rs index 49709fa72c669..3fc5310a29bc7 100644 --- a/src/test/run-pass/export-unexported-dep.rs +++ b/src/test/run-pass/export-unexported-dep.rs @@ -22,9 +22,9 @@ mod foo { fn ne(&self, other: &t) -> bool { !(*self).eq(other) } } - pub fn f() -> t { return t1; } + pub fn f() -> t { return t::t1; } - pub fn g(v: t) { assert!((v == t1)); } + pub fn g(v: t) { assert!((v == t::t1)); } } pub fn main() { foo::g(foo::f()); } diff --git a/src/test/run-pass/expr-if-struct.rs b/src/test/run-pass/expr-if-struct.rs index b0cc991f667e6..758d726851d07 100644 --- a/src/test/run-pass/expr-if-struct.rs +++ b/src/test/run-pass/expr-if-struct.rs @@ -32,8 +32,8 @@ impl PartialEq for mood { } fn test_tag() { - let rs = if true { happy } else { sad }; - assert_eq!(rs, happy); + let rs = if true { mood::happy } else { mood::sad }; + assert_eq!(rs, mood::happy); } pub fn main() { test_rec(); test_tag(); } diff --git a/src/test/run-pass/expr-match-struct.rs b/src/test/run-pass/expr-match-struct.rs index 21b0c28495e6b..ea96005dc602e 100644 --- a/src/test/run-pass/expr-match-struct.rs +++ b/src/test/run-pass/expr-match-struct.rs @@ -31,8 +31,8 @@ impl PartialEq for mood { } fn test_tag() { - let rs = match true { true => { happy } false => { sad } }; - assert_eq!(rs, happy); + let rs = match true { true => { mood::happy } false => { mood::sad } }; + assert_eq!(rs, mood::happy); } pub fn main() { test_rec(); test_tag(); } diff --git a/src/test/run-pass/fat-arrow-match.rs b/src/test/run-pass/fat-arrow-match.rs index a137aa5bd63dd..929d1c8e63d62 100644 --- a/src/test/run-pass/fat-arrow-match.rs +++ b/src/test/run-pass/fat-arrow-match.rs @@ -16,9 +16,9 @@ enum color { } pub fn main() { - println!("{}", match red { - red => { 1i } - green => { 2i } - blue => { 3i } + println!("{}", match color::red { + color::red => { 1i } + color::green => { 2i } + color::blue => { 3i } }); } diff --git a/src/test/run-pass/generic-ivec-leak.rs b/src/test/run-pass/generic-ivec-leak.rs index ac97a2aa9e854..48b61bf745d4b 100644 --- a/src/test/run-pass/generic-ivec-leak.rs +++ b/src/test/run-pass/generic-ivec-leak.rs @@ -10,4 +10,4 @@ enum wrapper { wrapped(T), } -pub fn main() { let _w = wrapped(vec!(1i, 2, 3, 4, 5)); } +pub fn main() { let _w = wrapper::wrapped(vec!(1i, 2, 3, 4, 5)); } diff --git a/src/test/run-pass/generic-recursive-tag.rs b/src/test/run-pass/generic-recursive-tag.rs index d8777515cecf0..b738b5271220a 100644 --- a/src/test/run-pass/generic-recursive-tag.rs +++ b/src/test/run-pass/generic-recursive-tag.rs @@ -15,8 +15,8 @@ enum list { cons(Box, Box>), nil, } pub fn main() { let _a: list = - cons::(box 10, - box cons::(box 12, - box cons::(box 13, - box nil::))); + list::cons::(box 10, + box list::cons::(box 12, + box list::cons::(box 13, + box list::nil::))); } diff --git a/src/test/run-pass/generic-tag-corruption.rs b/src/test/run-pass/generic-tag-corruption.rs index 52d7c4cb170eb..e39957e2bf2ef 100644 --- a/src/test/run-pass/generic-tag-corruption.rs +++ b/src/test/run-pass/generic-tag-corruption.rs @@ -14,4 +14,4 @@ // This used to cause memory corruption in stage 0. enum thing { some(K), } -pub fn main() { let _x = some("hi".to_string()); } +pub fn main() { let _x = thing::some("hi".to_string()); } diff --git a/src/test/run-pass/generic-tag-local.rs b/src/test/run-pass/generic-tag-local.rs index 7d011e57671de..cd8b13421c4de 100644 --- a/src/test/run-pass/generic-tag-local.rs +++ b/src/test/run-pass/generic-tag-local.rs @@ -12,4 +12,4 @@ enum clam { a(T), } -pub fn main() { let _c = a(3i); } +pub fn main() { let _c = clam::a(3i); } diff --git a/src/test/run-pass/generic-tag-match.rs b/src/test/run-pass/generic-tag-match.rs index 4975979d3e81c..64eb4e4986916 100644 --- a/src/test/run-pass/generic-tag-match.rs +++ b/src/test/run-pass/generic-tag-match.rs @@ -14,8 +14,8 @@ enum foo { arm(T), } fn altfoo(f: foo) { let mut hit = false; - match f { arm::(_x) => { println!("in arm"); hit = true; } } + match f { foo::arm::(_x) => { println!("in arm"); hit = true; } } assert!((hit)); } -pub fn main() { altfoo::(arm::(10)); } +pub fn main() { altfoo::(foo::arm::(10)); } diff --git a/src/test/run-pass/generic-tag-values.rs b/src/test/run-pass/generic-tag-values.rs index 26b9afcea8f3e..6ed85588363d1 100644 --- a/src/test/run-pass/generic-tag-values.rs +++ b/src/test/run-pass/generic-tag-values.rs @@ -13,11 +13,11 @@ enum noption { some(T), } struct Pair { x: int, y: int } pub fn main() { - let nop: noption = some::(5); - match nop { some::(n) => { println!("{}", n); assert!((n == 5)); } } - let nop2: noption = some(Pair{x: 17, y: 42}); + let nop: noption = noption::some::(5); + match nop { noption::some::(n) => { println!("{}", n); assert!((n == 5)); } } + let nop2: noption = noption::some(Pair{x: 17, y: 42}); match nop2 { - some(t) => { + noption::some(t) => { println!("{}", t.x); println!("{}", t.y); assert_eq!(t.x, 17); diff --git a/src/test/run-pass/generic-tag.rs b/src/test/run-pass/generic-tag.rs index 52e512e515c58..250c5bb66af47 100644 --- a/src/test/run-pass/generic-tag.rs +++ b/src/test/run-pass/generic-tag.rs @@ -14,6 +14,6 @@ enum option { some(Box), none, } pub fn main() { - let mut a: option = some::(box 10); - a = none::; + let mut a: option = option::some::(box 10); + a = option::none::; } diff --git a/src/test/run-pass/guards-not-exhaustive.rs b/src/test/run-pass/guards-not-exhaustive.rs index 4496769ec5646..c7f3c9d718221 100644 --- a/src/test/run-pass/guards-not-exhaustive.rs +++ b/src/test/run-pass/guards-not-exhaustive.rs @@ -12,12 +12,12 @@ enum Q { R(Option) } fn xyzzy(q: Q) -> uint { match q { - R(S) if S.is_some() => { 0 } + Q::R(S) if S.is_some() => { 0 } _ => 1 } } pub fn main() { - assert_eq!(xyzzy(R(Some(5))), 0); + assert_eq!(xyzzy(Q::R(Some(5))), 0); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 4a6a6782fb3db..8efd3af4bcedb 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -52,7 +52,7 @@ mod map_reduce { } let (tx, rx) = channel(); println!("sending find_reducer"); - ctrl.send(find_reducer(key.as_bytes().to_vec(), tx)); + ctrl.send(ctrl_proto::find_reducer(key.as_bytes().to_vec(), tx)); println!("receiving"); let c = rx.recv(); println!("{}", c); @@ -61,7 +61,7 @@ mod map_reduce { let ctrl_clone = ctrl.clone(); ::map(input, |a,b| emit(&mut intermediates, ctrl.clone(), a, b) ); - ctrl_clone.send(mapper_done); + ctrl_clone.send(ctrl_proto::mapper_done); } pub fn map_reduce(inputs: Vec) { @@ -80,8 +80,8 @@ mod map_reduce { while num_mappers > 0 { match rx.recv() { - mapper_done => { num_mappers -= 1; } - find_reducer(k, cc) => { + ctrl_proto::mapper_done => { num_mappers -= 1; } + ctrl_proto::find_reducer(k, cc) => { let mut c; match reducers.get(&str::from_utf8( k.as_slice()).unwrap().to_string()) { diff --git a/src/test/run-pass/html-literals.rs b/src/test/run-pass/html-literals.rs index c8163f08c6f89..18e35e72c02fc 100644 --- a/src/test/run-pass/html-literals.rs +++ b/src/test/run-pass/html-literals.rs @@ -25,6 +25,7 @@ of children of the current node. The tokens are everything that's left. */ +use HTMLFragment::{tag, text}; macro_rules! html ( ( $($body:tt)* ) => ( diff --git a/src/test/run-pass/if-let.rs b/src/test/run-pass/if-let.rs index a07b783278672..3a2aadd830b22 100644 --- a/src/test/run-pass/if-let.rs +++ b/src/test/run-pass/if-let.rs @@ -46,12 +46,12 @@ pub fn main() { Three(String, int) } - let foo = Three("three".to_string(), 42i); - if let One = foo { + let foo = Foo::Three("three".to_string(), 42i); + if let Foo::One = foo { panic!("bad pattern match"); - } else if let Two(_x) = foo { + } else if let Foo::Two(_x) = foo { panic!("bad pattern match"); - } else if let Three(s, _) = foo { + } else if let Foo::Three(s, _) = foo { assert_eq!(s.as_slice(), "three"); } else { panic!("bad else"); @@ -59,8 +59,8 @@ pub fn main() { if false { panic!("wat"); - } else if let a@Two(_) = Two(42u) { - if let Two(b) = a { + } else if let a@Foo::Two(_) = Foo::Two(42u) { + if let Foo::Two(b) = a { assert_eq!(b, 42u); } else { panic!("panic in nested if-let"); diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs index 752e95f25dc53..ee82a99a8084b 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -49,7 +49,7 @@ fn test_tag() { let i = &Cell::new(0i); { - let _a = t0(r(i)); + let _a = t::t0(r(i)); } assert_eq!(i.get(), 1); } diff --git a/src/test/run-pass/issue-10228.rs b/src/test/run-pass/issue-10228.rs index 6fc60680bd92c..52b6677428727 100644 --- a/src/test/run-pass/issue-10228.rs +++ b/src/test/run-pass/issue-10228.rs @@ -20,6 +20,6 @@ struct Test<'a> { pub fn main() { let test = Test { args: &[], - io: &[CreatePipe(true)] + io: &[StdioContainer::CreatePipe(true)] }; } diff --git a/src/test/run-pass/issue-10802.rs b/src/test/run-pass/issue-10802.rs index 7487ea81fa8f2..ab080834ac94b 100644 --- a/src/test/run-pass/issue-10802.rs +++ b/src/test/run-pass/issue-10802.rs @@ -45,7 +45,7 @@ fn main() { assert!(unsafe { DROPPED }); unsafe { DROPPED = false; } { - let f = box DroppableVariant1; + let f = box DroppableEnum::DroppableVariant1; let _a = Whatever::new(box f as Box); } assert!(unsafe { DROPPED }); diff --git a/src/test/run-pass/issue-11085.rs b/src/test/run-pass/issue-11085.rs index bdd6eece8a807..3c01df475bfd9 100644 --- a/src/test/run-pass/issue-11085.rs +++ b/src/test/run-pass/issue-11085.rs @@ -46,9 +46,9 @@ pub fn main() { let _f = Foo { foo: 3 }; let _f = Foo2 { foo: 3 }; - match Bar1_1 { - Bar1_1 => {} + match Bar1::Bar1_1 { + Bar1::Bar1_1 => {} } - let _f = Bar3_1 { bar: 3 }; + let _f = Bar3::Bar3_1 { bar: 3 }; } diff --git a/src/test/run-pass/issue-11552.rs b/src/test/run-pass/issue-11552.rs index 106bb7f701c96..f7223ae5d2d40 100644 --- a/src/test/run-pass/issue-11552.rs +++ b/src/test/run-pass/issue-11552.rs @@ -19,11 +19,11 @@ enum Noun fn fas(n: &Noun) -> Noun { match n { - &Cell(box Atom(2), box Cell(ref a, _)) => (**a).clone(), + &Noun::Cell(box Noun::Atom(2), box Noun::Cell(ref a, _)) => (**a).clone(), _ => panic!("Invalid fas pattern") } } pub fn main() { - fas(&Cell(box Atom(2), box Cell(box Atom(2), box Atom(3)))); + fas(&Noun::Cell(box Noun::Atom(2), box Noun::Cell(box Noun::Atom(2), box Noun::Atom(3)))); } diff --git a/src/test/run-pass/issue-11577.rs b/src/test/run-pass/issue-11577.rs index 3d80180558c2c..b8b54e7b20ac1 100644 --- a/src/test/run-pass/issue-11577.rs +++ b/src/test/run-pass/issue-11577.rs @@ -19,8 +19,8 @@ enum Foo { struct SBar { num: int } pub fn main() { - let vbar = VBar { num: 1 }; - let VBar { num } = vbar; + let vbar = Foo::VBar { num: 1 }; + let Foo::VBar { num } = vbar; assert_eq!(num, 1); let sbar = SBar { num: 2 }; diff --git a/src/test/run-pass/issue-11881.rs b/src/test/run-pass/issue-11881.rs index 28fc4ce192e18..8de847bfa3314 100644 --- a/src/test/run-pass/issue-11881.rs +++ b/src/test/run-pass/issue-11881.rs @@ -55,9 +55,9 @@ fn encode_rbml<'a, pub fn main() { let target = Foo{baz: false,}; let mut wr = SeekableMemWriter::new(); - let proto = JSON; + let proto = WireProtocol::JSON; match proto { - JSON => encode_json(&target, &mut wr), - RBML => encode_rbml(&target, &mut wr) + WireProtocol::JSON => encode_json(&target, &mut wr), + WireProtocol::RBML => encode_rbml(&target, &mut wr) } } diff --git a/src/test/run-pass/issue-13027.rs b/src/test/run-pass/issue-13027.rs index 6cd098aeb0f8c..1f61da2f424f0 100644 --- a/src/test/run-pass/issue-13027.rs +++ b/src/test/run-pass/issue-13027.rs @@ -179,9 +179,9 @@ fn misc() { // This test basically mimics how trace_macros! macro is implemented, // which is a rare combination of vector patterns, multiple wild-card // patterns and guard functions. - let r = match [Bar(0, false)].as_slice() { - [Bar(_, pred)] if pred => 1i, - [Bar(_, pred)] if !pred => 2i, + let r = match [Foo::Bar(0, false)].as_slice() { + [Foo::Bar(_, pred)] if pred => 1i, + [Foo::Bar(_, pred)] if !pred => 2i, _ => 0i, }; assert_eq!(2i, r); diff --git a/src/test/run-pass/issue-13214.rs b/src/test/run-pass/issue-13214.rs index 8afaec16e4543..191e9ce8b6feb 100644 --- a/src/test/run-pass/issue-13214.rs +++ b/src/test/run-pass/issue-13214.rs @@ -17,7 +17,7 @@ pub enum Foo { } pub static TEST: Test = Test { - foo: Bar, + foo: Foo::Bar, c: 'a' }; diff --git a/src/test/run-pass/issue-13867.rs b/src/test/run-pass/issue-13867.rs index b1607ef174bb2..00ff837b981d2 100644 --- a/src/test/run-pass/issue-13867.rs +++ b/src/test/run-pass/issue-13867.rs @@ -17,25 +17,25 @@ enum Foo { } fn main() { - let r = match (FooNullary, 'a') { - (FooUint(..), 'a'...'z') => 1i, - (FooNullary, 'x') => 2i, + let r = match (Foo::FooNullary, 'a') { + (Foo::FooUint(..), 'a'...'z') => 1i, + (Foo::FooNullary, 'x') => 2i, _ => 0 }; assert_eq!(r, 0); - let r = match (FooUint(0), 'a') { - (FooUint(1), 'a'...'z') => 1i, - (FooUint(..), 'x') => 2i, - (FooNullary, 'a') => 3i, + let r = match (Foo::FooUint(0), 'a') { + (Foo::FooUint(1), 'a'...'z') => 1i, + (Foo::FooUint(..), 'x') => 2i, + (Foo::FooNullary, 'a') => 3i, _ => 0 }; assert_eq!(r, 0); - let r = match ('a', FooUint(0)) { - ('a'...'z', FooUint(1)) => 1i, - ('x', FooUint(..)) => 2i, - ('a', FooNullary) => 3i, + let r = match ('a', Foo::FooUint(0)) { + ('a'...'z', Foo::FooUint(1)) => 1i, + ('x', Foo::FooUint(..)) => 2i, + ('a', Foo::FooNullary) => 3i, _ => 0 }; assert_eq!(r, 0); diff --git a/src/test/run-pass/issue-14865.rs b/src/test/run-pass/issue-14865.rs index e3cc653909f33..53af0c8635ca2 100644 --- a/src/test/run-pass/issue-14865.rs +++ b/src/test/run-pass/issue-14865.rs @@ -14,17 +14,17 @@ enum X { } fn main() { - let x = match Foo(42) { - Foo(..) => 1i, + let x = match X::Foo(42) { + X::Foo(..) => 1i, _ if true => 0, - Bar(..) => panic!("Oh dear") + X::Bar(..) => panic!("Oh dear") }; assert_eq!(x, 1); - let x = match Foo(42) { + let x = match X::Foo(42) { _ if true => 0i, - Foo(..) => 1, - Bar(..) => panic!("Oh dear") + X::Foo(..) => 1, + X::Bar(..) => panic!("Oh dear") }; assert_eq!(x, 0); } diff --git a/src/test/run-pass/issue-14901.rs b/src/test/run-pass/issue-14901.rs index f93347f4366c6..647bbfbd65da0 100644 --- a/src/test/run-pass/issue-14901.rs +++ b/src/test/run-pass/issue-14901.rs @@ -20,7 +20,7 @@ trait Wrap<'a> { impl<'a, R: Reader> Wrap<'a> for &'a mut R { fn wrap(self) -> Wrapper<'a> { - WrapReader(self as &'a mut Reader) + Wrapper::WrapReader(self as &'a mut Reader) } } diff --git a/src/test/run-pass/issue-14959.rs b/src/test/run-pass/issue-14959.rs index 74b9df9b88d87..5429c5195928e 100644 --- a/src/test/run-pass/issue-14959.rs +++ b/src/test/run-pass/issue-14959.rs @@ -41,7 +41,7 @@ impl Ingot for HelloWorld { fn enter(&mut self, _req: &mut Rq, res: &mut Rs, alloy: &mut Alloy) -> Status { let send_file = alloy.find::().unwrap(); send_file(res); - Continue + Status::Continue } } diff --git a/src/test/run-pass/issue-15063.rs b/src/test/run-pass/issue-15063.rs index 0b7eb41d2aac1..695d30d73175c 100644 --- a/src/test/run-pass/issue-15063.rs +++ b/src/test/run-pass/issue-15063.rs @@ -15,5 +15,5 @@ impl Drop for Two { } } fn main() { - let k = A; + let k = Two::A; } diff --git a/src/test/run-pass/issue-15129.rs b/src/test/run-pass/issue-15129.rs index fcc392e3779dc..6782310fa0aa5 100644 --- a/src/test/run-pass/issue-15129.rs +++ b/src/test/run-pass/issue-15129.rs @@ -20,14 +20,14 @@ pub enum V { fn foo(x: (T, V)) -> String { match x { - (T1(()), V1(i)) => format!("T1(()), V1({})", i), - (T2(()), V2(b)) => format!("T2(()), V2({})", b), + (T::T1(()), V::V1(i)) => format!("T1(()), V1({})", i), + (T::T2(()), V::V2(b)) => format!("T2(()), V2({})", b), _ => String::new() } } fn main() { - assert_eq!(foo((T1(()), V1(99))), "T1(()), V1(99)".to_string()); - assert_eq!(foo((T2(()), V2(true))), "T2(()), V2(true)".to_string()); + assert_eq!(foo((T::T1(()), V::V1(99))), "T1(()), V1(99)".to_string()); + assert_eq!(foo((T::T2(()), V::V2(true))), "T2(()), V2(true)".to_string()); } diff --git a/src/test/run-pass/issue-15689-1.rs b/src/test/run-pass/issue-15689-1.rs index 8d17fc4600614..6cb1d4a14f554 100644 --- a/src/test/run-pass/issue-15689-1.rs +++ b/src/test/run-pass/issue-15689-1.rs @@ -14,5 +14,5 @@ enum Test<'a> { } fn main() { - assert!(Slice(&1) == Slice(&1)) + assert!(Test::Slice(&1) == Test::Slice(&1)) } diff --git a/src/test/run-pass/issue-15774.rs b/src/test/run-pass/issue-15774.rs index 0a70c3e1bcdcf..77fa862f7d4f6 100644 --- a/src/test/run-pass/issue-15774.rs +++ b/src/test/run-pass/issue-15774.rs @@ -14,19 +14,19 @@ enum Foo { A } mod bar { pub fn normal(x: ::Foo) { - use A; + use Foo::A; match x { A => {} } } pub fn wrong(x: ::Foo) { match x { - ::A => {} + ::Foo::A => {} } } } pub fn main() { - bar::normal(A); - bar::wrong(A); + bar::normal(Foo::A); + bar::wrong(Foo::A); } diff --git a/src/test/run-pass/issue-15793.rs b/src/test/run-pass/issue-15793.rs index a28cb87cfe245..933fa881eed54 100644 --- a/src/test/run-pass/issue-15793.rs +++ b/src/test/run-pass/issue-15793.rs @@ -21,14 +21,14 @@ enum Enum { #[inline(never)] fn foo(x: Enum) -> int { match x { - Variant1(true) => 1, - Variant1(false) => 2, - Variant2(Second) => 3, - Variant2(Third) => 4, - Variant2(First) => 5 + Enum::Variant1(true) => 1, + Enum::Variant1(false) => 2, + Enum::Variant2(NestedEnum::Second) => 3, + Enum::Variant2(NestedEnum::Third) => 4, + Enum::Variant2(NestedEnum::First) => 5 } } fn main() { - assert_eq!(foo(Variant2(Third)), 4); + assert_eq!(foo(Enum::Variant2(NestedEnum::Third)), 4); } diff --git a/src/test/run-pass/issue-1701.rs b/src/test/run-pass/issue-1701.rs index d1b2c8e28707e..9dc78ce0d4f1a 100644 --- a/src/test/run-pass/issue-1701.rs +++ b/src/test/run-pass/issue-1701.rs @@ -16,16 +16,16 @@ enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } fn noise(a: animal) -> Option { match a { - cat(..) => { Some("meow".to_string()) } - dog(..) => { Some("woof".to_string()) } - rabbit(..) => { None } - tiger(..) => { Some("roar".to_string()) } + animal::cat(..) => { Some("meow".to_string()) } + animal::dog(..) => { Some("woof".to_string()) } + animal::rabbit(..) => { None } + animal::tiger(..) => { Some("roar".to_string()) } } } pub fn main() { - assert_eq!(noise(cat(tabby)), Some("meow".to_string())); - assert_eq!(noise(dog(pug)), Some("woof".to_string())); - assert_eq!(noise(rabbit("Hilbert".to_string(), upright)), None); - assert_eq!(noise(tiger), Some("roar".to_string())); + assert_eq!(noise(animal::cat(pattern::tabby)), Some("meow".to_string())); + assert_eq!(noise(animal::dog(breed::pug)), Some("woof".to_string())); + assert_eq!(noise(animal::rabbit("Hilbert".to_string(), ear_kind::upright)), None); + assert_eq!(noise(animal::tiger), Some("roar".to_string())); } diff --git a/src/test/run-pass/issue-17718-static-unsafe-interior.rs b/src/test/run-pass/issue-17718-static-unsafe-interior.rs index 8f76d95c54815..cd32857ede5f5 100644 --- a/src/test/run-pass/issue-17718-static-unsafe-interior.rs +++ b/src/test/run-pass/issue-17718-static-unsafe-interior.rs @@ -24,7 +24,7 @@ enum UnsafeEnum { VariantUnsafe(UnsafeCell) } -static STATIC1: UnsafeEnum = VariantSafe; +static STATIC1: UnsafeEnum = UnsafeEnum::VariantSafe; static STATIC2: UnsafeCell = UnsafeCell { value: 1 }; const CONST: UnsafeCell = UnsafeCell { value: 1 }; diff --git a/src/test/run-pass/issue-2074.rs b/src/test/run-pass/issue-2074.rs index dd2734d296ffc..ebcaf97c5f7e7 100644 --- a/src/test/run-pass/issue-2074.rs +++ b/src/test/run-pass/issue-2074.rs @@ -13,11 +13,11 @@ pub fn main() { let one: || -> uint = || { enum r { a }; - a as uint + r::a as uint }; let two: || -> uint = || { enum r { a }; - a as uint + r::a as uint }; one(); two(); } diff --git a/src/test/run-pass/issue-2428.rs b/src/test/run-pass/issue-2428.rs index b2ebbf3b148cf..afa053de2438c 100644 --- a/src/test/run-pass/issue-2428.rs +++ b/src/test/run-pass/issue-2428.rs @@ -16,5 +16,5 @@ pub fn main() { Bar = quux } - assert_eq!(Bar as int, quux); + assert_eq!(Stuff::Bar as int, quux); } diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index cb17b7f6a6cc0..3943d8a3f305e 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -17,6 +17,7 @@ pub type Task = int; // tjc: I don't know why pub mod pipes { + use self::state::{empty, full, blocked, terminated}; use super::Task; use std::mem::{forget, transmute}; use std::mem::{replace, swap}; diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 62104f2dc232e..55648b0057d54 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -46,11 +46,11 @@ fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String, "".to_string()); let label = format!("{}-{}", managed_ip, name); - (label, bool_value(false)) + (label, object::bool_value(false)) } _ => { println!("Expected dict for {} interfaces, found {}", managed_ip, data); - ("gnos:missing-interface".to_string(), bool_value(true)) + ("gnos:missing-interface".to_string(), object::bool_value(true)) } } } diff --git a/src/test/run-pass/issue-2904.rs b/src/test/run-pass/issue-2904.rs index f4206312edb06..1dc1587ff2fd6 100644 --- a/src/test/run-pass/issue-2904.rs +++ b/src/test/run-pass/issue-2904.rs @@ -14,6 +14,7 @@ use std::io; use std::fmt; +use square::{bot, wall, rock, lambda, closed_lift, open_lift, earth, empty}; enum square { bot, diff --git a/src/test/run-pass/issue-3121.rs b/src/test/run-pass/issue-3121.rs index 6b320e1474624..d0e995da5f130 100644 --- a/src/test/run-pass/issue-3121.rs +++ b/src/test/run-pass/issue-3121.rs @@ -15,14 +15,14 @@ enum meal { to_go(order), for_here(order) } fn foo(m: Box, cond: bool) { match *m { - to_go(_) => { } - for_here(_) if cond => {} - for_here(hamburger) => {} - for_here(fries(_s)) => {} - for_here(shake) => {} + meal::to_go(_) => { } + meal::for_here(_) if cond => {} + meal::for_here(order::hamburger) => {} + meal::for_here(order::fries(_s)) => {} + meal::for_here(order::shake) => {} } } pub fn main() { - foo(box for_here(hamburger), true) + foo(box meal::for_here(order::hamburger), true) } diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index e59cf9f77fa6e..028081888c346 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -36,8 +36,8 @@ pub fn main() // assert!(check_strs(fmt!("%?", ETag(@~["foo".to_string()], @"bar".to_string())), // "ETag(@~[ ~\"foo\" ], @~\"bar\")")); - let t = Text("foo".to_string()); - let u = Section(vec!["alpha".to_string()], + let t = Token::Text("foo".to_string()); + let u = Token::Section(vec!["alpha".to_string()], true, vec![t], "foo".to_string(), diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index 2e0159af98452..be5387b23c29c 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -26,7 +26,7 @@ fn foo(name: String, samples_chan: Sender) { println!("{}: {}", i, buffer[i]) } }; - samples_chan.send(GetSamples(name.clone(), callback)); + samples_chan.send(Msg::GetSamples(name.clone(), callback)); }); } diff --git a/src/test/run-pass/issue-3753.rs b/src/test/run-pass/issue-3753.rs index 951832a14aa60..9fbabed3a94dd 100644 --- a/src/test/run-pass/issue-3753.rs +++ b/src/test/run-pass/issue-3753.rs @@ -27,13 +27,13 @@ pub enum Shape { impl Shape { pub fn area(&self, sh: Shape) -> f64 { match sh { - Circle(_, size) => f64::consts::PI * size * size, - Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y) + Shape::Circle(_, size) => f64::consts::PI * size * size, + Shape::Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y) } } } pub fn main(){ - let s = Circle(Point { x: 1.0, y: 2.0 }, 3.0); + let s = Shape::Circle(Point { x: 1.0, y: 2.0 }, 3.0); println!("{}", s.area(s)); } diff --git a/src/test/run-pass/issue-3874.rs b/src/test/run-pass/issue-3874.rs index 75f6a2faa8055..c616c09c70e60 100644 --- a/src/test/run-pass/issue-3874.rs +++ b/src/test/run-pass/issue-3874.rs @@ -11,7 +11,7 @@ enum PureCounter { PureCounterVariant(uint) } fn each(thing: PureCounter, blk: |v: &uint|) { - let PureCounterVariant(ref x) = thing; + let PureCounter::PureCounterVariant(ref x) = thing; blk(x); } diff --git a/src/test/run-pass/issue-3895.rs b/src/test/run-pass/issue-3895.rs index ee075db272350..b2254001320c4 100644 --- a/src/test/run-pass/issue-3895.rs +++ b/src/test/run-pass/issue-3895.rs @@ -11,8 +11,8 @@ pub fn main() { enum State { BadChar, BadSyntax } - match BadChar { - _ if true => BadChar, - BadChar | BadSyntax => panic!() , + match State::BadChar { + _ if true => State::BadChar, + State::BadChar | State::BadSyntax => panic!() , }; } diff --git a/src/test/run-pass/issue-5530.rs b/src/test/run-pass/issue-5530.rs index f4e4cd9712dcb..ec697cdf9e0e0 100644 --- a/src/test/run-pass/issue-5530.rs +++ b/src/test/run-pass/issue-5530.rs @@ -17,25 +17,25 @@ enum Enum { fn fun1(e1: &Enum, e2: &Enum) -> uint { match (e1, e2) { - (&Foo { foo: _ }, &Foo { foo: _ }) => 0, - (&Foo { foo: _ }, &Bar { bar: _ }) => 1, - (&Bar { bar: _ }, &Bar { bar: _ }) => 2, - (&Bar { bar: _ }, &Foo { foo: _ }) => 3, + (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0, + (&Enum::Foo { foo: _ }, &Enum::Bar { bar: _ }) => 1, + (&Enum::Bar { bar: _ }, &Enum::Bar { bar: _ }) => 2, + (&Enum::Bar { bar: _ }, &Enum::Foo { foo: _ }) => 3, } } fn fun2(e1: &Enum, e2: &Enum) -> uint { match (e1, e2) { - (&Foo { foo: _ }, &Foo { foo: _ }) => 0, - (&Foo { foo: _ }, _ ) => 1, - (&Bar { bar: _ }, &Bar { bar: _ }) => 2, - (&Bar { bar: _ }, _ ) => 3, + (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0, + (&Enum::Foo { foo: _ }, _ ) => 1, + (&Enum::Bar { bar: _ }, &Enum::Bar { bar: _ }) => 2, + (&Enum::Bar { bar: _ }, _ ) => 3, } } pub fn main() { - let foo = Foo { foo: 1 }; - let bar = Bar { bar: 1 }; + let foo = Enum::Foo { foo: 1 }; + let bar = Enum::Bar { bar: 1 }; assert_eq!(fun1(&foo, &foo), 0); assert_eq!(fun1(&foo, &bar), 1); diff --git a/src/test/run-pass/issue-6117.rs b/src/test/run-pass/issue-6117.rs index 7eaaa5ea74eda..e979bc86171ce 100644 --- a/src/test/run-pass/issue-6117.rs +++ b/src/test/run-pass/issue-6117.rs @@ -12,8 +12,8 @@ enum Either { Left(T), Right(U) } pub fn main() { - match Left(box 17i) { - Right(()) => {} + match Either::Left(box 17i) { + Either::Right(()) => {} _ => {} } } diff --git a/src/test/run-pass/issue-6318.rs b/src/test/run-pass/issue-6318.rs index a4576bc7c8ceb..2b474b8cfbbe2 100644 --- a/src/test/run-pass/issue-6318.rs +++ b/src/test/run-pass/issue-6318.rs @@ -20,8 +20,8 @@ pub struct Struct; impl Foo for Struct {} pub fn main() { - match A(box Struct as Box) { - A(_a) => 0i, + match Thing::A(box Struct as Box) { + Thing::A(_a) => 0i, }; } diff --git a/src/test/run-pass/issue-6449.rs b/src/test/run-pass/issue-6449.rs index 5a6dea8d15bff..9a5fc7763f63b 100644 --- a/src/test/run-pass/issue-6449.rs +++ b/src/test/run-pass/issue-6449.rs @@ -19,33 +19,33 @@ enum Other { } fn main() { - match Baz { - ::Bar(3) => panic!(), - ::Bar(_) if false => panic!(), - ::Bar(..) if false => panic!(), - ::Bar(_n) => panic!(), - ::Baz => {} + match Foo::Baz { + ::Foo::Bar(3) => panic!(), + ::Foo::Bar(_) if false => panic!(), + ::Foo::Bar(..) if false => panic!(), + ::Foo::Bar(_n) => panic!(), + ::Foo::Baz => {} } - match Bar(3) { - ::Bar(3) => {} - ::Bar(_) if false => panic!(), - ::Bar(..) if false => panic!(), - ::Bar(_n) => panic!(), - ::Baz => panic!(), + match Foo::Bar(3) { + ::Foo::Bar(3) => {} + ::Foo::Bar(_) if false => panic!(), + ::Foo::Bar(..) if false => panic!(), + ::Foo::Bar(_n) => panic!(), + ::Foo::Baz => panic!(), } - match Bar(4) { - ::Bar(3) => panic!(), - ::Bar(_) if false => panic!(), - ::Bar(..) if false => panic!(), - ::Bar(n) => assert_eq!(n, 4), - ::Baz => panic!(), + match Foo::Bar(4) { + ::Foo::Bar(3) => panic!(), + ::Foo::Bar(_) if false => panic!(), + ::Foo::Bar(..) if false => panic!(), + ::Foo::Bar(n) => assert_eq!(n, 4), + ::Foo::Baz => panic!(), } - match Other1(Baz) { - ::Other1(::Baz) => {} - ::Other1(::Bar(_)) => {} - ::Other2(::Baz, ::Bar(_)) => {} - ::Other2(::Bar(..), ::Baz) => {} - ::Other2(..) => {} + match Other::Other1(Foo::Baz) { + ::Other::Other1(::Foo::Baz) => {} + ::Other::Other1(::Foo::Bar(_)) => {} + ::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {} + ::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {} + ::Other::Other2(..) => {} } } diff --git a/src/test/run-pass/issue-6892.rs b/src/test/run-pass/issue-6892.rs index 462a78a5368f8..c2e0f5206ae01 100644 --- a/src/test/run-pass/issue-6892.rs +++ b/src/test/run-pass/issue-6892.rs @@ -47,9 +47,9 @@ fn main() { assert_eq!(unsafe { NUM_DROPS }, 2); { let _x = Baz(21); } assert_eq!(unsafe { NUM_DROPS }, 3); - { let _x = _Foo(Foo); } + { let _x = FooBar::_Foo(Foo); } assert_eq!(unsafe { NUM_DROPS }, 5); - { let _x = _Bar(42u); } + { let _x = FooBar::_Bar(42u); } assert_eq!(unsafe { NUM_DROPS }, 6); { let _ = Foo; } @@ -58,8 +58,8 @@ fn main() { assert_eq!(unsafe { NUM_DROPS }, 8); { let _ = Baz(21); } assert_eq!(unsafe { NUM_DROPS }, 9); - { let _ = _Foo(Foo); } + { let _ = FooBar::_Foo(Foo); } assert_eq!(unsafe { NUM_DROPS }, 11); - { let _ = _Bar(42u); } + { let _ = FooBar::_Bar(42u); } assert_eq!(unsafe { NUM_DROPS }, 12); } diff --git a/src/test/run-pass/issue-8351-1.rs b/src/test/run-pass/issue-8351-1.rs index c1d5bb0961bba..479cac98b8e6c 100644 --- a/src/test/run-pass/issue-8351-1.rs +++ b/src/test/run-pass/issue-8351-1.rs @@ -16,10 +16,10 @@ enum E { } pub fn main() { - let e = Foo{f: 0}; + let e = E::Foo{f: 0}; match e { - Foo{f: 1} => panic!(), - Foo{..} => (), + E::Foo{f: 1} => panic!(), + E::Foo{..} => (), _ => panic!(), } } diff --git a/src/test/run-pass/issue-8351-2.rs b/src/test/run-pass/issue-8351-2.rs index 28b37826812a3..d6409443d262c 100644 --- a/src/test/run-pass/issue-8351-2.rs +++ b/src/test/run-pass/issue-8351-2.rs @@ -16,10 +16,10 @@ enum E { } pub fn main() { - let e = Foo{f: 0, b: false}; + let e = E::Foo{f: 0, b: false}; match e { - Foo{f: 1, b: true} => panic!(), - Foo{b: false, f: 0} => (), + E::Foo{f: 1, b: true} => panic!(), + E::Foo{b: false, f: 0} => (), _ => panic!(), } } diff --git a/src/test/run-pass/issue-8506.rs b/src/test/run-pass/issue-8506.rs index c94d89e5c0a78..54dfe2b9dab51 100644 --- a/src/test/run-pass/issue-8506.rs +++ b/src/test/run-pass/issue-8506.rs @@ -15,6 +15,6 @@ enum Either { Other(String,String) } -static one : Either = One; +static one : Either = Either::One; pub fn main () { } diff --git a/src/test/run-pass/issue-8851.rs b/src/test/run-pass/issue-8851.rs index 210371205696a..bf84721c98440 100644 --- a/src/test/run-pass/issue-8851.rs +++ b/src/test/run-pass/issue-8851.rs @@ -24,8 +24,8 @@ macro_rules! test( ($id:ident, $e:expr) => ( fn foo(t: T) -> int { match t { - A($id) => $e, - B($id) => $e + T::A($id) => $e, + T::B($id) => $e } } ) @@ -34,5 +34,5 @@ macro_rules! test( test!(y, 10 + (y as int)) pub fn main() { - foo(A(20)); + foo(T::A(20)); } diff --git a/src/test/run-pass/issue-9719.rs b/src/test/run-pass/issue-9719.rs index 0f054a3083d4d..ebb9b20ec25fe 100644 --- a/src/test/run-pass/issue-9719.rs +++ b/src/test/run-pass/issue-9719.rs @@ -17,7 +17,7 @@ mod a { impl X for int {} pub struct Z<'a>(Enum<&'a X+'a>); - fn foo() { let x = 42i; let z = Z(A(&x as &X)); let _ = z; } + fn foo() { let x = 42i; let z = Z(Enum::A(&x as &X)); let _ = z; } } mod b { diff --git a/src/test/run-pass/list.rs b/src/test/run-pass/list.rs index 7d0778b685937..9b20398038d41 100644 --- a/src/test/run-pass/list.rs +++ b/src/test/run-pass/list.rs @@ -11,4 +11,4 @@ enum list { cons(int, Box), nil, } -pub fn main() { cons(10, box cons(11, box cons(12, box nil))); } +pub fn main() { list::cons(10, box list::cons(11, box list::cons(12, box list::nil))); } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index 3d8eaeea618d0..165561e5256ec 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -19,7 +19,7 @@ fn check_log(exp: String, v: T) { } pub fn main() { - let mut x = Some(a(22u)); + let mut x = Some(foo::a(22u)); let exp = "Some(a(22))".to_string(); let act = format!("{}", x); assert_eq!(act, exp); diff --git a/src/test/run-pass/log-knows-the-names-of-variants.rs b/src/test/run-pass/log-knows-the-names-of-variants.rs index 8445f3e316003..5acf54c30f139 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants.rs @@ -21,7 +21,7 @@ enum bar { } pub fn main() { - assert_eq!("a(22)".to_string(), format!("{}", a(22u))); - assert_eq!("c".to_string(), format!("{}", c)); - assert_eq!("d".to_string(), format!("{}", d)); + assert_eq!("a(22)".to_string(), format!("{}", foo::a(22u))); + assert_eq!("c".to_string(), format!("{}", foo::c)); + assert_eq!("d".to_string(), format!("{}", bar::d)); } diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs index cf733fe48932a..48cd49158dfb8 100644 --- a/src/test/run-pass/log-poly.rs +++ b/src/test/run-pass/log-poly.rs @@ -16,6 +16,6 @@ enum Numbers { pub fn main() { println!("{}", 1i); println!("{}", 2.0f64); - println!("{}", Three); + println!("{}", Numbers::Three); println!("{}", vec!(4i)); } diff --git a/src/test/run-pass/match-arm-statics.rs b/src/test/run-pass/match-arm-statics.rs index 29972c0efd0db..3387901461155 100644 --- a/src/test/run-pass/match-arm-statics.rs +++ b/src/test/run-pass/match-arm-statics.rs @@ -31,10 +31,11 @@ enum EnumWithStructVariants { const TRUE_TRUE: (bool, bool) = (true, true); const NONE: Option = None; -const EAST: Direction = East; +const EAST: Direction = Direction::East; const NEW_FALSE: NewBool = NewBool(false); -const STATIC_FOO: Foo = Foo { bar: Some(South), baz: NEW_FALSE }; -const VARIANT2_NORTH: EnumWithStructVariants = Variant2 { dir: North }; +const STATIC_FOO: Foo = Foo { bar: Some(Direction::South), baz: NEW_FALSE }; +const VARIANT2_NORTH: EnumWithStructVariants = EnumWithStructVariants::Variant2 { + dir: Direction::North }; pub mod glfw { pub struct InputState(uint); @@ -82,16 +83,16 @@ fn issue_14576() { } enum C { D = 3, E = 4 } - const F : C = D; + const F : C = C::D; - assert_eq!(match D { F => 1i, _ => 2, }, 1); + assert_eq!(match C::D { F => 1i, _ => 2, }, 1); } fn issue_13731() { enum A { AA(()) } - const B: A = AA(()); + const B: A = A::AA(()); - match AA(()) { + match A::AA(()) { B => () } } @@ -119,33 +120,33 @@ fn main() { (true, false) => 4 }, 4); - assert_eq!(match Some(Some(North)) { + assert_eq!(match Some(Some(Direction::North)) { Some(NONE) => 1i, - Some(Some(North)) => 2, + Some(Some(Direction::North)) => 2, Some(Some(EAST)) => 3, - Some(Some(South)) => 4, - Some(Some(West)) => 5, + Some(Some(Direction::South)) => 4, + Some(Some(Direction::West)) => 5, None => 6 }, 2); - assert_eq!(match (Foo { bar: Some(West), baz: NewBool(true) }) { + assert_eq!(match (Foo { bar: Some(Direction::West), baz: NewBool(true) }) { Foo { bar: None, baz: NewBool(true) } => 1i, Foo { bar: NONE, baz: NEW_FALSE } => 2, STATIC_FOO => 3, Foo { bar: _, baz: NEW_FALSE } => 4, - Foo { bar: Some(West), baz: NewBool(true) } => 5, - Foo { bar: Some(South), baz: NewBool(true) } => 6, + Foo { bar: Some(Direction::West), baz: NewBool(true) } => 5, + Foo { bar: Some(Direction::South), baz: NewBool(true) } => 6, Foo { bar: Some(EAST), .. } => 7, - Foo { bar: Some(North), baz: NewBool(true) } => 8 + Foo { bar: Some(Direction::North), baz: NewBool(true) } => 8 }, 5); - assert_eq!(match (Variant2 { dir: North }) { - Variant1(true) => 1i, - Variant1(false) => 2, - Variant2 { dir: West } => 3, + assert_eq!(match (EnumWithStructVariants::Variant2 { dir: Direction::North }) { + EnumWithStructVariants::Variant1(true) => 1i, + EnumWithStructVariants::Variant1(false) => 2, + EnumWithStructVariants::Variant2 { dir: Direction::West } => 3, VARIANT2_NORTH => 4, - Variant2 { dir: South } => 5, - Variant2 { dir: East } => 6 + EnumWithStructVariants::Variant2 { dir: Direction::South } => 5, + EnumWithStructVariants::Variant2 { dir: Direction::East } => 6 }, 4); issue_6533(); diff --git a/src/test/run-pass/match-enum-struct-0.rs b/src/test/run-pass/match-enum-struct-0.rs index 6b18f3c19da2b..6b0e351c8923c 100644 --- a/src/test/run-pass/match-enum-struct-0.rs +++ b/src/test/run-pass/match-enum-struct-0.rs @@ -18,9 +18,9 @@ enum E { } pub fn main() { - let e = Bar; + let e = E::Bar; match e { - Foo{f: _f} => panic!(), + E::Foo{f: _f} => panic!(), _ => (), } } diff --git a/src/test/run-pass/match-enum-struct-1.rs b/src/test/run-pass/match-enum-struct-1.rs index 451b8f63e9576..9e0de69c1ab09 100644 --- a/src/test/run-pass/match-enum-struct-1.rs +++ b/src/test/run-pass/match-enum-struct-1.rs @@ -16,13 +16,13 @@ enum E { } pub fn main() { - let e = Foo{f: 1}; + let e = E::Foo{f: 1}; match e { - Foo{..} => (), + E::Foo{..} => (), _ => panic!(), } match e { - Foo{f: _f} => (), + E::Foo{f: _f} => (), _ => panic!(), } } diff --git a/src/test/run-pass/match-in-macro.rs b/src/test/run-pass/match-in-macro.rs index c30c4a714b39d..b6834f8026d19 100644 --- a/src/test/run-pass/match-in-macro.rs +++ b/src/test/run-pass/match-in-macro.rs @@ -16,8 +16,8 @@ enum Foo { macro_rules! match_inside_expansion( () => ( - match (B { b1:29 , bb1: 100}) { - B { b1:b2 , bb1:bb2 } => b2+bb2 + match (Foo::B { b1:29 , bb1: 100}) { + Foo::B { b1:b2 , bb1:bb2 } => b2+bb2 } ) ) diff --git a/src/test/run-pass/match-path.rs b/src/test/run-pass/match-path.rs index 3da6bb9348666..b3c7f3db512b1 100644 --- a/src/test/run-pass/match-path.rs +++ b/src/test/run-pass/match-path.rs @@ -14,6 +14,6 @@ mod m1 { pub enum foo { foo1, foo2, } } -fn bar(x: m1::foo) { match x { m1::foo1 => { } m1::foo2 => { } } } +fn bar(x: m1::foo) { match x { m1::foo::foo1 => { } m1::foo::foo2 => { } } } pub fn main() { } diff --git a/src/test/run-pass/match-pattern-no-type-params.rs b/src/test/run-pass/match-pattern-no-type-params.rs index e5be0e52b9497..d76c8faa5b6ce 100644 --- a/src/test/run-pass/match-pattern-no-type-params.rs +++ b/src/test/run-pass/match-pattern-no-type-params.rs @@ -12,8 +12,8 @@ enum maybe { nothing, just(T), } fn foo(x: maybe) { match x { - nothing => { println!("A"); } - just(_a) => { println!("B"); } + maybe::nothing => { println!("A"); } + maybe::just(_a) => { println!("B"); } } } diff --git a/src/test/run-pass/match-phi.rs b/src/test/run-pass/match-phi.rs index 122192667b590..c5f39bc1a5383 100644 --- a/src/test/run-pass/match-phi.rs +++ b/src/test/run-pass/match-phi.rs @@ -17,9 +17,9 @@ fn foo(it: |int|) { it(10); } pub fn main() { let mut x = true; - match a { - a => { x = true; foo(|_i| { } ) } - b => { x = false; } - c => { x = false; } + match thing::a { + thing::a => { x = true; foo(|_i| { } ) } + thing::b => { x = false; } + thing::c => { x = false; } } } diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs index 651f56e894ac8..544751754c6b0 100644 --- a/src/test/run-pass/match-str.rs +++ b/src/test/run-pass/match-str.rs @@ -16,10 +16,10 @@ pub fn main() { enum t { tag1(String), tag2, } - match tag1("test".to_string()) { - tag2 => panic!(), - tag1(ref s) if "test" != s.as_slice() => panic!(), - tag1(ref s) if "test" == s.as_slice() => (), + match t::tag1("test".to_string()) { + t::tag2 => panic!(), + t::tag1(ref s) if "test" != s.as_slice() => panic!(), + t::tag1(ref s) if "test" == s.as_slice() => (), _ => panic!() } diff --git a/src/test/run-pass/match-tag.rs b/src/test/run-pass/match-tag.rs index 25e5a84ffc2fc..cf940a630569d 100644 --- a/src/test/run-pass/match-tag.rs +++ b/src/test/run-pass/match-tag.rs @@ -20,17 +20,17 @@ enum color { fn process(c: color) -> int { let mut x: int; match c { - rgb(r, _, _) => { x = r; } - rgba(_, _, _, a) => { x = a; } - hsl(_, s, _) => { x = s; } + color::rgb(r, _, _) => { x = r; } + color::rgba(_, _, _, a) => { x = a; } + color::hsl(_, s, _) => { x = s; } } return x; } pub fn main() { - let gray: color = rgb(127, 127, 127); - let clear: color = rgba(50, 150, 250, 0); - let red: color = hsl(0, 255, 255); + let gray: color = color::rgb(127, 127, 127); + let clear: color = color::rgba(50, 150, 250, 0); + let red: color = color::hsl(0, 255, 255); assert_eq!(process(gray), 127); assert_eq!(process(clear), 0); assert_eq!(process(red), 255); diff --git a/src/test/run-pass/mut-in-ident-patterns.rs b/src/test/run-pass/mut-in-ident-patterns.rs index f90e5a56d9941..139122b7b8125 100644 --- a/src/test/run-pass/mut-in-ident-patterns.rs +++ b/src/test/run-pass/mut-in-ident-patterns.rs @@ -34,7 +34,7 @@ pub fn main() { Baz(f32, u8) } - let (x, mut y) = (32i, Foo(21)); + let (x, mut y) = (32i, Bar::Foo(21)); match x { mut z @ 32 => { @@ -46,15 +46,15 @@ pub fn main() { } check_bar(&y); - y = Baz(10.0, 3); + y = Bar::Baz(10.0, 3); check_bar(&y); fn check_bar(y: &Bar) { match y { - &Foo(a) => { + &Bar::Foo(a) => { assert_eq!(a, 21); } - &Baz(a, b) => { + &Bar::Baz(a, b) => { assert_eq!(a, 10.0); assert_eq!(b, 3); } diff --git a/src/test/run-pass/nested-pattern.rs b/src/test/run-pass/nested-pattern.rs index 7fe50d667087c..14a84484f649c 100644 --- a/src/test/run-pass/nested-pattern.rs +++ b/src/test/run-pass/nested-pattern.rs @@ -16,9 +16,9 @@ enum t { foo(int, uint), bar(int, Option), } fn nested(o: t) { match o { - bar(_i, Some::(_)) => { println!("wrong pattern matched"); panic!(); } + t::bar(_i, Some::(_)) => { println!("wrong pattern matched"); panic!(); } _ => { println!("succeeded"); } } } -pub fn main() { nested(bar(1, None::)); } +pub fn main() { nested(t::bar(1, None::)); } diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index 450034e12403b..520d067bca326 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -24,14 +24,14 @@ enum E { Thing(int, T), Nothing((), ((), ()), [i8, ..0]) } impl E { fn is_none(&self) -> bool { match *self { - Thing(..) => false, - Nothing(..) => true + E::Thing(..) => false, + E::Nothing(..) => true } } fn get_ref(&self) -> (int, &T) { match *self { - Nothing(..) => panic!("E::get_ref(Nothing::<{}>)", stringify!(T)), - Thing(x, ref y) => (x, y) + E::Nothing(..) => panic!("E::get_ref(Nothing::<{}>)", stringify!(T)), + E::Thing(x, ref y) => (x, y) } } } @@ -54,9 +54,9 @@ macro_rules! check_fancy { check_fancy!($e: $T, |ptr| assert!(*ptr == $e)); }}; ($e:expr: $T:ty, |$v:ident| $chk:expr) => {{ - assert!(Nothing::<$T>((), ((), ()), [23i8, ..0]).is_none()); + assert!(E::Nothing::<$T>((), ((), ()), [23i8, ..0]).is_none()); let e = $e; - let t_ = Thing::<$T>(23, e); + let t_ = E::Thing::<$T>(23, e); match t_.get_ref() { (23, $v) => { $chk } _ => panic!("Thing::<{}>(23, {}).get_ref() != (23, _)", diff --git a/src/test/run-pass/nullary-or-pattern.rs b/src/test/run-pass/nullary-or-pattern.rs index 8e932c4b14b80..565ef278d5d7c 100644 --- a/src/test/run-pass/nullary-or-pattern.rs +++ b/src/test/run-pass/nullary-or-pattern.rs @@ -11,10 +11,10 @@ enum blah { a, b, } fn or_alt(q: blah) -> int { - match q { a | b => { 42 } } + match q { blah::a | blah::b => { 42 } } } pub fn main() { - assert_eq!(or_alt(a), 42); - assert_eq!(or_alt(b), 42); + assert_eq!(or_alt(blah::a), 42); + assert_eq!(or_alt(blah::b), 42); } diff --git a/src/test/run-pass/or-pattern.rs b/src/test/run-pass/or-pattern.rs index a014257fb1c9d..1a42c3ca5948f 100644 --- a/src/test/run-pass/or-pattern.rs +++ b/src/test/run-pass/or-pattern.rs @@ -11,11 +11,11 @@ enum blah { a(int, int, uint), b(int, int), c, } fn or_alt(q: blah) -> int { - match q { a(x, y, _) | b(x, y) => { return x + y; } c => { return 0; } } + match q { blah::a(x, y, _) | blah::b(x, y) => { return x + y; } blah::c => { return 0; } } } pub fn main() { - assert_eq!(or_alt(c), 0); - assert_eq!(or_alt(a(10, 100, 0u)), 110); - assert_eq!(or_alt(b(20, 200)), 220); + assert_eq!(or_alt(blah::c), 0); + assert_eq!(or_alt(blah::a(10, 100, 0u)), 110); + assert_eq!(or_alt(blah::b(20, 200)), 220); } diff --git a/src/test/run-pass/packed-struct-size.rs b/src/test/run-pass/packed-struct-size.rs index e6bfc8ec1a53d..9472fd4ce38ed 100644 --- a/src/test/run-pass/packed-struct-size.rs +++ b/src/test/run-pass/packed-struct-size.rs @@ -53,7 +53,7 @@ struct S7_Option { // Placing packed structs in statics should work static TEST_S4: S4 = S4 { a: 1, b: [2, 3, 4] }; static TEST_S5: S5 = S5 { a: 3, b: 67 }; -static TEST_S3_Foo: S3_Foo = S3_Foo { a: 1, b: 2, c: Baz }; +static TEST_S3_Foo: S3_Foo = S3_Foo { a: 1, b: 2, c: Foo::Baz }; pub fn main() { diff --git a/src/test/run-pass/record-pat.rs b/src/test/run-pass/record-pat.rs index ff87cceba1913..e0db1ed75dc01 100644 --- a/src/test/run-pass/record-pat.rs +++ b/src/test/run-pass/record-pat.rs @@ -14,12 +14,12 @@ enum t3 { c(T2, uint), } fn m(input: t3) -> int { match input { - c(T2 {x: a(m), ..}, _) => { return m; } - c(T2 {x: b(m), y: y}, z) => { return ((m + z) as int) + y; } + t3::c(T2 {x: t1::a(m), ..}, _) => { return m; } + t3::c(T2 {x: t1::b(m), y: y}, z) => { return ((m + z) as int) + y; } } } pub fn main() { - assert_eq!(m(c(T2 {x: a(10), y: 5}, 4u)), 10); - assert_eq!(m(c(T2 {x: b(10u), y: 5}, 4u)), 19); + assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4u)), 10); + assert_eq!(m(t3::c(T2 {x: t1::b(10u), y: 5}, 4u)), 19); } diff --git a/src/test/run-pass/regions-creating-enums2.rs b/src/test/run-pass/regions-creating-enums2.rs index fa795c2c87ba3..f23626643e7c7 100644 --- a/src/test/run-pass/regions-creating-enums2.rs +++ b/src/test/run-pass/regions-creating-enums2.rs @@ -14,7 +14,7 @@ enum ast<'a> { } fn mk_add_ok<'r>(x: &'r ast<'r>, y: &'r ast<'r>) -> ast<'r> { - add(x, y) + ast::add(x, y) } pub fn main() { diff --git a/src/test/run-pass/regions-creating-enums5.rs b/src/test/run-pass/regions-creating-enums5.rs index a95199901d51c..c7d26e2d92b59 100644 --- a/src/test/run-pass/regions-creating-enums5.rs +++ b/src/test/run-pass/regions-creating-enums5.rs @@ -14,7 +14,7 @@ enum ast<'a> { } fn mk_add_ok<'a>(x: &'a ast<'a>, y: &'a ast<'a>, _z: &ast) -> ast<'a> { - add(x, y) + ast::add(x, y) } pub fn main() { diff --git a/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs b/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs index f530053eca42a..978383c244780 100644 --- a/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs +++ b/src/test/run-pass/regions-early-bound-lifetime-in-assoc-fn.rs @@ -30,8 +30,8 @@ pub trait Decodable<'v, D: Decoder<'v>> { impl<'v, D: Decoder<'v>> Decodable<'v, D> for () { fn decode(d: &mut D) -> () { match d.read() { - A(..) => (), - B => Decodable::decode(d), + Value::A(..) => (), + Value::B => Decodable::decode(d), } } } diff --git a/src/test/run-pass/regions-early-bound-trait-param.rs b/src/test/run-pass/regions-early-bound-trait-param.rs index 5de5e39a4545b..faf371e8826b2 100644 --- a/src/test/run-pass/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions-early-bound-trait-param.rs @@ -90,14 +90,14 @@ enum List<'l> { impl<'l> List<'l> { fn car<'m>(&'m self) -> int { match self { - &Cons(car, _) => car, - &Null => panic!(), + &List::Cons(car, _) => car, + &List::Null => panic!(), } } fn cdr<'n>(&'n self) -> &'l List<'l> { match self { - &Cons(_, cdr) => cdr, - &Null => panic!(), + &List::Cons(_, cdr) => cdr, + &List::Null => panic!(), } } } @@ -127,9 +127,9 @@ pub fn main() { // to consume a value of type T and return a &T). Easiest thing // that came to my mind: consume a cell of a linked list and // return a reference to the list it points to. - let l0 = Null; - let l1 = Cons(1, &l0); - let l2 = Cons(2, &l1); + let l0 = List::Null; + let l1 = List::Cons(1, &l0); + let l2 = List::Cons(2, &l1); let rl1 = &l1; let r = make_ref(l2); assert_eq!(rl1.car(), r.car()); diff --git a/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs b/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs index d61d7089d89e6..b16b934d73cc6 100644 --- a/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs +++ b/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs @@ -20,7 +20,7 @@ fn f(o: &mut Option) { pub fn main() { mod t { enum E {V=1, A=0} - static C: E = V; + static C: E = E::V; } f::(&mut None); diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs index ece5faeb2f152..e13edae330ae7 100644 --- a/src/test/run-pass/regions-mock-tcx.rs +++ b/src/test/run-pass/regions-mock-tcx.rs @@ -19,6 +19,8 @@ extern crate arena; extern crate collections; extern crate libc; +use TypeStructure::{TypeInt, TypeFunction}; +use AstKind::{ExprInt, ExprVar, ExprLambda}; use arena::Arena; use std::collections::HashMap; use std::mem; diff --git a/src/test/run-pass/regions-nullary-variant.rs b/src/test/run-pass/regions-nullary-variant.rs index 845ef4017447c..e1359725f9b9f 100644 --- a/src/test/run-pass/regions-nullary-variant.rs +++ b/src/test/run-pass/regions-nullary-variant.rs @@ -13,7 +13,7 @@ enum roption<'a> { } fn mk(cond: bool, ptr: &uint) -> roption { - if cond {a} else {b(ptr)} + if cond {roption::a} else {roption::b(ptr)} } pub fn main() {} diff --git a/src/test/run-pass/regions-scope-chain-example.rs b/src/test/run-pass/regions-scope-chain-example.rs index 0eacb27a600bd..0388ffb7894bf 100644 --- a/src/test/run-pass/regions-scope-chain-example.rs +++ b/src/test/run-pass/regions-scope-chain-example.rs @@ -32,11 +32,11 @@ struct Context<'a> { impl<'a> Context<'a> { fn foo(&mut self, scope: Scope) { let link = if 1i < 2 { - let l = Link(scope); + let l = ScopeChain::Link(scope); self.take_scope(&l); l } else { - Link(scope) + ScopeChain::Link(scope) }; self.take_scope(&link); } diff --git a/src/test/run-pass/regions-self-in-enums.rs b/src/test/run-pass/regions-self-in-enums.rs index 987392c70e3cb..ab0b4acc7698a 100644 --- a/src/test/run-pass/regions-self-in-enums.rs +++ b/src/test/run-pass/regions-self-in-enums.rs @@ -14,10 +14,10 @@ enum int_wrapper<'a> { pub fn main() { let x = 3; - let y = int_wrapper_ctor(&x); + let y = int_wrapper::int_wrapper_ctor(&x); let mut z : ∫ match y { - int_wrapper_ctor(zz) => { z = zz; } + int_wrapper::int_wrapper_ctor(zz) => { z = zz; } } println!("{}", *z); } diff --git a/src/test/run-pass/resolve-issue-2428.rs b/src/test/run-pass/resolve-issue-2428.rs index 8aa12aa3e98ad..016357b5df985 100644 --- a/src/test/run-pass/resolve-issue-2428.rs +++ b/src/test/run-pass/resolve-issue-2428.rs @@ -10,4 +10,4 @@ const foo: int = 4 >> 1; enum bs { thing = foo } -pub fn main() { assert!((thing as int == foo)); } +pub fn main() { assert!((bs::thing as int == foo)); } diff --git a/src/test/run-pass/resource-in-struct.rs b/src/test/run-pass/resource-in-struct.rs index 8e798fc6a0d28..33ae0af250a53 100644 --- a/src/test/run-pass/resource-in-struct.rs +++ b/src/test/run-pass/resource-in-struct.rs @@ -41,7 +41,7 @@ fn sink(_res: option) { } pub fn main() { let c = &Cell::new(true); - sink(none); - sink(some(close_res(c))); + sink(option::none); + sink(option::some(close_res(c))); assert!(!c.get()); } diff --git a/src/test/run-pass/ret-none.rs b/src/test/run-pass/ret-none.rs index b1974f7109560..8d7faffae7f33 100644 --- a/src/test/run-pass/ret-none.rs +++ b/src/test/run-pass/ret-none.rs @@ -12,6 +12,6 @@ enum option { none, some(T), } -fn f() -> option { return none; } +fn f() -> option { return option::none; } pub fn main() { f::(); } diff --git a/src/test/run-pass/shadow.rs b/src/test/run-pass/shadow.rs index 9f553cd2a0061..06d707d3ab099 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -13,8 +13,8 @@ fn foo(c: Vec ) { let mut b: Vec = Vec::new(); - match none:: { - some::(_) => { + match t::none:: { + t::some::(_) => { for _i in c.iter() { println!("{}", a); let a = 17i; diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index 2d6da26df52a3..930364c0e22c8 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -53,7 +53,7 @@ struct X { } pub fn main() { - let sp: Span = Span {lo: 57451u, hi: 57542u, expanded_from: os_none}; + let sp: Span = Span {lo: 57451u, hi: 57542u, expanded_from: opt_span::os_none}; let t: Box = box Spanned { data: 3u, span: sp.clone() }; let p_: Path_ = Path_ { global: true, diff --git a/src/test/run-pass/signed-shift-const-eval.rs b/src/test/run-pass/signed-shift-const-eval.rs index 92c83c22085b0..62f1ca631446d 100644 --- a/src/test/run-pass/signed-shift-const-eval.rs +++ b/src/test/run-pass/signed-shift-const-eval.rs @@ -10,5 +10,5 @@ enum test { thing = -5 >> 1u } pub fn main() { - assert_eq!(thing as int, -3); + assert_eq!(test::thing as int, -3); } diff --git a/src/test/run-pass/simple-generic-match.rs b/src/test/run-pass/simple-generic-match.rs index 3f3b1c8b783a9..27d4f105f3740 100644 --- a/src/test/run-pass/simple-generic-match.rs +++ b/src/test/run-pass/simple-generic-match.rs @@ -12,4 +12,4 @@ enum clam { a(T), } -pub fn main() { let c = a(2); match c { a::(_) => { } } } +pub fn main() { let c = clam::a(2); match c { clam::a::(_) => { } } } diff --git a/src/test/run-pass/simple-match-generic-tag.rs b/src/test/run-pass/simple-match-generic-tag.rs index c0c1135b6d52c..7ed8cb434caf5 100644 --- a/src/test/run-pass/simple-match-generic-tag.rs +++ b/src/test/run-pass/simple-match-generic-tag.rs @@ -13,6 +13,6 @@ enum opt { none, } pub fn main() { - let x = none::; - match x { none:: => { println!("hello world"); } } + let x = opt::none::; + match x { opt::none:: => { println!("hello world"); } } } diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index afb6c21d3f41a..4b587ae70a1c2 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -12,16 +12,16 @@ enum clam { a(T, int), b, } fn uhoh(v: Vec> ) { match v[1] { - a::(ref _t, ref u) => { + clam::a::(ref _t, ref u) => { println!("incorrect"); println!("{}", u); panic!(); } - b:: => { println!("correct"); } + clam::b:: => { println!("correct"); } } } pub fn main() { - let v: Vec> = vec!(b::, b::, a::(42, 17)); + let v: Vec> = vec!(clam::b::, clam::b::, clam::a::(42, 17)); uhoh::(v); } diff --git a/src/test/run-pass/small-enum-range-edge.rs b/src/test/run-pass/small-enum-range-edge.rs index a9fc13437abb4..17d647e58b5e2 100644 --- a/src/test/run-pass/small-enum-range-edge.rs +++ b/src/test/run-pass/small-enum-range-edge.rs @@ -14,19 +14,19 @@ #[repr(u8)] enum Eu { Lu = 0, Hu = 255 } -static CLu: Eu = Lu; -static CHu: Eu = Hu; +static CLu: Eu = Eu::Lu; +static CHu: Eu = Eu::Hu; #[repr(i8)] enum Es { Ls = -128, Hs = 127 } -static CLs: Es = Ls; -static CHs: Es = Hs; +static CLs: Es = Es::Ls; +static CHs: Es = Es::Hs; pub fn main() { - assert_eq!((Hu as u8) + 1, Lu as u8); - assert_eq!((Hs as i8) + 1, Ls as i8); - assert_eq!(CLu as u8, Lu as u8); - assert_eq!(CHu as u8, Hu as u8); - assert_eq!(CLs as i8, Ls as i8); - assert_eq!(CHs as i8, Hs as i8); + assert_eq!((Eu::Hu as u8) + 1, Eu::Lu as u8); + assert_eq!((Es::Hs as i8) + 1, Es::Ls as i8); + assert_eq!(CLu as u8, Eu::Lu as u8); + assert_eq!(CHu as u8, Eu::Hu as u8); + assert_eq!(CLs as i8, Es::Ls as i8); + assert_eq!(CHs as i8, Es::Hs as i8); } diff --git a/src/test/run-pass/small-enums-with-fields.rs b/src/test/run-pass/small-enums-with-fields.rs index 69d574152fae5..cbc3bbadf222c 100644 --- a/src/test/run-pass/small-enums-with-fields.rs +++ b/src/test/run-pass/small-enums-with-fields.rs @@ -36,9 +36,9 @@ pub fn main() { None, "None", Some(-20000i16), "Some(-20000)"); check!(Either, 2, - Left(132u8), "Left(132)", - Right(-32i8), "Right(-32)"); + Either::Left(132u8), "Left(132)", + Either::Right(-32i8), "Right(-32)"); check!(Either, 4, - Left(132u8), "Left(132)", - Right(-20000i16), "Right(-20000)"); + Either::Left(132u8), "Left(132)", + Either::Right(-20000i16), "Right(-20000)"); } diff --git a/src/test/run-pass/struct-like-variant-construct.rs b/src/test/run-pass/struct-like-variant-construct.rs index adb27e6afe6fc..625c1e864ca1a 100644 --- a/src/test/run-pass/struct-like-variant-construct.rs +++ b/src/test/run-pass/struct-like-variant-construct.rs @@ -22,5 +22,5 @@ enum Foo { } pub fn main() { - let _x = Bar { a: 2, b: 3 }; + let _x = Foo::Bar { a: 2, b: 3 }; } diff --git a/src/test/run-pass/struct-like-variant-match.rs b/src/test/run-pass/struct-like-variant-match.rs index ba25fe11a3a66..3097b4005d848 100644 --- a/src/test/run-pass/struct-like-variant-match.rs +++ b/src/test/run-pass/struct-like-variant-match.rs @@ -23,11 +23,11 @@ enum Foo { fn f(x: &Foo) { match *x { - Baz { x: x, y: y } => { + Foo::Baz { x: x, y: y } => { assert_eq!(x, 1.0); assert_eq!(y, 2.0); } - Bar { y: y, x: x } => { + Foo::Bar { y: y, x: x } => { assert_eq!(x, 1); assert_eq!(y, 2); } @@ -35,8 +35,8 @@ fn f(x: &Foo) { } pub fn main() { - let x = Bar { x: 1, y: 2 }; + let x = Foo::Bar { x: 1, y: 2 }; f(&x); - let y = Baz { x: 1.0, y: 2.0 }; + let y = Foo::Baz { x: 1.0, y: 2.0 }; f(&y); } diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs index dbf8a084da110..88f72932ca057 100644 --- a/src/test/run-pass/structured-compare.rs +++ b/src/test/run-pass/structured-compare.rs @@ -29,9 +29,9 @@ pub fn main() { assert!((a <= (1, 2, 4))); assert!(((1i, 2i, 4i) > a)); assert!(((1i, 2i, 4i) >= a)); - let x = large; - let y = small; + let x = foo::large; + let y = foo::small; assert!((x != y)); - assert_eq!(x, large); - assert!((x != small)); + assert_eq!(x, foo::large); + assert!((x != foo::small)); } diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index f33483d31bfca..06092200a1456 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -15,10 +15,10 @@ use std::ptr; pub fn main() { let mut test = TestDescAndFn { desc: TestDesc { - name: DynTestName("test".to_string()), + name: TestName::DynTestName("test".to_string()), should_fail: false }, - testfn: DynTestFn(proc() ()), + testfn: TestFn::DynTestFn(proc() ()), }; do_swap(&mut test); } diff --git a/src/test/run-pass/tag-align-dyn-u64.rs b/src/test/run-pass/tag-align-dyn-u64.rs index d6a154edd789b..7805204aa05d1 100644 --- a/src/test/run-pass/tag-align-dyn-u64.rs +++ b/src/test/run-pass/tag-align-dyn-u64.rs @@ -23,7 +23,7 @@ struct Rec { } fn mk_rec() -> Rec { - return Rec { c8:0u8, t:Tag2(0u64) }; + return Rec { c8:0u8, t:Tag::Tag2(0u64) }; } fn is_8_byte_aligned(u: &Tag) -> bool { diff --git a/src/test/run-pass/tag-align-dyn-variants.rs b/src/test/run-pass/tag-align-dyn-variants.rs index 130c2c5e2e381..aef9e23ce4989 100644 --- a/src/test/run-pass/tag-align-dyn-variants.rs +++ b/src/test/run-pass/tag-align-dyn-variants.rs @@ -26,7 +26,7 @@ struct Rec { } fn mk_rec(a: A, b: B) -> Rec { - Rec { chA:0u8, tA:VarA(a), chB:1u8, tB:VarB(b) } + Rec { chA:0u8, tA:Tag::VarA(a), chB:1u8, tB:Tag::VarB(b) } } fn is_aligned(amnt: uint, u: &A) -> bool { @@ -36,8 +36,8 @@ fn is_aligned(amnt: uint, u: &A) -> bool { fn variant_data_is_aligned(amnt: uint, u: &Tag) -> bool { match u { - &VarA(ref a) => is_aligned(amnt, a), - &VarB(ref b) => is_aligned(amnt, b) + &Tag::VarA(ref a) => is_aligned(amnt, a), + &Tag::VarB(ref b) => is_aligned(amnt, b) } } diff --git a/src/test/run-pass/tag-align-shape.rs b/src/test/run-pass/tag-align-shape.rs index 10317c1dd0223..ad96f9d968087 100644 --- a/src/test/run-pass/tag-align-shape.rs +++ b/src/test/run-pass/tag-align-shape.rs @@ -20,7 +20,7 @@ struct t_rec { } pub fn main() { - let x = t_rec {c8: 22u8, t: a_tag_var(44u64)}; + let x = t_rec {c8: 22u8, t: a_tag::a_tag_var(44u64)}; let y = format!("{}", x); println!("y = {}", y); assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_string()); diff --git a/src/test/run-pass/tag-align-u64.rs b/src/test/run-pass/tag-align-u64.rs index 398a0939d97d7..be84888477c3e 100644 --- a/src/test/run-pass/tag-align-u64.rs +++ b/src/test/run-pass/tag-align-u64.rs @@ -23,7 +23,7 @@ struct Rec { } fn mk_rec() -> Rec { - return Rec { c8:0u8, t:TagInner(0u64) }; + return Rec { c8:0u8, t:Tag::TagInner(0u64) }; } fn is_8_byte_aligned(u: &Tag) -> bool { diff --git a/src/test/run-pass/tag-disr-val-shape.rs b/src/test/run-pass/tag-disr-val-shape.rs index 75345555554c6..491d83414a1dd 100644 --- a/src/test/run-pass/tag-disr-val-shape.rs +++ b/src/test/run-pass/tag-disr-val-shape.rs @@ -18,9 +18,9 @@ enum color { } pub fn main() { - let act = format!("{}", red); + let act = format!("{}", color::red); println!("{}", act); assert_eq!("red".to_string(), act); - assert_eq!("green".to_string(), format!("{}", green)); - assert_eq!("white".to_string(), format!("{}", white)); + assert_eq!("green".to_string(), format!("{}", color::green)); + assert_eq!("white".to_string(), format!("{}", color::white)); } diff --git a/src/test/run-pass/tag-exports.rs b/src/test/run-pass/tag-exports.rs index fa390954b979f..2177ab01db9c3 100644 --- a/src/test/run-pass/tag-exports.rs +++ b/src/test/run-pass/tag-exports.rs @@ -21,8 +21,8 @@ mod alder { } pub fn main() { - let _pettygrove: burnside = couch; - let _quimby: everett = flanders; - let _raleigh: irving = johnson; + let _pettygrove: burnside = burnside::couch; + let _quimby: everett = everett::flanders; + let _raleigh: irving = irving::johnson; let _savier: marshall; } diff --git a/src/test/run-pass/tag-in-block.rs b/src/test/run-pass/tag-in-block.rs index 99eacb54d17e4..4cb189ee43ffe 100644 --- a/src/test/run-pass/tag-in-block.rs +++ b/src/test/run-pass/tag-in-block.rs @@ -13,7 +13,7 @@ fn foo() { fn zed(_z: bar) { } enum bar { nil, } - fn baz() { zed(nil); } + fn baz() { zed(bar::nil); } } pub fn main() { } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index ac9af2b693dd4..7aa2ba280acaf 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -7,6 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. +use color::{red, green, blue, black, white, imaginary, purple, orange}; enum color { red = 0xff0000, diff --git a/src/test/run-pass/tag.rs b/src/test/run-pass/tag.rs index 91c8b433b4e6b..45b6871e401bd 100644 --- a/src/test/run-pass/tag.rs +++ b/src/test/run-pass/tag.rs @@ -14,16 +14,16 @@ enum colour { red(int, int), green, } impl PartialEq for colour { fn eq(&self, other: &colour) -> bool { match *self { - red(a0, b0) => { + colour::red(a0, b0) => { match (*other) { - red(a1, b1) => a0 == a1 && b0 == b1, - green => false, + colour::red(a1, b1) => a0 == a1 && b0 == b1, + colour::green => false, } } - green => { + colour::green => { match (*other) { - red(..) => false, - green => true + colour::red(..) => false, + colour::green => true } } } @@ -31,6 +31,6 @@ impl PartialEq for colour { fn ne(&self, other: &colour) -> bool { !(*self).eq(other) } } -fn f() { let x = red(1, 2); let y = green; assert!((x != y)); } +fn f() { let x = colour::red(1, 2); let y = colour::green; assert!((x != y)); } pub fn main() { f(); } diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index a6cc8c463e808..9143385254095 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -55,21 +55,21 @@ enum t { impl cmp::PartialEq for t { fn eq(&self, other: &t) -> bool { match *self { - tag1 => { + t::tag1 => { match (*other) { - tag1 => true, + t::tag1 => true, _ => false } } - tag2(e0a) => { + t::tag2(e0a) => { match (*other) { - tag2(e0b) => e0a == e0b, + t::tag2(e0b) => e0a == e0b, _ => false } } - tag3(e0a, e1a, e2a) => { + t::tag3(e0a, e1a, e2a) => { match (*other) { - tag3(e0b, e1b, e2b) => + t::tag3(e0b, e1b, e2b) => e0a == e0b && e1a == e1b && e2a == e2b, _ => false } @@ -81,16 +81,16 @@ impl cmp::PartialEq for t { fn test_tag() { let (tx, rx) = channel(); - tx.send(tag1); - tx.send(tag2(10)); - tx.send(tag3(10, 11u8, 'A')); + tx.send(t::tag1); + tx.send(t::tag2(10)); + tx.send(t::tag3(10, 11u8, 'A')); let mut t1: t; t1 = rx.recv(); - assert_eq!(t1, tag1); + assert_eq!(t1, t::tag1); t1 = rx.recv(); - assert_eq!(t1, tag2(10)); + assert_eq!(t1, t::tag2(10)); t1 = rx.recv(); - assert_eq!(t1, tag3(10, 11u8, 'A')); + assert_eq!(t1, t::tag3(10, 11u8, 'A')); } fn test_chan() { diff --git a/src/test/run-pass/trailing-comma.rs b/src/test/run-pass/trailing-comma.rs index 394ff831d9bd6..5e93f8eedb7eb 100644 --- a/src/test/run-pass/trailing-comma.rs +++ b/src/test/run-pass/trailing-comma.rs @@ -34,5 +34,5 @@ pub fn main() { Bar.g(0i,); Bar.h(); - let x = Qux(1,); + let x = Baz::Qux(1,); } diff --git a/src/test/run-pass/trait-object-generics.rs b/src/test/run-pass/trait-object-generics.rs index b20915763f250..81aa5daaf91ce 100644 --- a/src/test/run-pass/trait-object-generics.rs +++ b/src/test/run-pass/trait-object-generics.rs @@ -44,5 +44,5 @@ impl Trait for () { pub fn main() { let a = box() () as Box>; - assert_eq!(a.method(Constant), 0); + assert_eq!(a.method(Type::Constant), 0); } diff --git a/src/test/run-pass/traits-default-method-macro.rs b/src/test/run-pass/traits-default-method-macro.rs index 29fc2fd5a7a02..245ae540ee895 100644 --- a/src/test/run-pass/traits-default-method-macro.rs +++ b/src/test/run-pass/traits-default-method-macro.rs @@ -23,6 +23,6 @@ impl Foo for Baz { } pub fn main() { - let q = Quux; + let q = Baz::Quux; assert_eq!(q.bar(), "test".to_string()); } diff --git a/src/test/run-pass/trans-tag-static-padding.rs b/src/test/run-pass/trans-tag-static-padding.rs index 93aa367feee82..6d0ae8f67cd4d 100644 --- a/src/test/run-pass/trans-tag-static-padding.rs +++ b/src/test/run-pass/trans-tag-static-padding.rs @@ -35,7 +35,7 @@ fn default_instance() -> &'static Request { static instance: Request = Request { // LLVM does not allow to specify alignment of expressions, thus // alignment of `foo` in constant is 1, not 8. - foo: TestNone, + foo: TestOption::TestNone, bar: 17, // Space after last field is not occupied by any data, but it is // reserved to make struct aligned properly. If compiler does @@ -48,7 +48,7 @@ fn default_instance() -> &'static Request { fn non_default_instance() -> &'static Request { static instance: Request = Request { - foo: TestSome(0x1020304050607080), + foo: TestOption::TestSome(0x1020304050607080), bar: 19, }; &instance @@ -56,11 +56,11 @@ fn non_default_instance() -> &'static Request { pub fn main() { match default_instance() { - &Request { foo: TestNone, bar: 17 } => {}, + &Request { foo: TestOption::TestNone, bar: 17 } => {}, _ => panic!(), }; match non_default_instance() { - &Request { foo: TestSome(0x1020304050607080), bar: 19 } => {}, + &Request { foo: TestOption::TestSome(0x1020304050607080), bar: 19 } => {}, _ => panic!(), }; } diff --git a/src/test/run-pass/typeck-macro-interaction-issue-8852.rs b/src/test/run-pass/typeck-macro-interaction-issue-8852.rs index 48d073e28aa75..1b08955adfce8 100644 --- a/src/test/run-pass/typeck-macro-interaction-issue-8852.rs +++ b/src/test/run-pass/typeck-macro-interaction-issue-8852.rs @@ -24,8 +24,8 @@ macro_rules! test( ($id1:ident, $id2:ident, $e:expr) => ( fn foo(a:T, b:T) -> T { match (a, b) { - (A($id1), A($id2)) => A($e), - (B($id1), B($id2)) => B($e), + (T::A($id1), T::A($id2)) => T::A($e), + (T::B($id1), T::B($id2)) => T::B($e), _ => panic!() } } @@ -35,5 +35,5 @@ macro_rules! test( test!(x,y,x + y) pub fn main() { - foo(A(1), A(2)); + foo(T::A(1), T::A(2)); } diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs index 6d8e7d1aaf3fd..a5547c0eea98b 100644 --- a/src/test/run-pass/typeclasses-eq-example-static.rs +++ b/src/test/run-pass/typeclasses-eq-example-static.rs @@ -11,6 +11,8 @@ // Example from lkuper's intern talk, August 2012 -- now with static // methods! +use Color::{cyan, magenta, yellow, black}; +use ColorTree::{leaf, branch}; trait Equal { fn isEq(a: &Self, b: &Self) -> bool; diff --git a/src/test/run-pass/typeclasses-eq-example.rs b/src/test/run-pass/typeclasses-eq-example.rs index cbb85b2b7b814..21b9c774e8c43 100644 --- a/src/test/run-pass/typeclasses-eq-example.rs +++ b/src/test/run-pass/typeclasses-eq-example.rs @@ -10,6 +10,8 @@ // Example from lkuper's intern talk, August 2012. +use Color::{cyan, magenta, yellow, black}; +use ColorTree::{leaf, branch}; trait Equal { fn isEq(&self, a: &Self) -> bool; diff --git a/src/test/run-pass/unique-containing-tag.rs b/src/test/run-pass/unique-containing-tag.rs index 3c67eaee0a6a2..ccb21b605c191 100644 --- a/src/test/run-pass/unique-containing-tag.rs +++ b/src/test/run-pass/unique-containing-tag.rs @@ -11,7 +11,7 @@ pub fn main() { enum t { t1(int), t2(int), } - let _x = box t1(10); + let _x = box t::t1(10); /*alt *x { t1(a) { diff --git a/src/test/run-pass/unique-in-tag.rs b/src/test/run-pass/unique-in-tag.rs index b1d351ef7b431..ffff9b98f54e8 100644 --- a/src/test/run-pass/unique-in-tag.rs +++ b/src/test/run-pass/unique-in-tag.rs @@ -11,9 +11,9 @@ fn test1() { enum bar { u(Box), w(int), } - let x = u(box 10); + let x = bar::u(box 10); assert!(match x { - u(a) => { + bar::u(a) => { println!("{}", a); *a } diff --git a/src/test/run-pass/unique-pat-2.rs b/src/test/run-pass/unique-pat-2.rs index 3f7138006e510..bf99f06f58ab5 100644 --- a/src/test/run-pass/unique-pat-2.rs +++ b/src/test/run-pass/unique-pat-2.rs @@ -14,8 +14,8 @@ struct Foo {a: int, b: uint} enum bar { u(Box), w(int), } pub fn main() { - assert!(match u(box Foo{a: 10, b: 40u}) { - u(box Foo{a: a, b: b}) => { a + (b as int) } + assert!(match bar::u(box Foo{a: 10, b: 40u}) { + bar::u(box Foo{a: a, b: b}) => { a + (b as int) } _ => { 66 } } == 50); } diff --git a/src/test/run-pass/unique-pat-3.rs b/src/test/run-pass/unique-pat-3.rs index f031f77908522..559d8f8cb3ca1 100644 --- a/src/test/run-pass/unique-pat-3.rs +++ b/src/test/run-pass/unique-pat-3.rs @@ -11,8 +11,8 @@ enum bar { u(Box), w(int), } pub fn main() { - assert!(match u(box 10) { - u(a) => { + assert!(match bar::u(box 10) { + bar::u(a) => { println!("{}", a); *a } diff --git a/src/test/run-pass/use-uninit-match.rs b/src/test/run-pass/use-uninit-match.rs index 7382d7a1acfd8..3f23d714c0f0a 100644 --- a/src/test/run-pass/use-uninit-match.rs +++ b/src/test/run-pass/use-uninit-match.rs @@ -13,8 +13,8 @@ fn foo(o: myoption) -> int { let mut x: int = 5; match o { - none:: => { } - some::(_t) => { x += 1; } + myoption::none:: => { } + myoption::some::(_t) => { x += 1; } } return x; } diff --git a/src/test/run-pass/use-uninit-match2.rs b/src/test/run-pass/use-uninit-match2.rs index 9337d064d2397..de5b32dd17688 100644 --- a/src/test/run-pass/use-uninit-match2.rs +++ b/src/test/run-pass/use-uninit-match2.rs @@ -13,8 +13,8 @@ fn foo(o: myoption) -> int { let mut x: int; match o { - none:: => { panic!(); } - some::(_t) => { x = 5; } + myoption::none:: => { panic!(); } + myoption::some::(_t) => { x = 5; } } return x; } diff --git a/src/test/run-pass/variant-attributes.rs b/src/test/run-pass/variant-attributes.rs index 43ce1082b2b82..88255ad94fd46 100644 --- a/src/test/run-pass/variant-attributes.rs +++ b/src/test/run-pass/variant-attributes.rs @@ -36,4 +36,7 @@ enum crew_of_enterprise_d { fn boldly_go(_crew_member: crew_of_enterprise_d, _where: String) { } -pub fn main() { boldly_go(worf, "where no one has gone before".to_string()); } +pub fn main() { + boldly_go(crew_of_enterprise_d::worf, + "where no one has gone before".to_string()); +} diff --git a/src/test/run-pass/while-prelude-drop.rs b/src/test/run-pass/while-prelude-drop.rs index 28fbab41d95e0..db9cf0abda3d7 100644 --- a/src/test/run-pass/while-prelude-drop.rs +++ b/src/test/run-pass/while-prelude-drop.rs @@ -14,12 +14,12 @@ use std::string::String; enum t { a, b(String), } fn make(i: int) -> t { - if i > 10 { return a; } + if i > 10 { return t::a; } let mut s = String::from_str("hello"); // Ensure s is non-const. s.push_str("there"); - return b(s); + return t::b(s); } pub fn main() { @@ -27,5 +27,5 @@ pub fn main() { // The auto slot for the result of make(i) should not leak. - while make(i) != a { i += 1; } + while make(i) != t::a { i += 1; } }