More borrowkind fixes

This commit is contained in:
Manish Goregaokar 2019-11-27 14:43:22 -08:00
parent 3430bc1bc5
commit e381143a6b
2 changed files with 5 additions and 5 deletions

View file

@ -674,7 +674,7 @@ fn never_loop_expr(expr: &Expr, main_loop_id: HirId) -> NeverLoopResult {
| ExprKind::Cast(ref e, _)
| ExprKind::Type(ref e, _)
| ExprKind::Field(ref e, _)
| ExprKind::AddrOf(BorrowKind::Ref, _, ref e)
| ExprKind::AddrOf(_, _, ref e)
| ExprKind::Struct(_, _, Some(ref e))
| ExprKind::Repeat(ref e, _)
| ExprKind::DropTemps(ref e) => never_loop_expr(e, main_loop_id),

View file

@ -4,7 +4,7 @@
use crate::utils::{get_attr, higher};
use rustc::hir;
use rustc::hir::intravisit::{NestedVisitorMap, Visitor};
use rustc::hir::{BindingAnnotation, Block, BorrowKind, Expr, ExprKind, Pat, PatKind, QPath, Stmt, StmtKind, TyKind};
use rustc::hir::{BindingAnnotation, Block, Expr, ExprKind, Pat, PatKind, QPath, Stmt, StmtKind, TyKind};
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
use rustc::session::Session;
use rustc::{declare_lint_pass, declare_tool_lint};
@ -425,11 +425,11 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
self.current = path_pat;
self.print_qpath(path);
},
ExprKind::AddrOf(BorrowKind::Ref, mutability, ref inner) => {
ExprKind::AddrOf(kind, mutability, ref inner) => {
let inner_pat = self.next("inner");
println!(
"AddrOf(BorrowKind::Ref, Mutability::{:?}, ref {}) = {};",
mutability, inner_pat, current
"AddrOf(BorrowKind::{:?}, Mutability::{:?}, ref {}) = {};",
kind, mutability, inner_pat, current
);
self.current = inner_pat;
self.visit_expr(inner);