Skip to content

Commit 6c88890

Browse files
committed
---
yaml --- r: 10654 b: refs/heads/snap-stage3 c: abfa816 h: refs/heads/master v: v3
1 parent 558409e commit 6c88890

File tree

3 files changed

+11
-18
lines changed

3 files changed

+11
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 317864672df72a0cb33209f78506bedb99d16223
4+
refs/heads/snap-stage3: abfa8164cd9d64e95039019eb9b4c3fdec2685c5
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/rustc/middle/typeck/check.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ import rscope::{anon_rscope, binding_rscope, empty_rscope, in_anon_rscope};
7474
import rscope::{in_binding_rscope, region_scope, type_rscope};
7575
import syntax::ast::ty_i;
7676
import typeck::infer::{unify_methods}; // infcx.set()
77-
import typeck::infer::{force_level, force_none, force_non_region_vars_only,
77+
import typeck::infer::{force_level, force_none, force_ty_vars_only,
7878
force_all};
7979

8080
type fn_ctxt =
@@ -1174,14 +1174,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
11741174
}
11751175
}
11761176
ast::neg {
1177-
// If the operand's type is an integral type variable, we
1178-
// don't want to resolve it yet, because the rest of the
1179-
// typing context might not have had the opportunity to
1180-
// constrain it yet.
1181-
if !(ty::type_is_var_integral(oprnd_t)) {
1182-
oprnd_t = structurally_resolved_type(fcx, oprnd.span,
1183-
oprnd_t);
1184-
}
1177+
oprnd_t = structurally_resolved_type(fcx, oprnd.span, oprnd_t);
11851178
if !(ty::type_is_integral(oprnd_t) ||
11861179
ty::type_is_fp(oprnd_t)) {
11871180
oprnd_t = check_user_unop(fcx, "-", "unary-", expr,
@@ -2116,7 +2109,7 @@ fn instantiate_path(fcx: @fn_ctxt,
21162109
// resolution is possible, then an error is reported.
21172110
fn structurally_resolved_type(fcx: @fn_ctxt, sp: span, tp: ty::t) -> ty::t {
21182111
alt infer::resolve_shallow(fcx.infcx, tp,
2119-
force_non_region_vars_only) {
2112+
force_ty_vars_only) {
21202113
result::ok(t_s) if !ty::type_is_var(t_s) { ret t_s; }
21212114
_ {
21222115
fcx.ccx.tcx.sess.span_fatal

branches/snap-stage3/src/rustc/middle/typeck/infer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export fixup_err, fixup_err_to_str;
197197
export assignment;
198198
export root, to_str;
199199
export int_ty_set_all;
200-
export force_level, force_none, force_non_region_vars_only, force_all;
200+
export force_level, force_none, force_ty_vars_only, force_all;
201201

202202
// Bitvector to represent sets of integral types
203203
enum int_ty_set = uint;
@@ -1093,9 +1093,9 @@ enum force_level {
10931093
// Any unconstrained variables are OK.
10941094
force_none,
10951095

1096-
// Unconstrained region vars are OK; unconstrained ty vars and
1097-
// integral ty vars result in an error.
1098-
force_non_region_vars_only,
1096+
// Unconstrained region vars and integral ty vars are OK;
1097+
// unconstrained general-purpose ty vars result in an error.
1098+
force_ty_vars_only,
10991099

11001100
// Any unconstrained variables result in an error.
11011101
force_all,
@@ -1237,7 +1237,7 @@ impl methods for resolve_state {
12371237
{ ub:_, lb:some(t) } { self.resolve1(t) }
12381238
{ ub:none, lb:none } {
12391239
alt self.force_vars {
1240-
force_non_region_vars_only | force_all {
1240+
force_ty_vars_only | force_all {
12411241
self.err = some(unresolved_ty(vid));
12421242
}
12431243
force_none { /* ok */ }
@@ -1260,7 +1260,7 @@ impl methods for resolve_state {
12601260
some(t) { t }
12611261
none {
12621262
alt self.force_vars {
1263-
force_non_region_vars_only | force_all {
1263+
force_all {
12641264
// As a last resort, default to int.
12651265
let ty = ty::mk_int(self.infcx.tcx);
12661266
self.infcx.set(
@@ -1270,7 +1270,7 @@ impl methods for resolve_state {
12701270
nde.rank));
12711271
ty
12721272
}
1273-
force_none {
1273+
force_none | force_ty_vars_only {
12741274
ty::mk_var_integral(self.infcx.tcx, vid)
12751275
}
12761276
}

0 commit comments

Comments
 (0)