Skip to content

Commit 4410916

Browse files
committed
replace NodeId with HirId in traits::ObligationCauseCode
1 parent 4fb77a0 commit 4410916

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/librustc/traits/error_reporting.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
937937
code: &ObligationCauseCode<'tcx>,
938938
err: &mut DiagnosticBuilder<'tcx>,
939939
) {
940-
if let &ObligationCauseCode::VariableType(node_id) = code {
941-
let parent_node = self.tcx.hir().get_parent_node(node_id);
942-
if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) {
940+
if let &ObligationCauseCode::VariableType(hir_id) = code {
941+
let parent_node = self.tcx.hir().get_parent_node_by_hir_id(hir_id);
942+
if let Some(Node::Local(ref local)) = self.tcx.hir().find_by_hir_id(parent_node) {
943943
if let Some(ref expr) = local.init {
944944
if let hir::ExprKind::Index(_, _) = expr.node {
945945
if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) {

src/librustc/traits/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub enum ObligationCauseCode<'tcx> {
188188
/// S { ... } must be Sized
189189
StructInitializerSized,
190190
/// Type of each variable must be Sized
191-
VariableType(ast::NodeId),
191+
VariableType(hir::HirId),
192192
/// Argument type must be Sized
193193
SizedArgumentType,
194194
/// Return type must be Sized

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,9 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {
993993
if let PatKind::Binding(_, _, ident, _) = p.node {
994994
let var_ty = self.assign(p.span, p.hir_id, None);
995995

996-
let node_id = self.fcx.tcx.hir().hir_to_node_id(p.hir_id);
997996
if !self.fcx.tcx.features().unsized_locals {
998997
self.fcx.require_type_is_sized(var_ty, p.span,
999-
traits::VariableType(node_id));
998+
traits::VariableType(p.hir_id));
1000999
}
10011000

10021001
debug!("Pattern binding {} is assigned to {} with type {:?}",

0 commit comments

Comments
 (0)