Skip to content

Commit 1477f34

Browse files
author
Michael Wright
committed
Fixes compilation for rust nightly 2018-05-05
Closes #2725
1 parent 66165c6 commit 1477f34

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

clippy_lints/src/escape.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc::hir::intravisit as visit;
33
use rustc::hir::map::Node::{NodeExpr, NodeStmt};
44
use rustc::lint::*;
55
use rustc::middle::expr_use_visitor::*;
6-
use rustc::middle::mem_categorization::{cmt, Categorization};
6+
use rustc::middle::mem_categorization::{cmt_, Categorization};
77
use rustc::ty::{self, Ty};
88
use rustc::ty::layout::LayoutOf;
99
use rustc::util::nodemap::NodeSet;
@@ -86,16 +86,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
8686
}
8787

8888
impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
89-
fn consume(&mut self, _: NodeId, _: Span, cmt: cmt<'tcx>, mode: ConsumeMode) {
89+
fn consume(&mut self, _: NodeId, _: Span, cmt: &cmt_<'tcx>, mode: ConsumeMode) {
9090
if let Categorization::Local(lid) = cmt.cat {
9191
if let Move(DirectRefMove) = mode {
9292
// moved out or in. clearly can't be localized
9393
self.set.remove(&lid);
9494
}
9595
}
9696
}
97-
fn matched_pat(&mut self, _: &Pat, _: cmt<'tcx>, _: MatchMode) {}
98-
fn consume_pat(&mut self, consume_pat: &Pat, cmt: cmt<'tcx>, _: ConsumeMode) {
97+
fn matched_pat(&mut self, _: &Pat, _: &cmt_<'tcx>, _: MatchMode) {}
98+
fn consume_pat(&mut self, consume_pat: &Pat, cmt: &cmt_<'tcx>, _: ConsumeMode) {
9999
let map = &self.cx.tcx.hir;
100100
if map.is_argument(consume_pat.id) {
101101
// Skip closure arguments
@@ -135,7 +135,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
135135
}
136136
}
137137
}
138-
fn borrow(&mut self, _: NodeId, _: Span, cmt: cmt<'tcx>, _: ty::Region, _: ty::BorrowKind, loan_cause: LoanCause) {
138+
fn borrow(&mut self, _: NodeId, _: Span, cmt: &cmt_<'tcx>, _: ty::Region, _: ty::BorrowKind, loan_cause: LoanCause) {
139139
if let Categorization::Local(lid) = cmt.cat {
140140
match loan_cause {
141141
// x.foo()
@@ -157,7 +157,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
157157
}
158158
}
159159
fn decl_without_init(&mut self, _: NodeId, _: Span) {}
160-
fn mutate(&mut self, _: NodeId, _: Span, _: cmt<'tcx>, _: MutateMode) {}
160+
fn mutate(&mut self, _: NodeId, _: Span, _: &cmt_<'tcx>, _: MutateMode) {}
161161
}
162162

163163
impl<'a, 'tcx> EscapeDelegate<'a, 'tcx> {

clippy_lints/src/loops.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc::middle::region;
1010
// use rustc::middle::region::CodeExtent;
1111
use rustc::middle::expr_use_visitor::*;
1212
use rustc::middle::mem_categorization::Categorization;
13-
use rustc::middle::mem_categorization::cmt;
13+
use rustc::middle::mem_categorization::cmt_;
1414
use rustc::ty::{self, Ty};
1515
use rustc::ty::subst::Subst;
1616
use std::collections::{HashMap, HashSet};
@@ -1412,13 +1412,13 @@ struct MutatePairDelegate {
14121412
}
14131413

14141414
impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
1415-
fn consume(&mut self, _: NodeId, _: Span, _: cmt<'tcx>, _: ConsumeMode) {}
1415+
fn consume(&mut self, _: NodeId, _: Span, _: &cmt_<'tcx>, _: ConsumeMode) {}
14161416

1417-
fn matched_pat(&mut self, _: &Pat, _: cmt<'tcx>, _: MatchMode) {}
1417+
fn matched_pat(&mut self, _: &Pat, _: &cmt_<'tcx>, _: MatchMode) {}
14181418

1419-
fn consume_pat(&mut self, _: &Pat, _: cmt<'tcx>, _: ConsumeMode) {}
1419+
fn consume_pat(&mut self, _: &Pat, _: &cmt_<'tcx>, _: ConsumeMode) {}
14201420

1421-
fn borrow(&mut self, _: NodeId, sp: Span, cmt: cmt<'tcx>, _: ty::Region, bk: ty::BorrowKind, _: LoanCause) {
1421+
fn borrow(&mut self, _: NodeId, sp: Span, cmt: &cmt_<'tcx>, _: ty::Region, bk: ty::BorrowKind, _: LoanCause) {
14221422
if let ty::BorrowKind::MutBorrow = bk {
14231423
if let Categorization::Local(id) = cmt.cat {
14241424
if Some(id) == self.node_id_low {
@@ -1431,7 +1431,7 @@ impl<'tcx> Delegate<'tcx> for MutatePairDelegate {
14311431
}
14321432
}
14331433

1434-
fn mutate(&mut self, _: NodeId, sp: Span, cmt: cmt<'tcx>, _: MutateMode) {
1434+
fn mutate(&mut self, _: NodeId, sp: Span, cmt: &cmt_<'tcx>, _: MutateMode) {
14351435
if let Categorization::Local(id) = cmt.cat {
14361436
if Some(id) == self.node_id_low {
14371437
self.span_low = Some(sp)
@@ -2255,19 +2255,19 @@ impl<'tcx> MutVarsDelegate {
22552255

22562256

22572257
impl<'tcx> Delegate<'tcx> for MutVarsDelegate {
2258-
fn consume(&mut self, _: NodeId, _: Span, _: cmt<'tcx>, _: ConsumeMode) {}
2258+
fn consume(&mut self, _: NodeId, _: Span, _: &cmt_<'tcx>, _: ConsumeMode) {}
22592259

2260-
fn matched_pat(&mut self, _: &Pat, _: cmt<'tcx>, _: MatchMode) {}
2260+
fn matched_pat(&mut self, _: &Pat, _: &cmt_<'tcx>, _: MatchMode) {}
22612261

2262-
fn consume_pat(&mut self, _: &Pat, _: cmt<'tcx>, _: ConsumeMode) {}
2262+
fn consume_pat(&mut self, _: &Pat, _: &cmt_<'tcx>, _: ConsumeMode) {}
22632263

2264-
fn borrow(&mut self, _: NodeId, _: Span, cmt: cmt<'tcx>, _: ty::Region, bk: ty::BorrowKind, _: LoanCause) {
2264+
fn borrow(&mut self, _: NodeId, _: Span, cmt: &cmt_<'tcx>, _: ty::Region, bk: ty::BorrowKind, _: LoanCause) {
22652265
if let ty::BorrowKind::MutBorrow = bk {
22662266
self.update(&cmt.cat)
22672267
}
22682268
}
22692269

2270-
fn mutate(&mut self, _: NodeId, _: Span, cmt: cmt<'tcx>, _: MutateMode) {
2270+
fn mutate(&mut self, _: NodeId, _: Span, cmt: &cmt_<'tcx>, _: MutateMode) {
22712271
self.update(&cmt.cat)
22722272
}
22732273

clippy_lints/src/needless_pass_by_value.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,15 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
308308
}
309309
}
310310

311-
fn move_common(&mut self, _consume_id: NodeId, _span: Span, cmt: mc::cmt<'tcx>) {
311+
fn move_common(&mut self, _consume_id: NodeId, _span: Span, cmt: &mc::cmt_<'tcx>) {
312312
let cmt = unwrap_downcast_or_interior(cmt);
313313

314314
if let mc::Categorization::Local(vid) = cmt.cat {
315315
self.moved_vars.insert(vid);
316316
}
317317
}
318318

319-
fn non_moving_pat(&mut self, matched_pat: &Pat, cmt: mc::cmt<'tcx>) {
319+
fn non_moving_pat(&mut self, matched_pat: &Pat, cmt: &mc::cmt_<'tcx>) {
320320
let cmt = unwrap_downcast_or_interior(cmt);
321321

322322
if let mc::Categorization::Local(vid) = cmt.cat {
@@ -367,41 +367,41 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
367367
}
368368

369369
impl<'a, 'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt<'a, 'tcx> {
370-
fn consume(&mut self, consume_id: NodeId, consume_span: Span, cmt: mc::cmt<'tcx>, mode: euv::ConsumeMode) {
370+
fn consume(&mut self, consume_id: NodeId, consume_span: Span, cmt: &mc::cmt_<'tcx>, mode: euv::ConsumeMode) {
371371
if let euv::ConsumeMode::Move(_) = mode {
372372
self.move_common(consume_id, consume_span, cmt);
373373
}
374374
}
375375

376-
fn matched_pat(&mut self, matched_pat: &Pat, cmt: mc::cmt<'tcx>, mode: euv::MatchMode) {
376+
fn matched_pat(&mut self, matched_pat: &Pat, cmt: &mc::cmt_<'tcx>, mode: euv::MatchMode) {
377377
if let euv::MatchMode::MovingMatch = mode {
378378
self.move_common(matched_pat.id, matched_pat.span, cmt);
379379
} else {
380380
self.non_moving_pat(matched_pat, cmt);
381381
}
382382
}
383383

384-
fn consume_pat(&mut self, consume_pat: &Pat, cmt: mc::cmt<'tcx>, mode: euv::ConsumeMode) {
384+
fn consume_pat(&mut self, consume_pat: &Pat, cmt: &mc::cmt_<'tcx>, mode: euv::ConsumeMode) {
385385
if let euv::ConsumeMode::Move(_) = mode {
386386
self.move_common(consume_pat.id, consume_pat.span, cmt);
387387
}
388388
}
389389

390-
fn borrow(&mut self, _: NodeId, _: Span, _: mc::cmt<'tcx>, _: ty::Region, _: ty::BorrowKind, _: euv::LoanCause) {}
390+
fn borrow(&mut self, _: NodeId, _: Span, _: &mc::cmt_<'tcx>, _: ty::Region, _: ty::BorrowKind, _: euv::LoanCause) {}
391391

392-
fn mutate(&mut self, _: NodeId, _: Span, _: mc::cmt<'tcx>, _: euv::MutateMode) {}
392+
fn mutate(&mut self, _: NodeId, _: Span, _: &mc::cmt_<'tcx>, _: euv::MutateMode) {}
393393

394394
fn decl_without_init(&mut self, _: NodeId, _: Span) {}
395395
}
396396

397397

398-
fn unwrap_downcast_or_interior(mut cmt: mc::cmt) -> mc::cmt {
398+
fn unwrap_downcast_or_interior<'a, 'tcx>(mut cmt: &'a mc::cmt_<'tcx>) -> mc::cmt_<'tcx> {
399399
loop {
400-
match cmt.cat.clone() {
401-
mc::Categorization::Downcast(c, _) | mc::Categorization::Interior(c, _) => {
400+
match cmt.cat {
401+
mc::Categorization::Downcast(ref c, _) | mc::Categorization::Interior(ref c, _) => {
402402
cmt = c;
403403
},
404-
_ => return cmt,
404+
_ => return (*cmt).clone(),
405405
}
406-
}
406+
};
407407
}

0 commit comments

Comments
 (0)