]> git.lizzy.rs Git - rust.git/commitdiff
Switch some tuple structs to pub fields
authorAlex Crichton <alex@alexcrichton.com>
Tue, 1 Apr 2014 02:01:01 +0000 (19:01 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 1 Apr 2014 02:50:51 +0000 (19:50 -0700)
This commit deals with the fallout of the previous change by making tuples
structs have public fields where necessary (now that the fields are private by
default).

25 files changed:
src/librand/distributions/exponential.rs
src/librand/distributions/normal.rs
src/librand/lib.rs
src/librustc/middle/graph.rs
src/librustc/middle/trans/basic_block.rs
src/librustc/middle/trans/value.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/infer/coercion.rs
src/librustc/middle/typeck/infer/glb.rs
src/librustc/middle/typeck/infer/lub.rs
src/librustc/middle/typeck/infer/sub.rs
src/librustdoc/html/escape.rs
src/librustdoc/html/format.rs
src/librustdoc/html/markdown.rs
src/libstd/rt/task.rs
src/libstd/unstable/simd.rs
src/libsyntax/ast_map.rs
src/libsyntax/codemap.rs
src/test/auxiliary/issue-11508.rs
src/test/auxiliary/issue-11529.rs
src/test/auxiliary/issue-7899.rs
src/test/auxiliary/issue_10031_aux.rs
src/test/auxiliary/issue_2472_b.rs
src/test/auxiliary/lint_stability.rs
src/test/auxiliary/newtype_struct_xc.rs

index 5a6b925c53fdb442884a7e47eeb689f974323011..8b609875dbd9e71795c90934a998e5a3d6e8d637 100644 (file)
@@ -28,7 +28,7 @@
 /// Generate Normal Random
 /// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
 /// College, Oxford
-pub struct Exp1(f64);
+pub struct Exp1(pub f64);
 
 // This could be done via `-rng.gen::<f64>().ln()` but that is slower.
 impl Rand for Exp1 {
index 42fb76ad4eb48975e44cc0c58f1179fc4f756b06..85132de41c3cb2bae119363ed8c8be0ffb99d928 100644 (file)
@@ -27,7 +27,7 @@
 /// Generate Normal Random
 /// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
 /// College, Oxford
-pub struct StandardNormal(f64);
+pub struct StandardNormal(pub f64);
 
 impl Rand for StandardNormal {
     fn rand<R:Rng>(rng: &mut R) -> StandardNormal {
index d9920501ab07138e6d10e72ed24c696f377595be..e75ed1d67a6d03fee4f9a6e4e3453205bad0bb2f 100644 (file)
@@ -658,7 +658,7 @@ pub fn random<T: Rand>() -> T {
 /// let Open01(val) = random::<Open01<f32>>();
 /// println!("f32 from (0,1): {}", val);
 /// ```
-pub struct Open01<F>(F);
+pub struct Open01<F>(pub F);
 
 /// A wrapper for generating floating point numbers uniformly in the
 /// closed interval `[0,1]` (including both endpoints).
@@ -674,7 +674,7 @@ pub fn random<T: Rand>() -> T {
 /// let Closed01(val) = random::<Closed01<f32>>();
 /// println!("f32 from [0,1]: {}", val);
 /// ```
-pub struct Closed01<F>(F);
+pub struct Closed01<F>(pub F);
 
 #[cfg(test)]
 mod test {
index fd27cabaf7fbab23746b66b8b5b07e44a79a4cb0..88301967a8cca9e64d0c66965a501fa5c92c378e 100644 (file)
@@ -54,11 +54,11 @@ pub struct Edge<E> {
 }
 
 #[deriving(Eq)]
-pub struct NodeIndex(uint);
+pub struct NodeIndex(pub uint);
 pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
 
 #[deriving(Eq)]
-pub struct EdgeIndex(uint);
+pub struct EdgeIndex(pub uint);
 pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
 
 // Use a private field here to guarantee no more instances are created:
index 074c9f4fec515d80e621231c16b4ebb8280f8cfa..303ad5fbce2ce25283fc13cd4820f60e9121297f 100644 (file)
@@ -12,7 +12,7 @@
 use middle::trans::value::{Users, Value};
 use std::iter::{Filter, Map};
 
-pub struct BasicBlock(BasicBlockRef);
+pub struct BasicBlock(pub BasicBlockRef);
 
 pub type Preds<'a> = Map<'a, Value, BasicBlock, Filter<'a, Value, Users>>;
 
index f66a393a50f9d98c48b8323897aadafcff26a0b6..1efb47ad42fb5bc0daa36bf80d640e90b1aca651 100644 (file)
@@ -13,7 +13,7 @@
 use middle::trans::common::Block;
 use std::libc::c_uint;
 
-pub struct Value(ValueRef);
+pub struct Value(pub ValueRef);
 
 macro_rules! opt_val ( ($e:expr) => (
     unsafe {
index 8a616496f064d05fb2b3fc3ac103d8e3f44d779a..9a3064268dcb293e999a9b2ca18de991daa2c718 100644 (file)
@@ -869,13 +869,13 @@ fn from_uint(v: uint) -> BuiltinBound {
 }
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct TyVid(uint);
+pub struct TyVid(pub uint);
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct IntVid(uint);
+pub struct IntVid(pub uint);
 
 #[deriving(Clone, Eq, TotalEq, Hash)]
-pub struct FloatVid(uint);
+pub struct FloatVid(pub uint);
 
 #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
 pub struct RegionVid {
index 5dc55ab4b5c07056084b91e5b0cbb60c73d48fa4..a9a0e4b7b3736e1f831a66680dd6754646c0cff5 100644 (file)
@@ -83,7 +83,7 @@ fn foo<A>(a: A, b: A) { ... }
 // Note: Coerce is not actually a combiner, in that it does not
 // conform to the same interface, though it performs a similar
 // function.
-pub struct Coerce<'f>(CombineFields<'f>);
+pub struct Coerce<'f>(pub CombineFields<'f>);
 
 impl<'f> Coerce<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> {
index e846e3621bd46137fee75ea740fcd9aceb0f7f75..83fc315bcebc82f1465638f86828c275505eb6d9 100644 (file)
@@ -28,7 +28,7 @@
 use util::common::{indenter};
 use util::ppaux::mt_to_str;
 
-pub struct Glb<'f>(CombineFields<'f>);  // "greatest lower bound" (common subtype)
+pub struct Glb<'f>(pub CombineFields<'f>);  // "greatest lower bound" (common subtype)
 
 impl<'f> Glb<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Glb(ref v) = *self; v }
index e63ad7322b9aebfb2dd5b533fdcb47985a305602..7c302c72014057dcf33b688c00b25862e3c07480 100644 (file)
@@ -27,7 +27,7 @@
 use syntax::ast::{Onceness, Purity};
 use util::ppaux::mt_to_str;
 
-pub struct Lub<'f>(CombineFields<'f>);  // least-upper-bound: common supertype
+pub struct Lub<'f>(pub CombineFields<'f>);  // least-upper-bound: common supertype
 
 impl<'f> Lub<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Lub(ref v) = *self; v }
index ef17a593654842dbc0666162bd45ba52f6685d90..b22e6f4677bd72d820234035fac339341ae4b43d 100644 (file)
@@ -27,7 +27,7 @@
 
 use syntax::ast::{Onceness, Purity};
 
-pub struct Sub<'f>(CombineFields<'f>);  // "subtype", "subregion" etc
+pub struct Sub<'f>(pub CombineFields<'f>);  // "subtype", "subregion" etc
 
 impl<'f> Sub<'f> {
     pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Sub(ref v) = *self; v }
index bb6b1eeaedd5ee3995f00afddce270cfac94a7f0..60fcbe33a1be956e8e6671530e7d1aea5517ec76 100644 (file)
@@ -17,7 +17,7 @@
 
 /// Wrapper struct which will emit the HTML-escaped version of the contained
 /// string when passed to a format string.
-pub struct Escape<'a>(&'a str);
+pub struct Escape<'a>(pub &'a str);
 
 impl<'a> fmt::Show for Escape<'a> {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
index acf6446a191f1ad7dc2166c9420d8c8c990d7e79..10c155262c31e504c2fbddb35fb81c192a070f04 100644 (file)
 
 /// Helper to render an optional visibility with a space after it (if the
 /// visibility is preset)
-pub struct VisSpace(Option<ast::Visibility>);
+pub struct VisSpace(pub Option<ast::Visibility>);
 /// Similarly to VisSpace, this structure is used to render a purity with a
 /// space after it.
-pub struct PuritySpace(ast::Purity);
+pub struct PuritySpace(pub ast::Purity);
 /// Wrapper struct for properly emitting a method declaration.
-pub struct Method<'a>(&'a clean::SelfTy, &'a clean::FnDecl);
+pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
 
 impl VisSpace {
     pub fn get(&self) -> Option<ast::Visibility> {
index c52a6267657b377919b43bb9f4aba7dd0be8395f..ff2462cfb22ba28f526dc2f3182fc398cebd350a 100644 (file)
 /// A unit struct which has the `fmt::Show` trait implemented. When
 /// formatted, this struct will emit the HTML corresponding to the rendered
 /// version of the contained markdown string.
-pub struct Markdown<'a>(&'a str);
+pub struct Markdown<'a>(pub &'a str);
 /// A unit struct like `Markdown`, that renders the markdown with a
 /// table of contents.
-pub struct MarkdownWithToc<'a>(&'a str);
+pub struct MarkdownWithToc<'a>(pub &'a str);
 
 static OUTPUT_UNIT: libc::size_t = 64;
 static MKDEXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 0;
index d9700ea998018868917e99a2cac19b8790275e34..d36452653e3965f6126127a08ae3b9746d25f791 100644 (file)
@@ -58,7 +58,7 @@ pub struct Task {
 }
 
 pub struct GarbageCollector;
-pub struct LocalStorage(Option<local_data::Map>);
+pub struct LocalStorage(pub Option<local_data::Map>);
 
 /// A handle to a blocked task. Usually this means having the ~Task pointer by
 /// ownership, but if the task is killable, a killer can steal it at any time.
index 01200833b195d699d7f0738ed25d136499d683e7..a7a314d35e7368bdf62d270b66d38ac72055fcc4 100644 (file)
 
 #[experimental]
 #[simd]
-pub struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8);
+pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
+                 pub i8, pub i8, pub i8, pub i8,
+                 pub i8, pub i8, pub i8, pub i8,
+                 pub i8, pub i8, pub i8, pub i8);
 
 #[experimental]
 #[simd]
-pub struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
+pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
+                 pub i16, pub i16, pub i16, pub i16);
 
 #[experimental]
 #[simd]
-pub struct i32x4(i32, i32, i32, i32);
+pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
 
 #[experimental]
 #[simd]
-pub struct i64x2(i64, i64);
+pub struct i64x2(pub i64, pub i64);
 
 #[experimental]
 #[simd]
-pub struct u8x16(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8);
+pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
+                 pub u8, pub u8, pub u8, pub u8,
+                 pub u8, pub u8, pub u8, pub u8,
+                 pub u8, pub u8, pub u8, pub u8);
 
 #[experimental]
 #[simd]
-pub struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16);
+pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
+                 pub u16, pub u16, pub u16, pub u16);
 
 #[experimental]
 #[simd]
-pub struct u32x4(u32, u32, u32, u32);
+pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
 
 #[experimental]
 #[simd]
-pub struct u64x2(u64, u64);
+pub struct u64x2(pub u64, pub u64);
 
 #[experimental]
 #[simd]
-pub struct f32x4(f32, f32, f32, f32);
+pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
 
 #[experimental]
 #[simd]
-pub struct f64x2(f64, f64);
+pub struct f64x2(pub f64, pub f64);
index f07b0e71c1ce1245f9a9c30482851da13ac2ef73..d380c1aca100c6e1f997b23f3688c5adaa698657 100644 (file)
@@ -66,7 +66,7 @@ fn next(&mut self) -> Option<PathElem> {
 
 // HACK(eddyb) move this into libstd (value wrapper for slice::Items).
 #[deriving(Clone)]
-pub struct Values<'a, T>(slice::Items<'a, T>);
+pub struct Values<'a, T>(pub slice::Items<'a, T>);
 
 impl<'a, T: Copy> Iterator<T> for Values<'a, T> {
     fn next(&mut self) -> Option<T> {
index 0d2492d7fad0f0de698ab6591c14fa8a39c076ba..7cadce547659446734e0078bba547f8a4e4ce135 100644 (file)
@@ -33,13 +33,13 @@ pub trait Pos {
 /// A byte offset. Keep this small (currently 32-bits), as AST contains
 /// a lot of them.
 #[deriving(Clone, Eq, TotalEq, Hash, Ord, Show)]
-pub struct BytePos(u32);
+pub struct BytePos(pub u32);
 
 /// A character offset. Because of multibyte utf8 characters, a byte offset
 /// is not equivalent to a character offset. The CodeMap will convert BytePos
 /// values to CharPos values as necessary.
 #[deriving(Eq, Hash, Ord, Show)]
-pub struct CharPos(uint);
+pub struct CharPos(pub uint);
 
 // FIXME: Lots of boilerplate in these impls, but so far my attempts to fix
 // have been unsuccessful
index dfdde5e5e4e03530b127c78a4eebeba6d95215b3..c5dc3439f2f8d78ef407b820232c1637e64b9fc1 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct Closed01<F>(F);
+pub struct Closed01<F>(pub F);
 
 pub trait Bar { fn new() -> Self; }
 
index 9d5005324010e7cf14f6d99dd9ff5607f064adb9..a8a4c438e67343905d49322a963a57666cfdecf3 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct A<'a>(&'a int);
+pub struct A<'a>(pub &'a int);
index f1a0fcffd165877514e9554835ac097b17f44a1c..e197e84442b10d23b7585f61d06ebfe2594ce2de 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct V2<T>(T, T);
+pub struct V2<T>(pub T, pub T);
index 5724d876ef43dd8b1ae886d4c0e592034a060505..f0f1af2e3a3da9478255989cfede9ecbc0fc9ba1 100644 (file)
@@ -8,4 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-pub struct Wrap<A>(A);
+pub struct Wrap<A>(pub A);
index 1475b1a75a6652b3874c570fad115316a4ce7a33..5f55476427fe2fd7bdfeed380210e33a26353f03 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 
-pub struct S(());
+pub struct S(pub ());
 
 impl S {
     pub fn foo(&self) { }
index 30224912d9265666eeec2b9b7ce6cc75b463496f..5afbf4492b30d778a172cc8e838ee892526ded77 100644 (file)
@@ -161,15 +161,15 @@ pub enum Enum {
 }
 
 #[deprecated]
-pub struct DeprecatedTupleStruct(int);
+pub struct DeprecatedTupleStruct(pub int);
 #[experimental]
-pub struct ExperimentalTupleStruct(int);
+pub struct ExperimentalTupleStruct(pub int);
 #[unstable]
-pub struct UnstableTupleStruct(int);
-pub struct UnmarkedTupleStruct(int);
+pub struct UnstableTupleStruct(pub int);
+pub struct UnmarkedTupleStruct(pub int);
 #[stable]
-pub struct StableTupleStruct(int);
+pub struct StableTupleStruct(pub int);
 #[frozen]
-pub struct FrozenTupleStruct(int);
+pub struct FrozenTupleStruct(pub int);
 #[locked]
-pub struct LockedTupleStruct(int);
+pub struct LockedTupleStruct(pub int);
index 3833b549b5fc009877402bb42edeea1ec22d0e3f..60c64842c71468d5af50412fdea491abdcd958b3 100644 (file)
@@ -10,4 +10,4 @@
 
 #[crate_type="lib"];
 
-pub struct Au(int);
+pub struct Au(pub int);