Skip to content

Commit 635448c

Browse files
committed
---
yaml --- r: 47379 b: refs/heads/try c: b662d3c h: refs/heads/master i: 47377: eaec1ce 47375: f87fc11 v: v3
1 parent 2997c25 commit 635448c

File tree

7 files changed

+15
-37
lines changed

7 files changed

+15
-37
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 0917e131d57b8fb84b462dad13cadbe051f5d011
5+
refs/heads/try: b662d3c922f1922da55d324aa65dfe268c2bb971
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You're not off the hook even if you just stick to documentation; code examples i
1111
Pull requests will be treated as "review requests",
1212
and we will give feedback we expect to see corrected on [style](https://github.com/mozilla/rust/wiki/Note-style-guide) and substance before pulling.
1313
Changes contributed via pull request should focus on a single issue at a time, like any other.
14-
We will not accept pull-requests that try to "sneak" unrelated changes in.
14+
We will not look accept pull-requests that try to "sneak" unrelated changes in.
1515

1616
Normally, all pull requests must include regression tests (see [Note-testsuite](https://github.com/mozilla/rust/wiki/Note-testsuite)) that test your change.
1717
Occasionally, a change will be very difficult to test for.

branches/try/doc/rust.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,15 +1085,6 @@ let p = Point(10, 11);
10851085
let px: int = match p { Point(x, _) => x };
10861086
~~~~
10871087

1088-
A _unit-like struct_ is a structure without any fields, defined by leaving off the fields list entirely.
1089-
Such types will have a single value, just like the [unit value `()`](#unit-and-boolean-literals) of the unit type.
1090-
For example:
1091-
1092-
~~~~
1093-
struct Cookie;
1094-
let c = [Cookie, Cookie, Cookie, Cookie];
1095-
~~~~
1096-
10971088
### Enumerations
10981089

10991090
An _enumeration_ is a simultaneous definition of a nominal [enumerated type](#enumerated-types) as well as a set of *constructors*,
@@ -1599,8 +1590,7 @@ struct_expr : expr_path '{' ident ':' expr
15991590
[ ',' ident ':' expr ] *
16001591
[ ".." expr ] '}' |
16011592
expr_path '(' expr
1602-
[ ',' expr ] * ')' |
1603-
expr_path
1593+
[ ',' expr ] * ')'
16041594
~~~~~~~~
16051595

16061596
There are several forms of structure expressions.
@@ -1610,28 +1600,23 @@ providing the field values of a new instance of the structure.
16101600
A field name can be any identifier, and is separated from its value expression by a colon.
16111601
To indicate that a field is mutable, the `mut` keyword is written before its name.
16121602

1613-
A _tuple structure expression_ consists of the [path](#paths) of a [structure item](#structures),
1603+
A _tuple structure expression_ constists of the [path](#paths) of a [structure item](#structures),
16141604
followed by a parenthesized list of one or more comma-separated expressions
16151605
(in other words, the path of a structured item followed by a tuple expression).
16161606
The structure item must be a tuple structure item.
16171607

1618-
A _unit-like structure expression_ consists only of the [path](#paths) of a [structure item](#structures).
1619-
16201608
The following are examples of structure expressions:
16211609

16221610
~~~~
16231611
# struct Point { x: float, y: float }
16241612
# struct TuplePoint(float, float);
16251613
# mod game { pub struct User { name: &str, age: uint, score: uint } }
1626-
# struct Cookie; fn some_fn<T>(t: T) {}
16271614
Point {x: 10f, y: 20f};
16281615
TuplePoint(10f, 20f);
16291616
let u = game::User {name: "Joe", age: 35u, score: 100_000};
1630-
some_fn::<Cookie>(Cookie);
16311617
~~~~
16321618

16331619
A structure expression forms a new value of the named structure type.
1634-
Note that for a given *unit-like* structure type, this will always be the same value.
16351620

16361621
A structure expression can terminate with the syntax `..` followed by an expression to denote a functional update.
16371622
The expression following `..` (the base) must be of the same structure type as the new structure type being formed.
@@ -2658,10 +2643,7 @@ the resulting `struct` value will always be laid out in memory in the order spec
26582643
The fields of a `struct` may be qualified by [visibility modifiers](#visibility-modifiers),
26592644
to restrict access to implementation-private data in a structure.
26602645

2661-
A _tuple struct_ type is just like a structure type, except that the fields are anonymous.
2662-
2663-
A _unit-like struct_ type is like a structure type, except that it has no fields.
2664-
The one value constructed by the associated [structure expression](#structure-expression) is the only value that inhabits such a type.
2646+
A `tuple struct` type is just like a structure type, except that the fields are anonymous.
26652647

26662648
### Enumerated types
26672649

branches/try/src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub fn check_expr(e: @expr, cx: Context, v: visit::vt<Context>) {
234234
"explicit copy requires a copyable argument");
235235
}
236236
expr_repeat(element, count_expr, _) => {
237-
let count = ty::eval_repeat_count(cx.tcx, count_expr, e.span);
237+
let count = ty::eval_repeat_count(cx.tcx, count_expr);
238238
if count > 1 {
239239
let element_ty = ty::expr_ty(cx.tcx, element);
240240
check_copy(cx, element_ty, element.span,

branches/try/src/librustc/middle/trans/tvec.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ pub fn write_content(bcx: block,
410410
return expr::trans_into(bcx, element, Ignore);
411411
}
412412
SaveIn(lldest) => {
413-
let count = ty::eval_repeat_count(bcx.tcx(), count_expr,
414-
count_expr.span);
413+
let count = ty::eval_repeat_count(bcx.tcx(), count_expr);
415414
if count == 0 {
416415
return bcx;
417416
}
@@ -476,7 +475,7 @@ pub fn elements_required(bcx: block, content_expr: @ast::expr) -> uint {
476475
},
477476
ast::expr_vec(es, _) => es.len(),
478477
ast::expr_repeat(_, count_expr, _) => {
479-
ty::eval_repeat_count(bcx.tcx(), count_expr, content_expr.span)
478+
ty::eval_repeat_count(bcx.tcx(), count_expr)
480479
}
481480
_ => bcx.tcx().sess.span_bug(content_expr.span,
482481
~"Unexpected evec content")

branches/try/src/librustc/middle/ty.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,35 +4247,32 @@ pub fn normalize_ty(cx: ctxt, t: t) -> t {
42474247
}
42484248
42494249
// Returns the repeat count for a repeating vector expression.
4250-
pub fn eval_repeat_count(tcx: ctxt,
4251-
count_expr: @ast::expr,
4252-
span: span)
4253-
-> uint {
4250+
pub fn eval_repeat_count(tcx: ctxt, count_expr: @ast::expr) -> uint {
42544251
match const_eval::eval_const_expr_partial(tcx, count_expr) {
42554252
Ok(ref const_val) => match *const_val {
42564253
const_eval::const_int(count) => return count as uint,
42574254
const_eval::const_uint(count) => return count as uint,
42584255
const_eval::const_float(count) => {
4259-
tcx.sess.span_err(span,
4256+
tcx.sess.span_err(count_expr.span,
42604257
~"expected signed or unsigned integer for \
42614258
repeat count but found float");
42624259
return count as uint;
42634260
}
42644261
const_eval::const_str(_) => {
4265-
tcx.sess.span_err(span,
4262+
tcx.sess.span_err(count_expr.span,
42664263
~"expected signed or unsigned integer for \
42674264
repeat count but found string");
42684265
return 0;
42694266
}
42704267
const_eval::const_bool(_) => {
4271-
tcx.sess.span_err(span,
4268+
tcx.sess.span_err(count_expr.span,
42724269
~"expected signed or unsigned integer for \
42734270
repeat count but found boolean");
42744271
return 0;
42754272
}
42764273
},
42774274
Err(*) => {
4278-
tcx.sess.span_err(span,
4275+
tcx.sess.span_err(count_expr.span,
42794276
~"expected constant integer for repeat count \
42804277
but found variable");
42814278
return 0;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
21472147
ty::mk_evec(tcx, ty::mt {ty: t, mutbl: mutability}, tt)
21482148
}
21492149
ast::expr_repeat(element, count_expr, mutbl) => {
2150-
let count = ty::eval_repeat_count(tcx, count_expr, expr.span);
2150+
let count = ty::eval_repeat_count(tcx, count_expr);
21512151
fcx.write_ty(count_expr.id, ty::mk_uint(tcx));
21522152
let tt = ast_expr_vstore_to_vstore(fcx, ev, count, vst);
21532153
let t: ty::t = fcx.infcx().next_ty_var();
@@ -2474,7 +2474,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
24742474
fcx.write_ty(id, typ);
24752475
}
24762476
ast::expr_repeat(element, count_expr, mutbl) => {
2477-
let count = ty::eval_repeat_count(tcx, count_expr, expr.span);
2477+
let count = ty::eval_repeat_count(tcx, count_expr);
24782478
fcx.write_ty(count_expr.id, ty::mk_uint(tcx));
24792479
let t: ty::t = fcx.infcx().next_ty_var();
24802480
bot |= check_expr_has_type(fcx, element, t);

0 commit comments

Comments
 (0)