Skip to content

Commit 61a1524

Browse files
committed
---
yaml --- r: 150844 b: refs/heads/try2 c: baa149b h: refs/heads/master v: v3
1 parent 584e14d commit 61a1524

Some content is hidden

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

54 files changed

+437
-448
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: 7c042cd70b9528051a1a1abba9e5d18657550306
8+
refs/heads/try2: baa149bcc7c99dfe3cb5959ae3ba2ff59267d1ae
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 public and private variants
1589+
// Declare a public enum with two public variants
15901590
pub enum State {
15911591
PubliclyAccessibleState,
1592-
priv PrivatelyAccessibleState
1592+
PubliclyAccessibleState2,
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, MRExpr};
60+
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
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 MRExpr(cx.expr_lit(sp, ast::LitUint(0u64, ast::TyU32)));
104+
return base::DummyResult::expr(sp)
105105
}
106106
},
107107
_ => {
108108
cx.span_err(expr.span, "non-literal in fourcc!");
109-
return MRExpr(cx.expr_lit(sp, ast::LitUint(0u64, ast::TyU32)));
109+
return base::DummyResult::expr(sp)
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-
MRExpr(e)
129+
MacExpr::new(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, MRExpr};
56+
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
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::MacResult::dummy_expr(sp);
124+
return base::DummyResult::expr(sp);
125125
}
126126
},
127127
_ => {
128128
cx.span_err(expr.span, "non-literal in hexfloat!");
129-
return base::MacResult::dummy_expr(sp);
129+
return base::DummyResult::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::MacResult::dummy_expr(sp);
140+
return base::DummyResult::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-
MRExpr(cx.expr_lit(sp, lit))
150+
MacExpr::new(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-
priv variant1,
233-
priv variant2
232+
__variant1,
233+
__variant2,
234234
}
235235
pub enum FILE {}
236236
pub enum fpos_t {}

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

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ 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 enum Gamma {
49-
priv Large(GammaLargeShape),
50-
priv One(Exp),
51-
priv Small(GammaSmallShape)
48+
pub struct Gamma {
49+
repr: GammaRepr,
50+
}
51+
52+
enum GammaRepr {
53+
Large(GammaLargeShape),
54+
One(Exp),
55+
Small(GammaSmallShape)
5256
}
5357

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

93-
match shape {
97+
let repr = match shape {
9498
1.0 => One(Exp::new(1.0 / scale)),
9599
0.0 .. 1.0 => Small(GammaSmallShape::new_raw(shape, scale)),
96100
_ => Large(GammaLargeShape::new_raw(shape, scale))
97-
}
101+
};
102+
Gamma { repr: repr }
98103
}
99104
}
100105

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

132137
impl IndependentSample<f64> for Gamma {
133138
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
134-
match *self {
139+
match self.repr {
135140
Small(ref g) => g.ind_sample(rng),
136141
One(ref g) => g.ind_sample(rng),
137142
Large(ref g) => g.ind_sample(rng),
@@ -183,32 +188,37 @@ impl IndependentSample<f64> for GammaLargeShape {
183188
/// let v = chi.ind_sample(&mut rand::task_rng());
184189
/// println!("{} is from a χ²(11) distribution", v)
185190
/// ```
186-
pub enum ChiSquared {
191+
pub struct ChiSquared {
192+
repr: ChiSquaredRepr,
193+
}
194+
195+
enum ChiSquaredRepr {
187196
// k == 1, Gamma(alpha, ..) is particularly slow for alpha < 1,
188197
// e.g. when alpha = 1/2 as it would be for this case, so special-
189198
// casing and using the definition of N(0,1)^2 is faster.
190-
priv DoFExactlyOne,
191-
priv DoFAnythingElse(Gamma)
199+
DoFExactlyOne,
200+
DoFAnythingElse(Gamma),
192201
}
193202

194203
impl ChiSquared {
195204
/// Create a new chi-squared distribution with degrees-of-freedom
196205
/// `k`. Fails if `k < 0`.
197206
pub fn new(k: f64) -> ChiSquared {
198-
if k == 1.0 {
207+
let repr = if k == 1.0 {
199208
DoFExactlyOne
200209
} else {
201210
assert!(k > 0.0, "ChiSquared::new called with `k` < 0");
202211
DoFAnythingElse(Gamma::new(0.5 * k, 2.0))
203-
}
212+
};
213+
ChiSquared { repr: repr }
204214
}
205215
}
206216
impl Sample<f64> for ChiSquared {
207217
fn sample<R: Rng>(&mut self, rng: &mut R) -> f64 { self.ind_sample(rng) }
208218
}
209219
impl IndependentSample<f64> for ChiSquared {
210220
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64 {
211-
match *self {
221+
match self.repr {
212222
DoFExactlyOne => {
213223
// k == 1 => N(0,1)^2
214224
let StandardNormal(norm) = rng.gen::<StandardNormal>();

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

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

@@ -149,7 +148,6 @@ fn item_family(item: ebml::Doc) -> Family {
149148
'I' => Trait,
150149
'S' => Struct,
151150
'g' => PublicField,
152-
'j' => PrivateField,
153151
'N' => InheritedField,
154152
c => fail!("unexpected family char: {}", c)
155153
}
@@ -161,7 +159,6 @@ fn item_visibility(item: ebml::Doc) -> ast::Visibility {
161159
Some(visibility_doc) => {
162160
match reader::doc_as_u8(visibility_doc) as char {
163161
'y' => ast::Public,
164-
'n' => ast::Private,
165162
'i' => ast::Inherited,
166163
_ => fail!("unknown visibility character")
167164
}
@@ -364,7 +361,7 @@ fn item_to_def_like(item: ebml::Doc, did: ast::DefId, cnum: ast::CrateNum)
364361
Trait => DlDef(ast::DefTrait(did)),
365362
Enum => DlDef(ast::DefTy(did)),
366363
Impl => DlImpl(did),
367-
PublicField | PrivateField | InheritedField => DlField,
364+
PublicField | InheritedField => DlField,
368365
}
369366
}
370367

@@ -962,7 +959,6 @@ pub fn get_item_attrs(cdata: Cmd,
962959
fn struct_field_family_to_visibility(family: Family) -> ast::Visibility {
963960
match family {
964961
PublicField => ast::Public,
965-
PrivateField => ast::Private,
966962
InheritedField => ast::Inherited,
967963
_ => fail!()
968964
}
@@ -975,7 +971,7 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
975971
let mut result = Vec::new();
976972
reader::tagged_docs(item, tag_item_field, |an_item| {
977973
let f = item_family(an_item);
978-
if f == PublicField || f == PrivateField || f == InheritedField {
974+
if f == PublicField || f == InheritedField {
979975
// FIXME #6993: name should be of type Name, not Ident
980976
let name = item_name(&*intr, an_item);
981977
let did = item_def_id(an_item, cdata);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ 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',
611610
Inherited => 'N'
612611
});
613612
}
@@ -616,7 +615,6 @@ fn encode_visibility(ebml_w: &mut Encoder, visibility: Visibility) {
616615
ebml_w.start_tag(tag_items_data_item_visibility);
617616
let ch = match visibility {
618617
Public => 'y',
619-
Private => 'n',
620618
Inherited => 'i',
621619
};
622620
ebml_w.wr_str(str::from_char(ch));

0 commit comments

Comments
 (0)