Skip to content

Commit 584e14d

Browse files
---
yaml --- r: 150843 b: refs/heads/try2 c: 7c042cd h: refs/heads/master i: 150841: ca18efa 150839: 69a2895 v: v3
1 parent 522027a commit 584e14d

Some content is hidden

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

55 files changed

+483
-437
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 72869b6579154d7aa322ddd0f9e3d89fd8abe8c4
8+
refs/heads/try2: 7c042cd70b9528051a1a1abba9e5d18657550306
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,10 +1586,10 @@ pub struct Bar {
15861586
field: int
15871587
}
15881588
1589-
// Declare a public enum with two public variants
1589+
// Declare a public enum with public and private variants
15901590
pub enum State {
15911591
PubliclyAccessibleState,
1592-
PubliclyAccessibleState2,
1592+
priv PrivatelyAccessibleState
15931593
}
15941594
~~~~
15951595

branches/try2/src/libfourcc/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use syntax::ast::Name;
5757
use syntax::attr::contains;
5858
use syntax::codemap::{Span, mk_sp};
5959
use syntax::ext::base;
60-
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
60+
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MRExpr};
6161
use syntax::ext::build::AstBuilder;
6262
use syntax::parse;
6363
use syntax::parse::token;
@@ -73,7 +73,7 @@ pub fn macro_registrar(register: |Name, SyntaxExtension|) {
7373
None));
7474
}
7575

76-
pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> ~base::MacResult {
76+
pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> base::MacResult {
7777
let (expr, endian) = parse_tts(cx, tts);
7878

7979
let little = match endian {
@@ -101,12 +101,12 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) ->
101101
}
102102
_ => {
103103
cx.span_err(expr.span, "unsupported literal in fourcc!");
104-
return base::DummyResult::expr(sp)
104+
return MRExpr(cx.expr_lit(sp, ast::LitUint(0u64, ast::TyU32)));
105105
}
106106
},
107107
_ => {
108108
cx.span_err(expr.span, "non-literal in fourcc!");
109-
return base::DummyResult::expr(sp)
109+
return MRExpr(cx.expr_lit(sp, ast::LitUint(0u64, ast::TyU32)));
110110
}
111111
};
112112

@@ -126,7 +126,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) ->
126126
};
127127
}
128128
let e = cx.expr_lit(sp, ast::LitUint(val as u64, ast::TyU32));
129-
MacExpr::new(e)
129+
MRExpr(e)
130130
}
131131

132132
struct Ident {

branches/try2/src/libhexfloat/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use syntax::ast;
5353
use syntax::ast::Name;
5454
use syntax::codemap::{Span, mk_sp};
5555
use syntax::ext::base;
56-
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
56+
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MRExpr};
5757
use syntax::ext::build::AstBuilder;
5858
use syntax::parse;
5959
use syntax::parse::token;
@@ -97,7 +97,7 @@ fn hex_float_lit_err(s: &str) -> Option<(uint, ~str)> {
9797
}
9898
}
9999

100-
pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> ~base::MacResult {
100+
pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> base::MacResult {
101101
let (expr, ty_lit) = parse_tts(cx, tts);
102102

103103
let ty = match ty_lit {
@@ -121,12 +121,12 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) ->
121121
}
122122
_ => {
123123
cx.span_err(expr.span, "unsupported literal in hexfloat!");
124-
return base::DummyResult::expr(sp);
124+
return base::MacResult::dummy_expr(sp);
125125
}
126126
},
127127
_ => {
128128
cx.span_err(expr.span, "non-literal in hexfloat!");
129-
return base::DummyResult::expr(sp);
129+
return base::MacResult::dummy_expr(sp);
130130
}
131131
};
132132

@@ -137,7 +137,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) ->
137137
let pos = expr.span.lo + syntax::codemap::Pos::from_uint(err_pos + 1);
138138
let span = syntax::codemap::mk_sp(pos,pos);
139139
cx.span_err(span, format!("invalid hex float literal in hexfloat!: {}", err_str));
140-
return base::DummyResult::expr(sp);
140+
return base::MacResult::dummy_expr(sp);
141141
}
142142
_ => ()
143143
}
@@ -147,7 +147,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) ->
147147
None => ast::LitFloatUnsuffixed(s),
148148
Some (ty) => ast::LitFloat(s, ty)
149149
};
150-
MacExpr::new(cx.expr_lit(sp, lit))
150+
MRExpr(cx.expr_lit(sp, lit))
151151
}
152152

153153
struct Ident {

branches/try2/src/liblibc/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ pub mod types {
229229
*/
230230
#[repr(u8)]
231231
pub enum c_void {
232-
__variant1,
233-
__variant2,
232+
priv variant1,
233+
priv variant2
234234
}
235235
pub enum FILE {}
236236
pub enum fpos_t {}

branches/try2/src/librand/distributions/gamma.rs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,10 @@ use super::{IndependentSample, Sample, Exp};
4545
/// for Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3
4646
/// (September 2000),
4747
/// 363-372. DOI:[10.1145/358407.358414](http://doi.acm.org/10.1145/358407.358414)
48-
pub struct Gamma {
49-
repr: GammaRepr,
50-
}
51-
52-
enum GammaRepr {
53-
Large(GammaLargeShape),
54-
One(Exp),
55-
Small(GammaSmallShape)
48+
pub enum Gamma {
49+
priv Large(GammaLargeShape),
50+
priv One(Exp),
51+
priv Small(GammaSmallShape)
5652
}
5753

5854
// These two helpers could be made public, but saving the
@@ -94,12 +90,11 @@ impl Gamma {
9490
assert!(shape > 0.0, "Gamma::new called with shape <= 0");
9591
assert!(scale > 0.0, "Gamma::new called with scale <= 0");
9692

97-
let repr = match shape {
93+
match shape {
9894
1.0 => One(Exp::new(1.0 / scale)),
9995
0.0 .. 1.0 => Small(GammaSmallShape::new_raw(shape, scale)),
10096
_ => Large(GammaLargeShape::new_raw(shape, scale))
101-
};
102-
Gamma { repr: repr }
97+
}
10398
}
10499
}
105100

@@ -136,7 +131,7 @@ impl Sample<f64> for GammaLargeShape {
136131

137132
impl IndependentSample<f64> for Gamma {
138133
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
139-
match self.repr {
134+
match *self {
140135
Small(ref g) => g.ind_sample(rng),
141136
One(ref g) => g.ind_sample(rng),
142137
Large(ref g) => g.ind_sample(rng),
@@ -188,37 +183,32 @@ impl IndependentSample<f64> for GammaLargeShape {
188183
/// let v = chi.ind_sample(&mut rand::task_rng());
189184
/// println!("{} is from a χ²(11) distribution", v)
190185
/// ```
191-
pub struct ChiSquared {
192-
repr: ChiSquaredRepr,
193-
}
194-
195-
enum ChiSquaredRepr {
186+
pub enum ChiSquared {
196187
// k == 1, Gamma(alpha, ..) is particularly slow for alpha < 1,
197188
// e.g. when alpha = 1/2 as it would be for this case, so special-
198189
// casing and using the definition of N(0,1)^2 is faster.
199-
DoFExactlyOne,
200-
DoFAnythingElse(Gamma),
190+
priv DoFExactlyOne,
191+
priv DoFAnythingElse(Gamma)
201192
}
202193

203194
impl ChiSquared {
204195
/// Create a new chi-squared distribution with degrees-of-freedom
205196
/// `k`. Fails if `k < 0`.
206197
pub fn new(k: f64) -> ChiSquared {
207-
let repr = if k == 1.0 {
198+
if k == 1.0 {
208199
DoFExactlyOne
209200
} else {
210201
assert!(k > 0.0, "ChiSquared::new called with `k` < 0");
211202
DoFAnythingElse(Gamma::new(0.5 * k, 2.0))
212-
};
213-
ChiSquared { repr: repr }
203+
}
214204
}
215205
}
216206
impl Sample<f64> for ChiSquared {
217207
fn sample<R: Rng>(&mut self, rng: &mut R) -> f64 { self.ind_sample(rng) }
218208
}
219209
impl IndependentSample<f64> for ChiSquared {
220210
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
221-
match self.repr {
211+
match *self {
222212
DoFExactlyOne => {
223213
// k == 1 => N(0,1)^2
224214
let StandardNormal(norm) = rng.gen::<StandardNormal>();

branches/try2/src/librustc/metadata/decoder.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ enum Family {
124124
Trait, // I
125125
Struct, // S
126126
PublicField, // g
127+
PrivateField, // j
127128
InheritedField // N
128129
}
129130

@@ -148,6 +149,7 @@ fn item_family(item: ebml::Doc) -> Family {
148149
'I' => Trait,
149150
'S' => Struct,
150151
'g' => PublicField,
152+
'j' => PrivateField,
151153
'N' => InheritedField,
152154
c => fail!("unexpected family char: {}", c)
153155
}
@@ -159,6 +161,7 @@ fn item_visibility(item: ebml::Doc) -> ast::Visibility {
159161
Some(visibility_doc) => {
160162
match reader::doc_as_u8(visibility_doc) as char {
161163
'y' => ast::Public,
164+
'n' => ast::Private,
162165
'i' => ast::Inherited,
163166
_ => fail!("unknown visibility character")
164167
}
@@ -361,7 +364,7 @@ fn item_to_def_like(item: ebml::Doc, did: ast::DefId, cnum: ast::CrateNum)
361364
Trait => DlDef(ast::DefTrait(did)),
362365
Enum => DlDef(ast::DefTy(did)),
363366
Impl => DlImpl(did),
364-
PublicField | InheritedField => DlField,
367+
PublicField | PrivateField | InheritedField => DlField,
365368
}
366369
}
367370

@@ -959,6 +962,7 @@ pub fn get_item_attrs(cdata: Cmd,
959962
fn struct_field_family_to_visibility(family: Family) -> ast::Visibility {
960963
match family {
961964
PublicField => ast::Public,
965+
PrivateField => ast::Private,
962966
InheritedField => ast::Inherited,
963967
_ => fail!()
964968
}
@@ -971,7 +975,7 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
971975
let mut result = Vec::new();
972976
reader::tagged_docs(item, tag_item_field, |an_item| {
973977
let f = item_family(an_item);
974-
if f == PublicField || f == InheritedField {
978+
if f == PublicField || f == PrivateField || f == InheritedField {
975979
// FIXME #6993: name should be of type Name, not Ident
976980
let name = item_name(&*intr, an_item);
977981
let did = item_def_id(an_item, cdata);

branches/try2/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ fn encode_struct_field_family(ebml_w: &mut Encoder,
607607
visibility: Visibility) {
608608
encode_family(ebml_w, match visibility {
609609
Public => 'g',
610+
Private => 'j',
610611
Inherited => 'N'
611612
});
612613
}
@@ -615,6 +616,7 @@ fn encode_visibility(ebml_w: &mut Encoder, visibility: Visibility) {
615616
ebml_w.start_tag(tag_items_data_item_visibility);
616617
let ch = match visibility {
617618
Public => 'y',
619+
Private => 'n',
618620
Inherited => 'i',
619621
};
620622
ebml_w.wr_str(str::from_char(ch));

0 commit comments

Comments
 (0)