diff options
| author | flip1995 <hello@philkrones.com> | 2019-04-26 14:26:49 +0200 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2019-04-28 21:19:27 +0200 |
| commit | e1da67e69cec2d188ea663097a765d501582837e (patch) | |
| tree | fac663e20ec7c853221e172d9a5edcf68e77919b /src/librustc_mir/borrow_check | |
| parent | 654d045b6fbf6cab587437f8985fbf7d74c5134c (diff) | |
| download | rust-e1da67e69cec2d188ea663097a765d501582837e.tar.gz rust-e1da67e69cec2d188ea663097a765d501582837e.zip | |
Fix lint findings in librustc_mir
Diffstat (limited to 'src/librustc_mir/borrow_check')
| -rw-r--r-- | src/librustc_mir/borrow_check/error_reporting.rs | 22 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/mutability_errors.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/nll/constraint_generation.rs | 4 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/nll/invalidation.rs | 4 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/path_utils.rs | 2 |
6 files changed, 21 insertions, 21 deletions
diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index a883ae40dbf..a8ebe85e251 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -12,7 +12,7 @@ use rustc::mir::{ Place, PlaceBase, PlaceProjection, ProjectionElem, Rvalue, Statement, StatementKind, Static, StaticKind, TerminatorKind, VarBindingForm, }; -use rustc::ty::{self, DefIdTree}; +use rustc::ty::{self, DefIdTree, Ty}; use rustc::ty::layout::VariantIdx; use rustc::ty::print::Print; use rustc_data_structures::fx::FxHashSet; @@ -918,7 +918,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { borrow: &BorrowData<'tcx>, (place, drop_span): (&Place<'tcx>, Span), kind: Option<WriteKind>, - dropped_ty: ty::Ty<'tcx>, + dropped_ty: Ty<'tcx>, ) { debug!( "report_borrow_conflicts_with_destructor(\ @@ -1483,7 +1483,7 @@ pub(super) struct IncludingDowncast(bool); enum StorageDeadOrDrop<'tcx> { LocalStorageDead, BoxedStorageDead, - Destructor(ty::Ty<'tcx>), + Destructor(Ty<'tcx>), } impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { @@ -1787,7 +1787,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// End-user visible description of the `field_index`nth field of `ty` fn describe_field_from_ty( &self, - ty: &ty::Ty<'_>, + ty: Ty<'_>, field: Field, variant_index: Option<VariantIdx> ) -> String { @@ -2258,18 +2258,18 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { #[derive(Debug)] enum AnnotatedBorrowFnSignature<'tcx> { NamedFunction { - arguments: Vec<(ty::Ty<'tcx>, Span)>, - return_ty: ty::Ty<'tcx>, + arguments: Vec<(Ty<'tcx>, Span)>, + return_ty: Ty<'tcx>, return_span: Span, }, AnonymousFunction { - argument_ty: ty::Ty<'tcx>, + argument_ty: Ty<'tcx>, argument_span: Span, - return_ty: ty::Ty<'tcx>, + return_ty: Ty<'tcx>, return_span: Span, }, Closure { - argument_ty: ty::Ty<'tcx>, + argument_ty: Ty<'tcx>, argument_span: Span, }, } @@ -2355,7 +2355,7 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> { impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// Return the name of the provided `Ty` (that must be a reference) with a synthesized lifetime /// name where required. - fn get_name_for_ty(&self, ty: ty::Ty<'tcx>, counter: usize) -> String { + fn get_name_for_ty(&self, ty: Ty<'tcx>, counter: usize) -> String { let mut s = String::new(); let mut printer = ty::print::FmtPrinter::new(self.infcx.tcx, &mut s, Namespace::TypeNS); @@ -2378,7 +2378,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// Returns the name of the provided `Ty` (that must be a reference)'s region with a /// synthesized lifetime name where required. - fn get_region_name_for_ty(&self, ty: ty::Ty<'tcx>, counter: usize) -> String { + fn get_region_name_for_ty(&self, ty: Ty<'tcx>, counter: usize) -> String { let mut s = String::new(); let mut printer = ty::print::FmtPrinter::new(self.infcx.tcx, &mut s, Namespace::TypeNS); diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 14cafdef67d..aa6c152a37f 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1076,7 +1076,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { (Read(kind), BorrowKind::Unique) | (Read(kind), BorrowKind::Mut { .. }) => { // Reading from mere reservations of mutable-borrows is OK. if !is_active(&this.dominators, borrow, context.loc) { - assert!(allow_two_phase_borrow(&tcx, borrow.kind)); + assert!(allow_two_phase_borrow(tcx, borrow.kind)); return Control::Continue; } @@ -1233,7 +1233,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { BorrowKind::Shared => (Deep, Read(ReadKind::Borrow(bk))), BorrowKind::Unique | BorrowKind::Mut { .. } => { let wk = WriteKind::MutableBorrow(bk); - if allow_two_phase_borrow(&self.infcx.tcx, bk) { + if allow_two_phase_borrow(self.infcx.tcx, bk) { (Deep, Reservation(wk)) } else { (Deep, Write(wk)) diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index c5ad2b18c23..32088ff9f61 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -5,7 +5,7 @@ use rustc::mir::{ Mutability, Operand, Place, PlaceBase, Projection, ProjectionElem, Static, StaticKind, }; use rustc::mir::{Terminator, TerminatorKind}; -use rustc::ty::{self, Const, DefIdTree, TyS, TyCtxt}; +use rustc::ty::{self, Const, DefIdTree, Ty, TyS, TyCtxt}; use rustc_data_structures::indexed_vec::Idx; use syntax_pos::Span; use syntax_pos::symbol::keywords; @@ -613,7 +613,7 @@ fn suggest_ampmut<'cx, 'gcx, 'tcx>( }) } -fn is_closure_or_generator(ty: ty::Ty<'_>) -> bool { +fn is_closure_or_generator(ty: Ty<'_>) -> bool { ty.is_closure() || ty.is_generator() } @@ -626,7 +626,7 @@ fn is_closure_or_generator(ty: ty::Ty<'_>) -> bool { /// ``` fn annotate_struct_field( tcx: TyCtxt<'cx, 'gcx, 'tcx>, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, field: &mir::Field, ) -> Option<(Span, String)> { // Expect our local to be a reference to a struct of some kind. diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/nll/constraint_generation.rs index cc753252758..ec2555886ce 100644 --- a/src/librustc_mir/borrow_check/nll/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/nll/constraint_generation.rs @@ -10,7 +10,7 @@ use rustc::mir::{BasicBlock, BasicBlockData, Location, Mir, Place, PlaceBase, Rv use rustc::mir::{SourceInfo, Statement, Terminator}; use rustc::mir::UserTypeProjection; use rustc::ty::fold::TypeFoldable; -use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid}; +use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid, Ty}; use rustc::ty::subst::SubstsRef; pub(super) fn generate_constraints<'cx, 'gcx, 'tcx>( @@ -64,7 +64,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx /// We sometimes have `ty` within an rvalue, or within a /// call. Make them live at the location where they appear. - fn visit_ty(&mut self, ty: ty::Ty<'tcx>, ty_context: TyContext) { + fn visit_ty(&mut self, ty: Ty<'tcx>, ty_context: TyContext) { match ty_context { TyContext::ReturnTy(SourceInfo { span, .. }) | TyContext::YieldTy(SourceInfo { span, .. }) diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 8cbf68c476a..5008627972a 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -321,7 +321,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> { BorrowKind::Shared => (Deep, Read(ReadKind::Borrow(bk))), BorrowKind::Unique | BorrowKind::Mut { .. } => { let wk = WriteKind::MutableBorrow(bk); - if allow_two_phase_borrow(&self.tcx, bk) { + if allow_two_phase_borrow(self.tcx, bk) { (Deep, Reservation(wk)) } else { (Deep, Write(wk)) @@ -439,7 +439,7 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> { // Reading from mere reservations of mutable-borrows is OK. if !is_active(&this.dominators, borrow, context.loc) { // If the borrow isn't active yet, reads don't invalidate it - assert!(allow_two_phase_borrow(&this.tcx, borrow.kind)); + assert!(allow_two_phase_borrow(this.tcx, borrow.kind)); return Control::Continue; } diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index f6a22cf0407..ec3c0bf68ad 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -12,7 +12,7 @@ use rustc_data_structures::graph::dominators::Dominators; /// allowed to be split into separate Reservation and /// Activation phases. pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>( - _tcx: &TyCtxt<'a, 'gcx, 'tcx>, + _tcx: TyCtxt<'a, 'gcx, 'tcx>, kind: BorrowKind ) -> bool { kind.allows_two_phase_borrow() |
