Skip to content

Commit d1dab2b

Browse files
committed
---
yaml --- r: 15832 b: refs/heads/try c: 564aa59 h: refs/heads/master v: v3
1 parent 617e914 commit d1dab2b

File tree

8 files changed

+52
-20
lines changed

8 files changed

+52
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 63210ecddb74fb601a17314c6866685d74fa89dc
5+
refs/heads/try: 564aa59a3ff1ec462f4be15041d89c2ac662f861
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/typeck.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,11 @@ independently:
3030
the `cx.tcache` table for later use
3131
3232
- check: walks over function bodies and type checks them, inferring types for
33-
local variables, type parameters, etc as necessary. Temporary types (which
34-
may contain references to type variables whose values have yet to be
35-
inferred) for each item within a function are stored in a temporary table
36-
inside of @fn_ctxt (function context).
33+
local variables, type parameters, etc as necessary.
3734
3835
- infer: finds the types to use for each type variable such that
39-
all subtyping and assignment constraints are met
40-
41-
- vtable: find and records the impls to use for each iface bound that
42-
appears on a type parameter
43-
44-
- writeback: writes the final types within a function body, replacing
45-
type variables with their final inferred types. These final types
46-
are written into the `tcx.node_types` table, which should *never* contain
47-
any reference to a type variable.
36+
all subtyping and assignment constraints are met. In essence, the check
37+
module specifies the constraints, and the infer module solves them.
4838
4939
*/
5040

branches/try/src/rustc/middle/typeck/check.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
/*
2+
3+
# check.rs
4+
5+
Within the check phase of type check, we check each item one at a time
6+
(bodies of function expressions are checked as part of the containing
7+
function). Inference is used to supply types wherever they are
8+
unknown.
9+
10+
By far the most complex case is checking the body of a function. This
11+
can be broken down into several distinct phases:
12+
13+
- gather: creates type variables to represent the type of each local
14+
variable and pattern binding.
15+
16+
- main: the main pass does the lion's share of the work: it
17+
determines the types of all expressions, resolves
18+
methods, checks for most invalid conditions, and so forth. In
19+
some cases, where a type is unknown, it may create a type or region
20+
variable and use that as the type of an expression.
21+
22+
In the process of checking, various constraints will be placed on
23+
these type variables through the subtyping relationships requested
24+
through the `demand` module. The `typeck::infer` module is in charge
25+
of resolving those constraints.
26+
27+
- regionck: after main is complete, the regionck pass goes over all
28+
types looking for regions and making sure that they did not escape
29+
into places they are not in scope. This may also influence the
30+
final assignments of the various region variables if there is some
31+
flexibility.
32+
33+
- vtable: find and records the impls to use for each iface bound that
34+
appears on a type parameter.
35+
36+
- writeback: writes the final types within a function body, replacing
37+
type variables with their final inferred types. These final types
38+
are written into the `tcx.node_types` table, which should *never* contain
39+
any reference to a type variable.
40+
41+
42+
*/
43+
144
import astconv::{ast_conv, region_scope, empty_rscope, ast_ty_to_ty,
245
in_anon_rscope};
346
import collect::{methods}; // ccx.to_ty()

branches/try/src/rustc/middle/typeck/regionck.rs renamed to branches/try/src/rustc/middle/typeck/check/regionck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ the region scope `r`.
1515

1616
import util::ppaux;
1717
import syntax::print::pprust;
18-
import check::{fn_ctxt, methods, lookup_def};
1918

2019
type rcx = @{fcx: @fn_ctxt, mut errors_reported: uint};
2120
type rvt = visit::vt<rcx>;

branches/try/src/rustc/rustc.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ mod middle {
5454
mod typeck {
5555
mod check {
5656
mod alt;
57+
mod vtable;
58+
mod writeback;
59+
mod regionck;
60+
mod demand;
5761
}
58-
mod regionck;
59-
mod demand;
60-
mod infer;
6162
mod astconv;
63+
mod infer;
6264
mod collect;
63-
mod vtable;
64-
mod writeback;
6565
}
6666
mod check_loop;
6767
mod check_alt;

0 commit comments

Comments
 (0)