@@ -326,15 +326,15 @@ The idea is that you can annotate a test like:
326
326
#[rustc_if_this_changed]
327
327
fn foo () { }
328
328
329
- #[rustc_then_this_would_need(TypeckItemBody )] // ~ ERROR OK
329
+ #[rustc_then_this_would_need(Tables )] // ~ ERROR OK
330
330
fn bar () { foo (); }
331
331
332
- #[rustc_then_this_would_need(TypeckItemBody )] // ~ ERROR no path
332
+ #[rustc_then_this_would_need(Tables )] // ~ ERROR no path
333
333
fn baz () { }
334
334
```
335
335
336
336
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
338
338
` #[rustc_then_this_would_need] ` annotation that indicates whether a
339
339
path exists. ` //~ ERROR ` annotations can then be used to test if a
340
340
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
371
371
label. So, for example:
372
372
373
373
```
374
- RUST_DEP_GRAPH_FILTER='-> TypeckItemBody '
374
+ RUST_DEP_GRAPH_FILTER='-> Tables '
375
375
```
376
376
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:
379
379
380
380
```
381
- RUST_DEP_GRAPH_FILTER='-> TypeckItemBody & bar'
381
+ RUST_DEP_GRAPH_FILTER='-> Tables & bar'
382
382
```
383
383
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.
385
385
386
386
Perhaps you are finding that when you change ` foo ` you need to re-type-check ` bar ` ,
387
387
but you don't think you should have to. In that case, you might do:
388
388
389
389
```
390
- RUST_DEP_GRAPH_FILTER='Hir&foo -> TypeckItemBody & bar'
390
+ RUST_DEP_GRAPH_FILTER='Hir&foo -> Tables & bar'
391
391
```
392
392
393
393
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
395
395
of the erroneous edge.
396
396
397
397
#### Tracking down incorrect edges
@@ -417,8 +417,8 @@ dep-graph as described in the previous section and open `dep-graph.txt`
417
417
to see something like:
418
418
419
419
Hir(foo) -> Collect(bar)
420
- Collect(bar) -> TypeckItemBody (bar)
421
-
420
+ Collect(bar) -> Tables (bar)
421
+
422
422
That first edge looks suspicious to you. So you set
423
423
` RUST_FORBID_DEP_GRAPH_EDGE ` to ` Hir&foo -> Collect&bar ` , re-run, and
424
424
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
440
440
an inlined node and add a dependency to a suitable ` MetaData ` node
441
441
instead. If you are reading a HIR node and are not sure if it may be
442
442
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.
0 commit comments