]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #44171 - eddyb:scope, r=nikomatsakis
authorbors <bors@rust-lang.org>
Fri, 1 Sep 2017 10:40:18 +0000 (10:40 +0000)
committerbors <bors@rust-lang.org>
Fri, 1 Sep 2017 10:40:18 +0000 (10:40 +0000)
Use hir::ItemLocalId instead of ast::NodeId in rustc::middle::region::CodeExtent.

This is an alternative to @michaelwoerister's #43887, changing `CodeExtent` instead of `ReScope`.

The benefit here is that the same `Region`s are used same-crate and cross-crate, while preserving the incremental recompilation properties of the stable `hir::ItemLocalId`.

Only places which needed to get back to the `ast::NodeId` from `CodeExtent` was its `span` method, used in error reporting - passing the `&RegionMaps` down allowed using `hir_to_node_id`.
`rustc::cfg` and `dataflow` also had to be converted to `hir::ItemLocalId` because of their interactions with `CodeExtent`, especially in `borrowck`, and from that we have 3 more `hir_to_node_id` calls: `cfg::graphviz` node labels, `borrowck` move reporting, and the `unconditional_recursion` lint.

Out of all of those, *only* the lint actually makes a decision (on whether code will compile) based on the result of the conversion, the others only use it to know how to print information to the user.
So I think we're safe to say that the bulk of the code working with a `CodeExtent` is fine with local IDs.

r? @nikomatsakis


Trivial merge