rust/src/librustc_typeck
bors e82faeb655 Auto merge of #28742 - nikomatsakis:def-id-encapsulate, r=eddyb
As described in https://github.com/rust-lang/rfcs/pull/1298, the idea here is to make DefIds independent of changes to the content of other items. They are also *mostly* independent from ordering, so e.g. reordering two functions will change the defids, but it will not change the paths that they expand into (but this is not the case for some things, such as impls).

This is a major refactoring, so I did it in slices. The final commit is in some sense The Big One where most of the work is done. The earlier commits just pave the way by gradually refactoring accesses to the `node` field.

This is a [breaking-change] for plugin authors. The things you need to do to migrate your code are as follows:

1. For local def-ids, rather than do `def_id.node`, call `tcx.map.as_local_node_id(def_id)`.
2. To construct a local def-id, call `tcx.map.local_def_id(node_id)`.
3. Note that you cannot make def-ids for any node, but only for "definitions" -- which include all items, as well as a number of other things, but not e.g. arbitrary expressions.
4. You can get the path to a def-id by calling `tcx.def_path(def_id)`.

One thing that is NOT part of this PR, but which I plan do in a follow-up, is converting uses of the existing `with_path` API to use `def_path`, which is basically the same.

r? @eddyb (or @nrc)
2015-10-01 16:26:28 +00:00
..
check Auto merge of #28742 - nikomatsakis:def-id-encapsulate, r=eddyb 2015-10-01 16:26:28 +00:00
coherence move direct accesses of node to go through as_local_node_id, unless 2015-10-01 10:37:19 -04:00
astconv.rs move direct accesses of node to go through as_local_node_id, unless 2015-10-01 10:37:19 -04:00
collect.rs move direct accesses of node to go through as_local_node_id, unless 2015-10-01 10:37:19 -04:00
constrained_type_params.rs rustc: move some functions in middle::ty working on Ty to methods. 2015-06-26 07:34:56 +03:00
diagnostics.rs early-prohibit objects with Self-containing supertraits 2015-09-24 18:27:29 +03:00
lib.rs move job of creating local-def-ids to ast-map (with a few stragglers) 2015-10-01 10:28:28 -04:00
rscope.rs move middle::ty and related modules to middle/ty/ 2015-09-14 10:56:13 +03:00
variance.rs move direct accesses of node to go through as_local_node_id, unless 2015-10-01 10:37:19 -04:00