Skip to content

Commit 1c0c2af

Browse files
committed
merge TypeckItemBody and Tables depnodes
1 parent 01195df commit 1c0c2af

File tree

31 files changed

+113
-114
lines changed

31 files changed

+113
-114
lines changed

src/librustc/dep_graph/README.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,15 @@ The idea is that you can annotate a test like:
326326
#[rustc_if_this_changed]
327327
fn foo() { }
328328

329-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
329+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
330330
fn bar() { foo(); }
331331

332-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
332+
#[rustc_then_this_would_need(Tables)] //~ ERROR no path
333333
fn baz() { }
334334
```
335335

336336
This will check whether there is a path in the dependency graph from
337-
`Hir(foo)` to `TypeckItemBody(bar)`. An error is reported for each
337+
`Hir(foo)` to `Tables(bar)`. An error is reported for each
338338
`#[rustc_then_this_would_need]` annotation that indicates whether a
339339
path exists. `//~ ERROR` annotations can then be used to test if a
340340
path is found (as demonstrated above).
@@ -371,27 +371,27 @@ A node is considered to match a filter if all of those strings appear in its
371371
label. So, for example:
372372

373373
```
374-
RUST_DEP_GRAPH_FILTER='-> TypeckItemBody'
374+
RUST_DEP_GRAPH_FILTER='-> Tables'
375375
```
376376

377-
would select the predecessors of all `TypeckItemBody` nodes. Usually though you
378-
want the `TypeckItemBody` node for some particular fn, so you might write:
377+
would select the predecessors of all `Tables` nodes. Usually though you
378+
want the `Tables` node for some particular fn, so you might write:
379379

380380
```
381-
RUST_DEP_GRAPH_FILTER='-> TypeckItemBody & bar'
381+
RUST_DEP_GRAPH_FILTER='-> Tables & bar'
382382
```
383383

384-
This will select only the `TypeckItemBody` nodes for fns with `bar` in their name.
384+
This will select only the `Tables` nodes for fns with `bar` in their name.
385385

386386
Perhaps you are finding that when you change `foo` you need to re-type-check `bar`,
387387
but you don't think you should have to. In that case, you might do:
388388

389389
```
390-
RUST_DEP_GRAPH_FILTER='Hir&foo -> TypeckItemBody & bar'
390+
RUST_DEP_GRAPH_FILTER='Hir&foo -> Tables & bar'
391391
```
392392

393393
This will dump out all the nodes that lead from `Hir(foo)` to
394-
`TypeckItemBody(bar)`, from which you can (hopefully) see the source
394+
`Tables(bar)`, from which you can (hopefully) see the source
395395
of the erroneous edge.
396396

397397
#### Tracking down incorrect edges
@@ -417,8 +417,8 @@ dep-graph as described in the previous section and open `dep-graph.txt`
417417
to see something like:
418418

419419
Hir(foo) -> Collect(bar)
420-
Collect(bar) -> TypeckItemBody(bar)
421-
420+
Collect(bar) -> Tables(bar)
421+
422422
That first edge looks suspicious to you. So you set
423423
`RUST_FORBID_DEP_GRAPH_EDGE` to `Hir&foo -> Collect&bar`, re-run, and
424424
then observe the backtrace. Voila, bug fixed!
@@ -440,4 +440,6 @@ To achieve this, the HIR map will detect if the def-id originates in
440440
an inlined node and add a dependency to a suitable `MetaData` node
441441
instead. If you are reading a HIR node and are not sure if it may be
442442
inlined or not, you can use `tcx.map.read(node_id)` and it will detect
443-
whether the node is inlined or not and do the right thing.
443+
whether the node is inlined or not and do the right thing. You can
444+
also use `tcx.map.is_inlined_def_id()` and
445+
`tcx.map.is_inlined_node_id()` to test.

src/librustc/dep_graph/dep_node.rs

-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub enum DepNode<D: Clone + Debug> {
7878
Variance,
7979
WfCheck(D),
8080
TypeckItemType(D),
81-
TypeckItemBody(D),
8281
Dropck,
8382
DropckImpl(D),
8483
UnusedTraitCheck,
@@ -158,7 +157,6 @@ impl<D: Clone + Debug> DepNode<D> {
158157
HirBody,
159158
TransCrateItem,
160159
TypeckItemType,
161-
TypeckItemBody,
162160
AssociatedItems,
163161
ItemSignature,
164162
AssociatedItemDefIds,
@@ -216,7 +214,6 @@ impl<D: Clone + Debug> DepNode<D> {
216214
CoherenceOrphanCheck(ref d) => op(d).map(CoherenceOrphanCheck),
217215
WfCheck(ref d) => op(d).map(WfCheck),
218216
TypeckItemType(ref d) => op(d).map(TypeckItemType),
219-
TypeckItemBody(ref d) => op(d).map(TypeckItemBody),
220217
DropckImpl(ref d) => op(d).map(DropckImpl),
221218
CheckConst(ref d) => op(d).map(CheckConst),
222219
IntrinsicCheck(ref d) => op(d).map(IntrinsicCheck),

src/librustc_incremental/persist/dirty_clean.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
//! we will check that a suitable node for that item either appears
1515
//! or does not appear in the dep-graph, as appropriate:
1616
//!
17-
//! - `#[rustc_dirty(label="TypeckItemBody", cfg="rev2")]` if we are
17+
//! - `#[rustc_dirty(label="Tables", cfg="rev2")]` if we are
1818
//! in `#[cfg(rev2)]`, then there MUST NOT be a node
19-
//! `DepNode::TypeckItemBody(X)` where `X` is the def-id of the
19+
//! `DepNode::Tables(X)` where `X` is the def-id of the
2020
//! current node.
21-
//! - `#[rustc_clean(label="TypeckItemBody", cfg="rev2")]` same as above,
21+
//! - `#[rustc_clean(label="Tables", cfg="rev2")]` same as above,
2222
//! except that the node MUST exist.
2323
//!
2424
//! Errors are reported if we are in the suitable configuration but

src/librustc_incremental/persist/preds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<'q> Predecessors<'q> {
5656

5757
// if -Z query-dep-graph is passed, save more extended data
5858
// to enable better unit testing
59-
DepNode::TypeckItemBody(_) |
59+
DepNode::Tables(_) |
6060
DepNode::TransCrateItem(_) => tcx.sess.opts.debugging_opts.query_dep_graph,
6161

6262
_ => false,

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,14 @@ pub fn check_item_types(ccx: &CrateCtxt) -> CompileResult {
628628
pub fn check_item_bodies(ccx: &CrateCtxt) -> CompileResult {
629629
ccx.tcx.sess.track_errors(|| {
630630
let mut visit = CheckItemBodiesVisitor { ccx: ccx };
631-
ccx.tcx.visit_all_item_likes_in_krate(DepNode::TypeckItemBody, &mut visit);
631+
ccx.tcx.visit_all_item_likes_in_krate(DepNode::Tables, &mut visit);
632632

633633
// Process deferred obligations, now that all functions
634634
// bodies have been fully inferred.
635635
for (&item_id, obligations) in ccx.deferred_obligations.borrow().iter() {
636636
// Use the same DepNode as for the body of the original function/item.
637637
let def_id = ccx.tcx.map.local_def_id(item_id);
638-
let _task = ccx.tcx.dep_graph.in_task(DepNode::TypeckItemBody(def_id));
638+
let _task = ccx.tcx.dep_graph.in_task(DepNode::Tables(def_id));
639639

640640
let param_env = ParameterEnvironment::for_item(ccx.tcx, item_id);
641641
ccx.tcx.infer_ctxt(param_env, Reveal::NotSpecializable).enter(|infcx| {

src/test/compile-fail/dep-graph-assoc-type-trans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mod x {
3535
mod y {
3636
use Foo;
3737

38-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
38+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
3939
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR OK
4040
pub fn use_char_assoc() {
4141
// Careful here: in the representation, <char as Foo>::T gets

src/test/compile-fail/dep-graph-caller-callee.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod y {
2727
use x;
2828

2929
// These dependencies SHOULD exist:
30-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
30+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
3131
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR OK
3232
pub fn y() {
3333
x::x();
@@ -39,7 +39,7 @@ mod z {
3939

4040
// These are expected to yield errors, because changes to `x`
4141
// affect the BODY of `y`, but not its signature.
42-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
42+
#[rustc_then_this_would_need(Tables)] //~ ERROR no path
4343
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR no path
4444
pub fn z() {
4545
y::y();

src/test/compile-fail/dep-graph-trait-impl-two-traits-same-method.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mod x {
3939
mod y {
4040
use {Foo, Bar};
4141

42-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
42+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
4343
pub fn with_char() {
4444
char::method('a');
4545
}
@@ -48,7 +48,7 @@ mod y {
4848
mod z {
4949
use y;
5050

51-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
51+
#[rustc_then_this_would_need(Tables)] //~ ERROR no path
5252
pub fn z() {
5353
y::with_char();
5454
}

src/test/compile-fail/dep-graph-trait-impl-two-traits.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod x {
3838
mod y {
3939
use {Foo, Bar};
4040

41-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
41+
#[rustc_then_this_would_need(Tables)] //~ ERROR no path
4242
pub fn call_bar() {
4343
char::bar('a');
4444
}
@@ -47,7 +47,7 @@ mod y {
4747
mod z {
4848
use y;
4949

50-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
50+
#[rustc_then_this_would_need(Tables)] //~ ERROR no path
5151
pub fn z() {
5252
y::call_bar();
5353
}

src/test/compile-fail/dep-graph-trait-impl.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ mod x {
3434
mod y {
3535
use Foo;
3636

37-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
37+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
3838
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR OK
3939
pub fn with_char() {
4040
char::method('a');
4141
}
4242

43-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
43+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
4444
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR OK
4545
pub fn take_foo_with_char() {
4646
take_foo::<char>('a');
4747
}
4848

49-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
49+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
5050
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR OK
5151
pub fn with_u32() {
5252
u32::method(22);
5353
}
5454

55-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR OK
55+
#[rustc_then_this_would_need(Tables)] //~ ERROR OK
5656
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR OK
5757
pub fn take_foo_with_u32() {
5858
take_foo::<u32>(22);
@@ -66,7 +66,7 @@ mod z {
6666

6767
// These are expected to yield errors, because changes to `x`
6868
// affect the BODY of `y`, but not its signature.
69-
#[rustc_then_this_would_need(TypeckItemBody)] //~ ERROR no path
69+
#[rustc_then_this_would_need(Tables)] //~ ERROR no path
7070
#[rustc_then_this_would_need(TransCrateItem)] //~ ERROR no path
7171
pub fn z() {
7272
y::with_char();

src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extern crate point;
3232
mod fn_calls_methods_in_same_impl {
3333
use point::Point;
3434

35-
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
35+
#[rustc_clean(label="Tables", cfg="rpass2")]
3636
pub fn check() {
3737
let x = Point { x: 2.0, y: 2.0 };
3838
x.distance_from_origin();
@@ -43,7 +43,7 @@ mod fn_calls_methods_in_same_impl {
4343
mod fn_calls_free_fn {
4444
use point::{self, Point};
4545

46-
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
46+
#[rustc_clean(label="Tables", cfg="rpass2")]
4747
pub fn check() {
4848
let x = Point { x: 2.0, y: 2.0 };
4949
point::distance_squared(&x);
@@ -54,7 +54,7 @@ mod fn_calls_free_fn {
5454
mod fn_make_struct {
5555
use point::Point;
5656

57-
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
57+
#[rustc_clean(label="Tables", cfg="rpass2")]
5858
pub fn make_origin() -> Point {
5959
Point { x: 2.0, y: 2.0 }
6060
}
@@ -64,7 +64,7 @@ mod fn_make_struct {
6464
mod fn_read_field {
6565
use point::Point;
6666

67-
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
67+
#[rustc_clean(label="Tables", cfg="rpass2")]
6868
pub fn get_x(p: Point) -> f32 {
6969
p.x
7070
}
@@ -74,7 +74,7 @@ mod fn_read_field {
7474
mod fn_write_field {
7575
use point::Point;
7676

77-
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
77+
#[rustc_clean(label="Tables", cfg="rpass2")]
7878
pub fn inc_x(p: &mut Point) {
7979
p.x += 1.0;
8080
}

src/test/incremental/callee_caller_cross_crate/b.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
extern crate a;
1818

19-
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
19+
#[rustc_dirty(label="Tables", cfg="rpass2")]
2020
pub fn call_function0() {
2121
a::function0(77);
2222
}
2323

24-
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
24+
#[rustc_clean(label="Tables", cfg="rpass2")]
2525
pub fn call_function1() {
2626
a::function1(77);
2727
}

src/test/incremental/change_add_field/struct_point.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ mod point {
7979
mod fn_with_type_in_sig {
8080
use point::Point;
8181

82-
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
82+
#[rustc_dirty(label="Tables", cfg="rpass2")]
8383
pub fn boop(p: Option<&Point>) -> f32 {
8484
p.map(|p| p.total()).unwrap_or(0.0)
8585
}
@@ -95,7 +95,7 @@ mod fn_with_type_in_sig {
9595
mod call_fn_with_type_in_sig {
9696
use fn_with_type_in_sig;
9797

98-
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
98+
#[rustc_dirty(label="Tables", cfg="rpass2")]
9999
pub fn bip() -> f32 {
100100
fn_with_type_in_sig::boop(None)
101101
}
@@ -111,7 +111,7 @@ mod call_fn_with_type_in_sig {
111111
mod fn_with_type_in_body {
112112
use point::Point;
113113

114-
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
114+
#[rustc_dirty(label="Tables", cfg="rpass2")]
115115
pub fn boop() -> f32 {
116116
Point::origin().total()
117117
}
@@ -124,7 +124,7 @@ mod fn_with_type_in_body {
124124
mod call_fn_with_type_in_body {
125125
use fn_with_type_in_body;
126126

127-
#[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
127+
#[rustc_clean(label="Tables", cfg="rpass2")]
128128
pub fn bip() -> f32 {
129129
fn_with_type_in_body::boop()
130130
}
@@ -134,7 +134,7 @@ mod call_fn_with_type_in_body {
134134
mod fn_make_struct {
135135
use point::Point;
136136

137-
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
137+
#[rustc_dirty(label="Tables", cfg="rpass2")]
138138
pub fn make_origin(p: Point) -> Point {
139139
Point { ..p }
140140
}
@@ -144,7 +144,7 @@ mod fn_make_struct {
144144
mod fn_read_field {
145145
use point::Point;
146146

147-
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
147+
#[rustc_dirty(label="Tables", cfg="rpass2")]
148148
pub fn get_x(p: Point) -> f32 {
149149
p.x
150150
}
@@ -154,7 +154,7 @@ mod fn_read_field {
154154
mod fn_write_field {
155155
use point::Point;
156156

157-
#[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
157+
#[rustc_dirty(label="Tables", cfg="rpass2")]
158158
pub fn inc_x(p: &mut Point) {
159159
p.x += 1.0;
160160
}

src/test/incremental/change_crate_order/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern crate a;
2828
use a::A;
2929
use b::B;
3030

31-
//? #[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
31+
//? #[rustc_clean(label="Tables", cfg="rpass2")]
3232
pub fn main() {
3333
A + B;
3434
}

0 commit comments

Comments
 (0)