Skip to content

Commit 922dcfd

Browse files
committed
Switch some tuple structs to pub fields
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).
1 parent 6831979 commit 922dcfd

25 files changed

+56
-48
lines changed

src/librand/distributions/exponential.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
2828
/// Generate Normal Random
2929
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
3030
/// College, Oxford
31-
pub struct Exp1(f64);
31+
pub struct Exp1(pub f64);
3232

3333
// This could be done via `-rng.gen::<f64>().ln()` but that is slower.
3434
impl Rand for Exp1 {

src/librand/distributions/normal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
2727
/// Generate Normal Random
2828
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
2929
/// College, Oxford
30-
pub struct StandardNormal(f64);
30+
pub struct StandardNormal(pub f64);
3131

3232
impl Rand for StandardNormal {
3333
fn rand<R:Rng>(rng: &mut R) -> StandardNormal {

src/librand/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ pub fn random<T: Rand>() -> T {
658658
/// let Open01(val) = random::<Open01<f32>>();
659659
/// println!("f32 from (0,1): {}", val);
660660
/// ```
661-
pub struct Open01<F>(F);
661+
pub struct Open01<F>(pub F);
662662

663663
/// A wrapper for generating floating point numbers uniformly in the
664664
/// closed interval `[0,1]` (including both endpoints).
@@ -674,7 +674,7 @@ pub struct Open01<F>(F);
674674
/// let Closed01(val) = random::<Closed01<f32>>();
675675
/// println!("f32 from [0,1]: {}", val);
676676
/// ```
677-
pub struct Closed01<F>(F);
677+
pub struct Closed01<F>(pub F);
678678

679679
#[cfg(test)]
680680
mod test {

src/librustc/middle/graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ pub struct Edge<E> {
5454
}
5555

5656
#[deriving(Eq)]
57-
pub struct NodeIndex(uint);
57+
pub struct NodeIndex(pub uint);
5858
pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
5959

6060
#[deriving(Eq)]
61-
pub struct EdgeIndex(uint);
61+
pub struct EdgeIndex(pub uint);
6262
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
6363

6464
// Use a private field here to guarantee no more instances are created:

src/librustc/middle/trans/basic_block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use lib::llvm::{llvm, BasicBlockRef};
1212
use middle::trans::value::{Users, Value};
1313
use std::iter::{Filter, Map};
1414

15-
pub struct BasicBlock(BasicBlockRef);
15+
pub struct BasicBlock(pub BasicBlockRef);
1616

1717
pub type Preds<'a> = Map<'a, Value, BasicBlock, Filter<'a, Value, Users>>;
1818

src/librustc/middle/trans/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use middle::trans::basic_block::BasicBlock;
1313
use middle::trans::common::Block;
1414
use std::libc::c_uint;
1515

16-
pub struct Value(ValueRef);
16+
pub struct Value(pub ValueRef);
1717

1818
macro_rules! opt_val ( ($e:expr) => (
1919
unsafe {

src/librustc/middle/ty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -869,13 +869,13 @@ impl CLike for BuiltinBound {
869869
}
870870

871871
#[deriving(Clone, Eq, TotalEq, Hash)]
872-
pub struct TyVid(uint);
872+
pub struct TyVid(pub uint);
873873

874874
#[deriving(Clone, Eq, TotalEq, Hash)]
875-
pub struct IntVid(uint);
875+
pub struct IntVid(pub uint);
876876

877877
#[deriving(Clone, Eq, TotalEq, Hash)]
878-
pub struct FloatVid(uint);
878+
pub struct FloatVid(pub uint);
879879

880880
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
881881
pub struct RegionVid {

src/librustc/middle/typeck/infer/coercion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ use syntax::ast;
8383
// Note: Coerce is not actually a combiner, in that it does not
8484
// conform to the same interface, though it performs a similar
8585
// function.
86-
pub struct Coerce<'f>(CombineFields<'f>);
86+
pub struct Coerce<'f>(pub CombineFields<'f>);
8787

8888
impl<'f> Coerce<'f> {
8989
pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> {

src/librustc/middle/typeck/infer/glb.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use collections::HashMap;
2828
use util::common::{indenter};
2929
use util::ppaux::mt_to_str;
3030

31-
pub struct Glb<'f>(CombineFields<'f>); // "greatest lower bound" (common subtype)
31+
pub struct Glb<'f>(pub CombineFields<'f>); // "greatest lower bound" (common subtype)
3232

3333
impl<'f> Glb<'f> {
3434
pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Glb(ref v) = *self; v }

src/librustc/middle/typeck/infer/lub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use syntax::ast::{ExternFn, ImpureFn, UnsafeFn};
2727
use syntax::ast::{Onceness, Purity};
2828
use util::ppaux::mt_to_str;
2929

30-
pub struct Lub<'f>(CombineFields<'f>); // least-upper-bound: common supertype
30+
pub struct Lub<'f>(pub CombineFields<'f>); // least-upper-bound: common supertype
3131

3232
impl<'f> Lub<'f> {
3333
pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Lub(ref v) = *self; v }

src/librustc/middle/typeck/infer/sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use util::ppaux::bound_region_to_str;
2727

2828
use syntax::ast::{Onceness, Purity};
2929

30-
pub struct Sub<'f>(CombineFields<'f>); // "subtype", "subregion" etc
30+
pub struct Sub<'f>(pub CombineFields<'f>); // "subtype", "subregion" etc
3131

3232
impl<'f> Sub<'f> {
3333
pub fn get_ref<'a>(&'a self) -> &'a CombineFields<'f> { let Sub(ref v) = *self; v }

src/librustdoc/html/escape.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::fmt;
1717

1818
/// Wrapper struct which will emit the HTML-escaped version of the contained
1919
/// string when passed to a format string.
20-
pub struct Escape<'a>(&'a str);
20+
pub struct Escape<'a>(pub &'a str);
2121

2222
impl<'a> fmt::Show for Escape<'a> {
2323
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {

src/librustdoc/html/format.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ use html::render::{cache_key, current_location_key};
2828

2929
/// Helper to render an optional visibility with a space after it (if the
3030
/// visibility is preset)
31-
pub struct VisSpace(Option<ast::Visibility>);
31+
pub struct VisSpace(pub Option<ast::Visibility>);
3232
/// Similarly to VisSpace, this structure is used to render a purity with a
3333
/// space after it.
34-
pub struct PuritySpace(ast::Purity);
34+
pub struct PuritySpace(pub ast::Purity);
3535
/// Wrapper struct for properly emitting a method declaration.
36-
pub struct Method<'a>(&'a clean::SelfTy, &'a clean::FnDecl);
36+
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
3737

3838
impl VisSpace {
3939
pub fn get(&self) -> Option<ast::Visibility> {

src/librustdoc/html/markdown.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ use html::highlight;
4242
/// A unit struct which has the `fmt::Show` trait implemented. When
4343
/// formatted, this struct will emit the HTML corresponding to the rendered
4444
/// version of the contained markdown string.
45-
pub struct Markdown<'a>(&'a str);
45+
pub struct Markdown<'a>(pub &'a str);
4646
/// A unit struct like `Markdown`, that renders the markdown with a
4747
/// table of contents.
48-
pub struct MarkdownWithToc<'a>(&'a str);
48+
pub struct MarkdownWithToc<'a>(pub &'a str);
4949

5050
static OUTPUT_UNIT: libc::size_t = 64;
5151
static MKDEXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 0;

src/libstd/rt/task.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub struct Task {
5858
}
5959

6060
pub struct GarbageCollector;
61-
pub struct LocalStorage(Option<local_data::Map>);
61+
pub struct LocalStorage(pub Option<local_data::Map>);
6262

6363
/// A handle to a blocked task. Usually this means having the ~Task pointer by
6464
/// ownership, but if the task is killable, a killer can steal it at any time.

src/libstd/unstable/simd.rs

+18-10
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,48 @@
1414

1515
#[experimental]
1616
#[simd]
17-
pub struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8);
17+
pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
18+
pub i8, pub i8, pub i8, pub i8,
19+
pub i8, pub i8, pub i8, pub i8,
20+
pub i8, pub i8, pub i8, pub i8);
1821

1922
#[experimental]
2023
#[simd]
21-
pub struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
24+
pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
25+
pub i16, pub i16, pub i16, pub i16);
2226

2327
#[experimental]
2428
#[simd]
25-
pub struct i32x4(i32, i32, i32, i32);
29+
pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
2630

2731
#[experimental]
2832
#[simd]
29-
pub struct i64x2(i64, i64);
33+
pub struct i64x2(pub i64, pub i64);
3034

3135
#[experimental]
3236
#[simd]
33-
pub struct u8x16(u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8);
37+
pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
38+
pub u8, pub u8, pub u8, pub u8,
39+
pub u8, pub u8, pub u8, pub u8,
40+
pub u8, pub u8, pub u8, pub u8);
3441

3542
#[experimental]
3643
#[simd]
37-
pub struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16);
44+
pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
45+
pub u16, pub u16, pub u16, pub u16);
3846

3947
#[experimental]
4048
#[simd]
41-
pub struct u32x4(u32, u32, u32, u32);
49+
pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
4250

4351
#[experimental]
4452
#[simd]
45-
pub struct u64x2(u64, u64);
53+
pub struct u64x2(pub u64, pub u64);
4654

4755
#[experimental]
4856
#[simd]
49-
pub struct f32x4(f32, f32, f32, f32);
57+
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
5058

5159
#[experimental]
5260
#[simd]
53-
pub struct f64x2(f64, f64);
61+
pub struct f64x2(pub f64, pub f64);

src/libsyntax/ast_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a> Iterator<PathElem> for LinkedPath<'a> {
6666

6767
// HACK(eddyb) move this into libstd (value wrapper for slice::Items).
6868
#[deriving(Clone)]
69-
pub struct Values<'a, T>(slice::Items<'a, T>);
69+
pub struct Values<'a, T>(pub slice::Items<'a, T>);
7070

7171
impl<'a, T: Copy> Iterator<T> for Values<'a, T> {
7272
fn next(&mut self) -> Option<T> {

src/libsyntax/codemap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ pub trait Pos {
3333
/// A byte offset. Keep this small (currently 32-bits), as AST contains
3434
/// a lot of them.
3535
#[deriving(Clone, Eq, TotalEq, Hash, Ord, Show)]
36-
pub struct BytePos(u32);
36+
pub struct BytePos(pub u32);
3737

3838
/// A character offset. Because of multibyte utf8 characters, a byte offset
3939
/// is not equivalent to a character offset. The CodeMap will convert BytePos
4040
/// values to CharPos values as necessary.
4141
#[deriving(Eq, Hash, Ord, Show)]
42-
pub struct CharPos(uint);
42+
pub struct CharPos(pub uint);
4343

4444
// FIXME: Lots of boilerplate in these impls, but so far my attempts to fix
4545
// have been unsuccessful

src/test/auxiliary/issue-11508.rs

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

11-
pub struct Closed01<F>(F);
11+
pub struct Closed01<F>(pub F);
1212

1313
pub trait Bar { fn new() -> Self; }
1414

src/test/auxiliary/issue-11529.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub struct A<'a>(&'a int);
11+
pub struct A<'a>(pub &'a int);

src/test/auxiliary/issue-7899.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub struct V2<T>(T, T);
11+
pub struct V2<T>(pub T, pub T);

src/test/auxiliary/issue_10031_aux.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub struct Wrap<A>(A);
11+
pub struct Wrap<A>(pub A);

src/test/auxiliary/issue_2472_b.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111

12-
pub struct S(());
12+
pub struct S(pub ());
1313

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

src/test/auxiliary/lint_stability.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,15 @@ pub enum Enum {
161161
}
162162

163163
#[deprecated]
164-
pub struct DeprecatedTupleStruct(int);
164+
pub struct DeprecatedTupleStruct(pub int);
165165
#[experimental]
166-
pub struct ExperimentalTupleStruct(int);
166+
pub struct ExperimentalTupleStruct(pub int);
167167
#[unstable]
168-
pub struct UnstableTupleStruct(int);
169-
pub struct UnmarkedTupleStruct(int);
168+
pub struct UnstableTupleStruct(pub int);
169+
pub struct UnmarkedTupleStruct(pub int);
170170
#[stable]
171-
pub struct StableTupleStruct(int);
171+
pub struct StableTupleStruct(pub int);
172172
#[frozen]
173-
pub struct FrozenTupleStruct(int);
173+
pub struct FrozenTupleStruct(pub int);
174174
#[locked]
175-
pub struct LockedTupleStruct(int);
175+
pub struct LockedTupleStruct(pub int);

src/test/auxiliary/newtype_struct_xc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
#[crate_type="lib"];
1212

13-
pub struct Au(int);
13+
pub struct Au(pub int);

0 commit comments

Comments
 (0)