Skip to content

Commit 2acf32d

Browse files
committedMar 28, 2020
Auto merge of #70483 - Centril:rollup-slli4yf, r=Centril
Rollup of 5 pull requests Successful merges: - #70345 (Remove `no_integrated_as` mode.) - #70434 (suggest `;` on expr `mac!()` which is good as stmt `mac!()`) - #70457 (non-exhastive diagnostic: add note re. scrutinee type) - #70478 (Refactor type_of for constants) - #70480 (clarify hir_id <-> node_id method names) Failed merges: r? @ghost
2 parents 0bf7c2a + a023e61 commit 2acf32d

File tree

86 files changed

+485
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+485
-253
lines changed
 

‎src/librustc/hir/map/collector.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
241241
// Make sure that the DepNode of some node coincides with the HirId
242242
// owner of that node.
243243
if cfg!(debug_assertions) {
244-
let node_id = self.definitions.hir_to_node_id(hir_id);
245-
assert_eq!(self.definitions.node_to_hir_id(node_id), hir_id);
244+
let node_id = self.definitions.hir_id_to_node_id(hir_id);
245+
assert_eq!(self.definitions.node_id_to_hir_id(node_id), hir_id);
246246

247247
if hir_id.owner != self.current_dep_node_owner {
248248
let node_str = match self.definitions.opt_local_def_id(node_id) {
@@ -342,7 +342,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
342342
debug!("visit_item: {:?}", i);
343343
debug_assert_eq!(
344344
i.hir_id.owner,
345-
self.definitions.opt_local_def_id(self.definitions.hir_to_node_id(i.hir_id)).unwrap()
345+
self.definitions
346+
.opt_local_def_id(self.definitions.hir_id_to_node_id(i.hir_id))
347+
.unwrap()
346348
);
347349
self.with_dep_node_owner(i.hir_id.owner, i, |this, hash| {
348350
this.insert_with_hash(i.span, i.hir_id, Node::Item(i), hash);
@@ -374,7 +376,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
374376
fn visit_trait_item(&mut self, ti: &'hir TraitItem<'hir>) {
375377
debug_assert_eq!(
376378
ti.hir_id.owner,
377-
self.definitions.opt_local_def_id(self.definitions.hir_to_node_id(ti.hir_id)).unwrap()
379+
self.definitions
380+
.opt_local_def_id(self.definitions.hir_id_to_node_id(ti.hir_id))
381+
.unwrap()
378382
);
379383
self.with_dep_node_owner(ti.hir_id.owner, ti, |this, hash| {
380384
this.insert_with_hash(ti.span, ti.hir_id, Node::TraitItem(ti), hash);
@@ -388,7 +392,9 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
388392
fn visit_impl_item(&mut self, ii: &'hir ImplItem<'hir>) {
389393
debug_assert_eq!(
390394
ii.hir_id.owner,
391-
self.definitions.opt_local_def_id(self.definitions.hir_to_node_id(ii.hir_id)).unwrap()
395+
self.definitions
396+
.opt_local_def_id(self.definitions.hir_id_to_node_id(ii.hir_id))
397+
.unwrap()
392398
);
393399
self.with_dep_node_owner(ii.hir_id.owner, ii, |this, hash| {
394400
this.insert_with_hash(ii.span, ii.hir_id, Node::ImplItem(ii), hash);

‎src/librustc/hir/map/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<'hir> Map<'hir> {
161161
#[inline]
162162
pub fn local_def_id_from_node_id(&self, node: NodeId) -> DefId {
163163
self.opt_local_def_id_from_node_id(node).unwrap_or_else(|| {
164-
let hir_id = self.node_to_hir_id(node);
164+
let hir_id = self.node_id_to_hir_id(node);
165165
bug!(
166166
"local_def_id_from_node_id: no entry for `{}`, which has a map of `{:?}`",
167167
node,
@@ -184,7 +184,7 @@ impl<'hir> Map<'hir> {
184184

185185
#[inline]
186186
pub fn opt_local_def_id(&self, hir_id: HirId) -> Option<DefId> {
187-
let node_id = self.hir_to_node_id(hir_id);
187+
let node_id = self.hir_id_to_node_id(hir_id);
188188
self.opt_local_def_id_from_node_id(node_id)
189189
}
190190

@@ -204,13 +204,13 @@ impl<'hir> Map<'hir> {
204204
}
205205

206206
#[inline]
207-
pub fn hir_to_node_id(&self, hir_id: HirId) -> NodeId {
208-
self.tcx.definitions.hir_to_node_id(hir_id)
207+
pub fn hir_id_to_node_id(&self, hir_id: HirId) -> NodeId {
208+
self.tcx.definitions.hir_id_to_node_id(hir_id)
209209
}
210210

211211
#[inline]
212-
pub fn node_to_hir_id(&self, node_id: NodeId) -> HirId {
213-
self.tcx.definitions.node_to_hir_id(node_id)
212+
pub fn node_id_to_hir_id(&self, node_id: NodeId) -> HirId {
213+
self.tcx.definitions.node_id_to_hir_id(node_id)
214214
}
215215

216216
#[inline]

0 commit comments

Comments
 (0)