Skip to content

Commit daeadd8

Browse files
committed
---
yaml --- r: 13578 b: refs/heads/master c: 60a6582 h: refs/heads/master v: v3
1 parent 2782cca commit daeadd8

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
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: 64912c9a56415c8a8586cd743ddbf3ab9baea2de
2+
refs/heads/master: 60a658250ea2ee6dd10425d7070c373262762b1c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,14 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11981198
}
11991199
}
12001200
ast::neg {
1201-
oprnd_t = structurally_resolved_type(fcx, oprnd.span, oprnd_t);
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+
}
12021209
if !(ty::type_is_integral(oprnd_t) ||
12031210
ty::type_is_fp(oprnd_t)) {
12041211
oprnd_t = check_user_unop(fcx, "-", "unary-", expr,

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)