Skip to content

Commit 99d6ac1

Browse files
committed
---
yaml --- r: 110895 b: refs/heads/auto c: 44e34c2 h: refs/heads/master i: 110893: 5449229 110891: f38dbb7 110887: 400a812 110879: d91c4b9 v: v3
1 parent e24fd73 commit 99d6ac1

File tree

12 files changed

+91
-89
lines changed

12 files changed

+91
-89
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 296e60be6b027a52de58251848037a92f23a0878
16+
refs/heads/auto: 44e34c24c4752408038f95225f536d11605c5ba4
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/front/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a> Context<'a> {
9696
fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
9797
if !self.has_feature(feature) {
9898
self.sess.span_err(span, explain);
99-
self.sess.span_note(span, format!("add \\#![feature({})] to the \
99+
self.sess.span_note(span, format!("add \\#[feature({})] to the \
100100
crate attributes to enable",
101101
feature));
102102
}

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3698,7 +3698,7 @@ pub fn instantiate_path(fcx: &FnCtxt,
36983698
&& !fcx.tcx().sess.features.default_type_params.get() {
36993699
fcx.tcx().sess.span_err(pth.span, "default type parameters are \
37003700
experimental and possibly buggy");
3701-
fcx.tcx().sess.span_note(pth.span, "add #![feature(default_type_params)] \
3701+
fcx.tcx().sess.span_note(pth.span, "add #[feature(default_type_params)] \
37023702
to the crate attributes to enable");
37033703
}
37043704

branches/auto/src/librustc/util/ppaux.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> ~str {
341341
ty_bot => ~"!",
342342
ty_bool => ~"bool",
343343
ty_char => ~"char",
344-
ty_int(t) => ast_util::int_ty_to_str(t, None),
345-
ty_uint(t) => ast_util::uint_ty_to_str(t, None),
344+
ty_int(ast::TyI) => ~"int",
345+
ty_int(t) => ast_util::int_ty_to_str(t),
346+
ty_uint(ast::TyU) => ~"uint",
347+
ty_uint(t) => ast_util::uint_ty_to_str(t),
346348
ty_float(t) => ast_util::float_ty_to_str(t),
347349
ty_box(typ) => ~"@" + ty_to_str(cx, typ),
348350
ty_uniq(typ) => ~"~" + ty_to_str(cx, typ),

branches/auto/src/librustdoc/html/format.rs

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,17 @@ fn path(w: &mut io::Writer, path: &clean::Path, print_all: bool,
279279
}
280280

281281
/// Helper to render type parameters
282-
fn typarams(w: &mut io::Writer,
282+
fn tybounds(w: &mut io::Writer,
283283
typarams: &Option<Vec<clean::TyParamBound> >) -> fmt::Result {
284284
match *typarams {
285285
Some(ref params) => {
286-
try!(write!(w, "&lt;"));
286+
try!(write!(w, ":"));
287287
for (i, param) in params.iter().enumerate() {
288288
if i > 0 {
289-
try!(write!(w, ", "));
289+
try!(write!(w, " + "));
290290
}
291291
try!(write!(w, "{}", *param));
292292
}
293-
try!(write!(w, "&gt;"));
294293
Ok(())
295294
}
296295
None => Ok(())
@@ -308,13 +307,13 @@ impl fmt::Show for clean::Type {
308307
}
309308
clean::ResolvedPath{id, typarams: ref tp, path: ref path} => {
310309
try!(resolved_path(f.buf, id, path, false));
311-
typarams(f.buf, tp)
310+
tybounds(f.buf, tp)
312311
}
313312
clean::ExternalPath{path: ref path, typarams: ref tp,
314313
fqn: ref fqn, kind, krate} => {
315314
try!(external_path(f.buf, path, false, fqn.as_slice(), kind,
316315
krate))
317-
typarams(f.buf, tp)
316+
tybounds(f.buf, tp)
318317
}
319318
clean::Self(..) => f.buf.write("Self".as_bytes()),
320319
clean::Primitive(prim) => {
@@ -338,26 +337,59 @@ impl fmt::Show for clean::Type {
338337
f.buf.write(s.as_bytes())
339338
}
340339
clean::Closure(ref decl, ref region) => {
341-
let region = match *region {
342-
Some(ref region) => format!("{} ", *region),
343-
None => ~"",
344-
};
345-
346-
write!(f.buf, "{}{}|{}|{arrow, select, yes{ -&gt; {ret}} other{}}",
347-
FnStyleSpace(decl.fn_style),
348-
region,
349-
decl.decl.inputs,
340+
write!(f.buf, "{style}{lifetimes}|{args}|{bounds}\
341+
{arrow, select, yes{ -&gt; {ret}} other{}}",
342+
style = FnStyleSpace(decl.fn_style),
343+
lifetimes = if decl.lifetimes.len() == 0 {
344+
~""
345+
} else {
346+
format!("&lt;{:#}&gt;", decl.lifetimes)
347+
},
348+
args = decl.decl.inputs,
350349
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
351-
ret = decl.decl.output)
352-
// FIXME: where are bounds and lifetimes printed?!
350+
ret = decl.decl.output,
351+
bounds = {
352+
let mut ret = StrBuf::new();
353+
match *region {
354+
Some(ref lt) => {
355+
ret.push_str(format!(": {}", *lt));
356+
}
357+
None => {}
358+
}
359+
for bound in decl.bounds.iter() {
360+
match *bound {
361+
clean::RegionBound => {}
362+
clean::TraitBound(ref t) => {
363+
if ret.len() == 0 {
364+
ret.push_str(": ");
365+
} else {
366+
ret.push_str(" + ");
367+
}
368+
ret.push_str(format!("{}", *t));
369+
}
370+
}
371+
}
372+
ret.into_owned()
373+
})
353374
}
354375
clean::Proc(ref decl) => {
355-
write!(f.buf, "{}proc({}){arrow, select, yes{ -&gt; {ret}} other{}}",
356-
FnStyleSpace(decl.fn_style),
357-
decl.decl.inputs,
376+
write!(f.buf, "{style}{lifetimes}proc({args}){bounds}\
377+
{arrow, select, yes{ -&gt; {ret}} other{}}",
378+
style = FnStyleSpace(decl.fn_style),
379+
lifetimes = if decl.lifetimes.len() == 0 {
380+
~""
381+
} else {
382+
format!("&lt;{:#}&gt;", decl.lifetimes)
383+
},
384+
args = decl.decl.inputs,
385+
bounds = if decl.bounds.len() == 0 {
386+
~""
387+
} else {
388+
let mut m = decl.bounds.iter().map(|s| s.to_str());
389+
": " + m.collect::<~[~str]>().connect(" + ")
390+
},
358391
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
359392
ret = decl.decl.output)
360-
// FIXME: where are bounds and lifetimes printed?!
361393
}
362394
clean::BareFunction(ref decl) => {
363395
write!(f.buf, "{}{}fn{}{}",

branches/auto/src/libstd/num/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ pub fn abs_sub<T: Signed>(x: T, y: T) -> T {
159159
/// - `-1` if the number is negative
160160
#[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() }
161161

162-
/// A trait for values which cannot be negative
163162
pub trait Unsigned: Num {}
164163

165164
/// A collection of rounding operations.
@@ -206,7 +205,6 @@ pub fn pow<T: One + Mul<T, T>>(mut base: T, mut exp: uint) -> T {
206205
}
207206
}
208207

209-
/// Numbers which have upper and lower bounds
210208
pub trait Bounded {
211209
// FIXME (#5527): These should be associated constants
212210
fn min_value() -> Self;
@@ -1048,12 +1046,10 @@ impl_num_cast!(int, to_int)
10481046
impl_num_cast!(f32, to_f32)
10491047
impl_num_cast!(f64, to_f64)
10501048

1051-
/// A generic trait for converting a value to a string with a radix (base)
10521049
pub trait ToStrRadix {
10531050
fn to_str_radix(&self, radix: uint) -> ~str;
10541051
}
10551052

1056-
/// A generic trait for converting a string with a radix (base) to a value
10571053
pub trait FromStrRadix {
10581054
fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
10591055
}

branches/auto/src/libstd/slice.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,7 +2601,9 @@ impl<A: Clone> Clone for ~[A] {
26012601

26022602
impl<'a, T: fmt::Show> fmt::Show for &'a [T] {
26032603
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2604-
try!(write!(f.buf, "["));
2604+
if f.flags & (1 << (fmt::parse::FlagAlternate as uint)) == 0 {
2605+
try!(write!(f.buf, "["));
2606+
}
26052607
let mut is_first = true;
26062608
for x in self.iter() {
26072609
if is_first {
@@ -2611,7 +2613,10 @@ impl<'a, T: fmt::Show> fmt::Show for &'a [T] {
26112613
}
26122614
try!(write!(f.buf, "{}", *x))
26132615
}
2614-
write!(f.buf, "]")
2616+
if f.flags & (1 << (fmt::parse::FlagAlternate as uint)) == 0 {
2617+
try!(write!(f.buf, "]"));
2618+
}
2619+
Ok(())
26152620
}
26162621
}
26172622

branches/auto/src/libsyntax/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ pub enum IntTy {
707707

708708
impl fmt::Show for IntTy {
709709
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
710-
write!(f.buf, "{}", ast_util::int_ty_to_str(*self, None))
710+
write!(f.buf, "{}", ast_util::int_ty_to_str(*self))
711711
}
712712
}
713713

@@ -722,7 +722,7 @@ pub enum UintTy {
722722

723723
impl fmt::Show for UintTy {
724724
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
725-
write!(f.buf, "{}", ast_util::uint_ty_to_str(*self, None))
725+
write!(f.buf, "{}", ast_util::uint_ty_to_str(*self))
726726
}
727727
}
728728

branches/auto/src/libsyntax/ast_util.rs

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,13 @@ pub fn is_path(e: @Expr) -> bool {
132132
return match e.node { ExprPath(_) => true, _ => false };
133133
}
134134

135-
// Get a string representation of a signed int type, with its value.
136-
// We want to avoid "45int" and "-3int" in favor of "45" and "-3"
137-
pub fn int_ty_to_str(t: IntTy, val: Option<i64>) -> ~str {
138-
let s = match t {
139-
TyI if val.is_some() => "",
140-
TyI => "int",
141-
TyI8 => "i8",
142-
TyI16 => "i16",
143-
TyI32 => "i32",
144-
TyI64 => "i64"
145-
};
146-
147-
match val {
148-
Some(n) => format!("{}{}", n, s),
149-
None => s.to_owned()
135+
pub fn int_ty_to_str(t: IntTy) -> ~str {
136+
match t {
137+
TyI => ~"",
138+
TyI8 => ~"i8",
139+
TyI16 => ~"i16",
140+
TyI32 => ~"i32",
141+
TyI64 => ~"i64"
150142
}
151143
}
152144

@@ -159,21 +151,13 @@ pub fn int_ty_max(t: IntTy) -> u64 {
159151
}
160152
}
161153

162-
// Get a string representation of an unsigned int type, with its value.
163-
// We want to avoid "42uint" in favor of "42u"
164-
pub fn uint_ty_to_str(t: UintTy, val: Option<u64>) -> ~str {
165-
let s = match t {
166-
TyU if val.is_some() => "u",
167-
TyU => "uint",
168-
TyU8 => "u8",
169-
TyU16 => "u16",
170-
TyU32 => "u32",
171-
TyU64 => "u64"
172-
};
173-
174-
match val {
175-
Some(n) => format!("{}{}", n, s),
176-
None => s.to_owned()
154+
pub fn uint_ty_to_str(t: UintTy) -> ~str {
155+
match t {
156+
TyU => ~"u",
157+
TyU8 => ~"u8",
158+
TyU16 => ~"u16",
159+
TyU32 => ~"u32",
160+
TyU64 => ~"u64"
177161
}
178162
}
179163

branches/auto/src/libsyntax/parse/token.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,12 @@ pub fn to_str(t: &Token) -> ~str {
201201
res.push_char('\'');
202202
res.into_owned()
203203
}
204-
LIT_INT(i, t) => ast_util::int_ty_to_str(t, Some(i)),
205-
LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u)),
204+
LIT_INT(i, t) => {
205+
i.to_str() + ast_util::int_ty_to_str(t)
206+
}
207+
LIT_UINT(u, t) => {
208+
u.to_str() + ast_util::uint_ty_to_str(t)
209+
}
206210
LIT_INT_UNSUFFIXED(i) => { i.to_str() }
207211
LIT_FLOAT(s, t) => {
208212
let mut body = StrBuf::from_str(get_ident(s).get());

branches/auto/src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,10 +2171,10 @@ impl<'a> State<'a> {
21712171
word(&mut self.s, res.into_owned())
21722172
}
21732173
ast::LitInt(i, t) => {
2174-
word(&mut self.s, ast_util::int_ty_to_str(t, Some(i)))
2174+
word(&mut self.s, format!("{}{}", i, ast_util::int_ty_to_str(t)))
21752175
}
21762176
ast::LitUint(u, t) => {
2177-
word(&mut self.s, ast_util::uint_ty_to_str(t, Some(u)))
2177+
word(&mut self.s, format!("{}{}", u, ast_util::uint_ty_to_str(t)))
21782178
}
21792179
ast::LitIntUnsuffixed(i) => {
21802180
word(&mut self.s, format!("{}", i))

branches/auto/src/test/compile-fail/issue13359.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)