Skip to content

Commit ec9b434

Browse files
committed
---
yaml --- r: 22561 b: refs/heads/master c: 748f2e0 h: refs/heads/master i: 22559: 8067642 v: v3
1 parent 4ae82fe commit ec9b434

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
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: 7eae2044b0f4bbb586cd48993d9a4d1853028cc7
2+
refs/heads/master: 748f2e09096a324d7f2764bd1d54f094a42ef248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

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

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,16 +1053,40 @@ impl unify_methods for infer_ctxt {
10531053
}
10541054

10551055
// Resolution is the process of removing type variables and replacing
1056-
// them with their inferred values. There are several "modes" for
1057-
// resolution. The first is a shallow resolution: this only resolves
1058-
// one layer, but does not resolve any nested variables. So, for
1059-
// example, if we have two variables A and B, and the constraint that
1060-
// A <: ~[B] and B <: int, then shallow resolution on A would yield
1061-
// ~[B]. Deep resolution, on the other hand, would yield ~[int].
1056+
// them with their inferred values. Unfortunately our inference has
1057+
// become fairly complex and so there are a number of options to
1058+
// control *just how much* you want to resolve and how you want to do
1059+
// it.
10621060
//
1063-
// But there is one more knob: the `force_level` variable controls
1064-
// the behavior in the face of unconstrained type and region
1065-
// variables.
1061+
// # Controlling the scope of resolution
1062+
//
1063+
// The options resolve_* determine what kinds of variables get
1064+
// resolved. Generally resolution starts with a top-level type
1065+
// variable; we will always resolve this. However, once we have
1066+
// resolved that variable, we may end up with a type that still
1067+
// contains type variables. For example, if we resolve `<T0>` we may
1068+
// end up with something like `[<T1>]`. If the option
1069+
// `resolve_nested_tvar` is passed, we will then go and recursively
1070+
// resolve `<T1>`.
1071+
//
1072+
// The options `resolve_rvar` and `resolve_ivar` control whether we
1073+
// resolve region and integral variables, respectively.
1074+
//
1075+
// # What do if things are unconstrained
1076+
//
1077+
// Sometimes we will encounter a variable that has no constraints, and
1078+
// therefore cannot sensibly be mapped to any particular result. By
1079+
// default, we will leave such variables as is (so you will get back a
1080+
// variable in your result). The options force_* will cause the
1081+
// resolution to fail in this case intead, except for the case of
1082+
// integral variables, which resolve to `int` if forced.
1083+
//
1084+
// # resolve_all and force_all
1085+
//
1086+
// The options are a bit set, so you can use the *_all to resolve or
1087+
// force all kinds of variables (including those we may add in the
1088+
// future). If you want to resolve everything but one type, you are
1089+
// probably better off writing `resolve_all - resolve_ivar`.
10661090

10671091
const resolve_nested_tvar: uint = 0b00000001;
10681092
const resolve_rvar: uint = 0b00000010;

0 commit comments

Comments
 (0)