diff options
| -rw-r--r-- | src/librustc/traits/error_reporting.rs | 6 | ||||
| -rw-r--r-- | src/librustc/traits/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 3 |
3 files changed, 5 insertions, 6 deletions
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 2555833cd77..b433098c1b2 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -937,9 +937,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { code: &ObligationCauseCode<'tcx>, err: &mut DiagnosticBuilder<'tcx>, ) { - if let &ObligationCauseCode::VariableType(node_id) = code { - let parent_node = self.tcx.hir().get_parent_node(node_id); - if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) { + if let &ObligationCauseCode::VariableType(hir_id) = code { + let parent_node = self.tcx.hir().get_parent_node_by_hir_id(hir_id); + if let Some(Node::Local(ref local)) = self.tcx.hir().find_by_hir_id(parent_node) { if let Some(ref expr) = local.init { if let hir::ExprKind::Index(_, _) = expr.node { if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) { diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index f5c91a77517..8d17df1e610 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -188,7 +188,7 @@ pub enum ObligationCauseCode<'tcx> { /// S { ... } must be Sized StructInitializerSized, /// Type of each variable must be Sized - VariableType(ast::NodeId), + VariableType(hir::HirId), /// Argument type must be Sized SizedArgumentType, /// Return type must be Sized diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 0e83db48284..0fee2f063b8 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -993,10 +993,9 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> { if let PatKind::Binding(_, _, ident, _) = p.node { let var_ty = self.assign(p.span, p.hir_id, None); - let node_id = self.fcx.tcx.hir().hir_to_node_id(p.hir_id); if !self.fcx.tcx.features().unsized_locals { self.fcx.require_type_is_sized(var_ty, p.span, - traits::VariableType(node_id)); + traits::VariableType(p.hir_id)); } debug!("Pattern binding {} is assigned to {} with type {:?}", |
