Skip to content

Commit 0c89855

Browse files
committed
---
yaml --- r: 13579 b: refs/heads/master c: 8395305 h: refs/heads/master i: 13577: 2782cca 13575: 37e1e34 v: v3
1 parent daeadd8 commit 0c89855

File tree

6 files changed

+44
-67
lines changed

6 files changed

+44
-67
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 60a658250ea2ee6dd10425d7070c373262762b1c
2+
refs/heads/master: 8395305e71895b152e3f0abefb6cbc9e74f15a16
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/doc/rust.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ h3 a:link, h3 a:visited { color: black; }
5151
.cm-s-default span.cm-bracket {color: #cc7;}
5252
.cm-s-default span.cm-tag {color: #170;}
5353
.cm-s-default span.cm-attribute {color: #00c;}
54+
55+
h1.title {
56+
background-image: url('http://www.rust-lang.org/logos/rust-logo-32x32-blk.png');
57+
background-repeat: no-repeat;
58+
background-position: right;
59+
}

trunk/src/rustc/middle/lint.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ fn check_item_while_true(cx: ty::ctxt, it: @ast::item) {
331331
alt cond.node {
332332
ast::expr_lit(@{node: ast::lit_bool(true),_}) {
333333
cx.sess.span_lint(
334-
while_true, e.id, it.id,
334+
while_true, it.id, e.id,
335335
e.span,
336336
"denote infinite loops with loop { ... }");
337337
}
@@ -357,14 +357,14 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) {
357357
alt cx.def_map.get(id) {
358358
ast::def_prim_ty(ast::ty_int(ast::ty_i)) {
359359
cx.sess.span_lint(
360-
ctypes, id, fn_id,
360+
ctypes, fn_id, id,
361361
ty.span,
362362
"found rust type `int` in native module, while \
363363
libc::c_int or libc::c_long should be used");
364364
}
365365
ast::def_prim_ty(ast::ty_uint(ast::ty_u)) {
366366
cx.sess.span_lint(
367-
ctypes, id, fn_id,
367+
ctypes, fn_id, id,
368368
ty.span,
369369
"found rust type `uint` in native module, while \
370370
libc::c_uint or libc::c_ulong should be used");
@@ -400,7 +400,7 @@ fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
400400
node: ast::expr_path(@path),
401401
span: _}, _) {
402402
cx.sess.span_lint(
403-
path_statement, id, it.id,
403+
path_statement, it.id, id,
404404
s.span,
405405
"path statement with no effect");
406406
}
@@ -423,7 +423,7 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) {
423423
ast::expr_lit(@{node: ast::lit_str(_), span:_})
424424
if ! uses_vstore.contains_key(e.id) {
425425
cx.sess.span_lint(
426-
old_vecs, e.id, it.id,
426+
old_vecs, it.id, e.id,
427427
e.span, "deprecated vec/str expr");
428428
}
429429
ast::expr_vstore(@inner, _) {
@@ -438,15 +438,15 @@ fn check_item_old_vecs(cx: ty::ctxt, it: @ast::item) {
438438
ast::ty_vec(_)
439439
if ! uses_vstore.contains_key(t.id) {
440440
cx.sess.span_lint(
441-
old_vecs, t.id, it.id,
441+
old_vecs, it.id, t.id,
442442
t.span, "deprecated vec type");
443443
}
444444

445445
ast::ty_path(@{span: _, global: _, idents: ids,
446446
rp: none, types: _}, _)
447447
if ids == [@"str"] && (! uses_vstore.contains_key(t.id)) {
448448
cx.sess.span_lint(
449-
old_vecs, t.id, it.id,
449+
old_vecs, it.id, t.id,
450450
t.span, "deprecated str type");
451451
}
452452

trunk/src/rustc/middle/typeck/check.rs

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11321132
// and so forth. - Niko
11331133
fcx.write_nil(expr.id);
11341134
}
1135-
ast::expr_unary(unop, oprnd) {
1135+
ast::expr_unary(unop, oper) {
11361136
let exp_inner = unpack_expected(fcx, expected) {|sty|
11371137
alt unop {
11381138
ast::box(_) | ast::uniq(_) {
@@ -1145,17 +1145,17 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11451145
ast::deref { none }
11461146
}
11471147
};
1148-
bot = check_expr(fcx, oprnd, exp_inner);
1149-
let mut oprnd_t = fcx.expr_ty(oprnd);
1148+
bot = check_expr(fcx, oper, exp_inner);
1149+
let mut oper_t = fcx.expr_ty(oper);
11501150
alt unop {
11511151
ast::box(mutbl) {
1152-
oprnd_t = ty::mk_box(tcx, {ty: oprnd_t, mutbl: mutbl});
1152+
oper_t = ty::mk_box(tcx, {ty: oper_t, mutbl: mutbl});
11531153
}
11541154
ast::uniq(mutbl) {
1155-
oprnd_t = ty::mk_uniq(tcx, {ty: oprnd_t, mutbl: mutbl});
1155+
oper_t = ty::mk_uniq(tcx, {ty: oper_t, mutbl: mutbl});
11561156
}
11571157
ast::deref {
1158-
let sty = structure_of(fcx, expr.span, oprnd_t);
1158+
let sty = structure_of(fcx, expr.span, oper_t);
11591159

11601160
// deref'ing an unsafe pointer requires that we be in an unsafe
11611161
// context
@@ -1169,7 +1169,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11691169
}
11701170

11711171
alt ty::deref_sty(tcx, sty, true) {
1172-
some(mt) { oprnd_t = mt.ty }
1172+
some(mt) { oper_t = mt.ty }
11731173
none {
11741174
alt sty {
11751175
ty::ty_enum(*) {
@@ -1183,46 +1183,39 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11831183
tcx.sess.span_err(
11841184
expr.span,
11851185
#fmt["type %s cannot be dereferenced",
1186-
fcx.infcx.ty_to_str(oprnd_t)]);
1186+
fcx.infcx.ty_to_str(oper_t)]);
11871187
}
11881188
}
11891189
}
11901190
}
11911191
}
11921192
ast::not {
1193-
oprnd_t = structurally_resolved_type(fcx, oprnd.span, oprnd_t);
1194-
if !(ty::type_is_integral(oprnd_t) ||
1195-
ty::get(oprnd_t).struct == ty::ty_bool) {
1196-
oprnd_t = check_user_unop(fcx, "!", "!", expr,
1197-
oprnd, oprnd_t);
1193+
oper_t = structurally_resolved_type(fcx, oper.span, oper_t);
1194+
if !(ty::type_is_integral(oper_t) ||
1195+
ty::get(oper_t).struct == ty::ty_bool) {
1196+
oper_t = check_user_unop(fcx, "!", "!", expr,
1197+
oper, oper_t);
11981198
}
11991199
}
12001200
ast::neg {
1201-
// If the operand's type is an integral type variable, we
1202-
// don't want to resolve it yet, because the rest of the
1203-
// typing context might not have had the opportunity to
1204-
// constrain it yet.
1205-
if !(ty::type_is_var_integral(oprnd_t)) {
1206-
oprnd_t = structurally_resolved_type(fcx, oprnd.span,
1207-
oprnd_t);
1208-
}
1209-
if !(ty::type_is_integral(oprnd_t) ||
1210-
ty::type_is_fp(oprnd_t)) {
1211-
oprnd_t = check_user_unop(fcx, "-", "unary-", expr,
1212-
oprnd, oprnd_t);
1201+
oper_t = structurally_resolved_type(fcx, oper.span, oper_t);
1202+
if !(ty::type_is_integral(oper_t) ||
1203+
ty::type_is_fp(oper_t)) {
1204+
oper_t = check_user_unop(fcx, "-", "unary-", expr,
1205+
oper, oper_t);
12131206
}
12141207
}
12151208
}
1216-
fcx.write_ty(id, oprnd_t);
1209+
fcx.write_ty(id, oper_t);
12171210
}
1218-
ast::expr_addr_of(mutbl, oprnd) {
1219-
bot = check_expr(fcx, oprnd, unpack_expected(fcx, expected) {|ty|
1211+
ast::expr_addr_of(mutbl, oper) {
1212+
bot = check_expr(fcx, oper, unpack_expected(fcx, expected) {|ty|
12201213
alt ty { ty::ty_rptr(_, mt) { some(mt.ty) } _ { none } }
12211214
});
1222-
let region = region_of(fcx, oprnd);
1223-
let tm = { ty: fcx.expr_ty(oprnd), mutbl: mutbl };
1224-
let oprnd_t = ty::mk_rptr(tcx, region, tm);
1225-
fcx.write_ty(id, oprnd_t);
1215+
let region = region_of(fcx, oper);
1216+
let tm = { ty: fcx.expr_ty(oper), mutbl: mutbl };
1217+
let oper_t = ty::mk_rptr(tcx, region, tm);
1218+
fcx.write_ty(id, oper_t);
12261219
}
12271220
ast::expr_path(pth) {
12281221
let defn = lookup_def(fcx, pth.span, id);

trunk/src/rustc/middle/typeck/infer.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -119,28 +119,6 @@ is valid. This basically corresponds to the block nesting structure:
119119
the regions for outer block scopes are superregions of those for inner
120120
block scopes.
121121
122-
## Integral type variables
123-
124-
There is a third variety of type variable that we use only for
125-
inferring the types of unsuffixed integer literals. Integral type
126-
variables differ from general-purpose type variables in that there's
127-
no subtyping relationship among the various integral types, so instead
128-
of associating each variable with an upper and lower bound, we
129-
represent the set of possible integral types it can take on with an
130-
`int_ty_set`, which is a bitvector with one bit for each integral
131-
type. Because intersecting these sets with each other is simpler than
132-
merging bounds, we don't need to do so transactionally as we do for
133-
general-purpose type variables.
134-
135-
We could conceivably define a subtyping relationship among integral
136-
types based on their ranges, but we choose not to open that particular
137-
can of worms. Our strategy is to treat integral type variables as
138-
unknown until the typing context constrains them to a unique integral
139-
type, at which point they take on that type. If the typing context
140-
overconstrains the type, it's a type error; if we reach the point at
141-
which type variables must be resolved and an integral type variable is
142-
still underconstrained, it defaults to `int` as a last resort.
143-
144122
## GLB/LUB
145123
146124
Computing the greatest-lower-bound and least-upper-bound of two
@@ -851,7 +829,7 @@ impl unify_methods for infer_ctxt {
851829
}
852830
} else if nde_a.rank < nde_b.rank {
853831
#debug["vars(): b has smaller rank"];
854-
// b has greater rank, so a should redirect to b.
832+
// b has geater rank, so a should redirect to b.
855833
self.set(vb, a_id, redirect(b_id));
856834
self.set_var_to_merged_bounds(
857835
vb, b_id, a_bounds, b_bounds, nde_b.rank).then {||

trunk/src/test/run-pass/integer-literal-suffix-inference.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ fn main() {
1616

1717
let _i: i8 = -128;
1818
let j = -128;
19-
id_i8(j);
19+
// id_i8(j);
2020
id_i8(-128);
2121

2222
let _i: i16 = -32_768;
2323
let j = -32_768;
24-
id_i16(j);
24+
// id_i16(j);
2525
id_i16(-32_768);
2626

2727
let _i: i32 = -2_147_483_648;
2828
let j = -2_147_483_648;
29-
id_i32(j);
29+
// id_i32(j);
3030
id_i32(-2_147_483_648);
3131

3232
let _i: i64 = -9_223_372_036_854_775_808;
3333
let j = -9_223_372_036_854_775_808;
34-
id_i64(j);
34+
// id_i64(j);
3535
id_i64(-9_223_372_036_854_775_808);
3636

3737
let _i: uint = 1;

0 commit comments

Comments
 (0)