diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index a883ae40dbf4..a8ebe85e2510 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, - 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 ) -> 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 14cafdef67d7..aa6c152a37ff 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 c5ad2b18c23f..32088ff9f61e 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 cc7532527588..ec2555886ce1 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 8cbf68c476a7..5008627972aa 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 f6a22cf04079..ec3c0bf68ad8 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() diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index b65f2ba2601e..4b8b3232bfa3 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -440,7 +440,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> let span = ecx.frame().span; ecx.machine.loop_detector.observe_and_analyze( - &ecx.tcx, + *ecx.tcx, span, &ecx.memory, &ecx.stack[..], @@ -513,7 +513,7 @@ pub fn error_to_const_error<'a, 'mir, 'tcx>( } fn validate_and_turn_into_const<'a, 'tcx>( - tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'a, 'tcx, 'tcx>, constant: RawConst<'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 8810be9326bf..6d619793160f 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -1,4 +1,4 @@ -use rustc::ty::{self, TyCtxt}; +use rustc::ty::{Ty, TyCtxt}; use rustc::mir::*; use rustc::util::nodemap::FxHashMap; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; @@ -285,10 +285,10 @@ pub(crate) enum IllegalMoveOriginKind<'tcx> { /// implements `Drop`. Rust maintains invariant that all `Drop` /// ADT's remain fully-initialized so that user-defined destructor /// can safely read from all of the ADT's fields. - InteriorOfTypeWithDestructor { container_ty: ty::Ty<'tcx> }, + InteriorOfTypeWithDestructor { container_ty: Ty<'tcx> }, /// Illegal move due to attempt to move out of a slice or array. - InteriorOfSliceOrArray { ty: ty::Ty<'tcx>, is_index: bool, }, + InteriorOfSliceOrArray { ty: Ty<'tcx>, is_index: bool, }, } #[derive(Debug)] diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 0bb8b1d9d02c..83bd3666b3d3 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -47,7 +47,7 @@ impl<'a, 'mir, 'tcx> InfiniteLoopDetector<'a, 'mir, 'tcx> { pub fn observe_and_analyze<'b>( &mut self, - tcx: &TyCtxt<'b, 'tcx, 'tcx>, + tcx: TyCtxt<'b, 'tcx, 'tcx>, span: Span, memory: &Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>, stack: &[Frame<'mir, 'tcx>], diff --git a/src/librustc_mir/interpret/traits.rs b/src/librustc_mir/interpret/traits.rs index 0bed62ccf500..4eb79cf56fcf 100644 --- a/src/librustc_mir/interpret/traits.rs +++ b/src/librustc_mir/interpret/traits.rs @@ -101,7 +101,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M> pub fn read_drop_type_from_vtable( &self, vtable: Pointer, - ) -> EvalResult<'tcx, (ty::Instance<'tcx>, ty::Ty<'tcx>)> { + ) -> EvalResult<'tcx, (ty::Instance<'tcx>, Ty<'tcx>)> { // we don't care about the pointee type, we just want a pointer self.memory.check_align(vtable.into(), self.tcx.data_layout.pointer_align.abi)?; let drop_fn = self.memory diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index a3708d064ec3..ea139e6e9fc5 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -644,7 +644,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { fn tuple_like_shim(&mut self, dest: Place<'tcx>, src: Place<'tcx>, tys: I) - where I: Iterator> { + where I: Iterator> { let mut previous_field = None; for (i, ity) in tys.enumerate() { let field = Field::new(i); diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index b5bdc9e1c8c6..1e0ba9023317 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -8,7 +8,7 @@ use rustc::mir::{NullOp, UnOp, StatementKind, Statement, BasicBlock, LocalKind, use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp, ProjectionElem}; use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUseContext}; use rustc::mir::interpret::{InterpError, Scalar, GlobalId, EvalResult}; -use rustc::ty::{TyCtxt, self, Instance}; +use rustc::ty::{self, Instance, Ty, TyCtxt}; use syntax::source_map::{Span, DUMMY_SP}; use rustc::ty::subst::InternalSubsts; use rustc_data_structures::indexed_vec::IndexVec; @@ -80,10 +80,10 @@ struct ConstPropagator<'a, 'mir, 'tcx:'a+'mir> { } impl<'a, 'b, 'tcx> LayoutOf for ConstPropagator<'a, 'b, 'tcx> { - type Ty = ty::Ty<'tcx>; + type Ty = Ty<'tcx>; type TyLayout = Result, LayoutError<'tcx>>; - fn layout_of(&self, ty: ty::Ty<'tcx>) -> Self::TyLayout { + fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout { self.tcx.layout_of(self.param_env.and(ty)) } } @@ -476,7 +476,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { fn type_size_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, - ty: ty::Ty<'tcx>) -> Option { + ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) } @@ -555,7 +555,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { ) { trace!("visit_statement: {:?}", statement); if let StatementKind::Assign(ref place, ref rval) = statement.kind { - let place_ty: ty::Ty<'tcx> = place + let place_ty: Ty<'tcx> = place .ty(&self.mir.local_decls, self.tcx) .ty; if let Ok(place_layout) = self.tcx.layout_of(self.param_env.and(place_ty)) { diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index d5f04ca64e4c..e1d41ba4fc50 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -1,7 +1,7 @@ use rustc::hir::def_id::DefId; use rustc::hir; use rustc::mir::*; -use rustc::ty::{self, Predicate, TyCtxt, adjustment::{PointerCast}}; +use rustc::ty::{self, Predicate, Ty, TyCtxt, adjustment::{PointerCast}}; use rustc_target::spec::abi; use std::borrow::Cow; use syntax_pos::Span; @@ -81,7 +81,7 @@ pub fn is_min_const_fn( fn check_ty( tcx: TyCtxt<'a, 'tcx, 'tcx>, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, span: Span, fn_def_id: DefId, ) -> McfResult { diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index e334e27cc855..bf3cdf4abf79 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -1,5 +1,5 @@ use rustc::session::config::BorrowckMode; -use rustc::ty::{self, TyCtxt}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc_errors::{DiagnosticBuilder, DiagnosticId}; use syntax_pos::{MultiSpan, Span}; @@ -437,7 +437,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { fn cannot_move_out_of_interior_noncopy( self, move_from_span: Span, - ty: ty::Ty<'_>, + ty: Ty<'_>, is_index: Option, o: Origin, ) -> DiagnosticBuilder<'cx> { @@ -464,7 +464,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { fn cannot_move_out_of_interior_of_drop( self, move_from_span: Span, - container_ty: ty::Ty<'_>, + container_ty: Ty<'_>, o: Origin, ) -> DiagnosticBuilder<'cx> { let mut err = struct_span_err!( diff --git a/src/librustc_mir/util/mod.rs b/src/librustc_mir/util/mod.rs index 1a5a2a92247d..0e7f473a3e70 100644 --- a/src/librustc_mir/util/mod.rs +++ b/src/librustc_mir/util/mod.rs @@ -1,5 +1,5 @@ use core::unicode::property::Pattern_White_Space; -use rustc::ty; +use rustc::ty::TyCtxt; use syntax_pos::Span; pub mod borrowck_errors; @@ -20,7 +20,7 @@ pub use self::graphviz::write_node_label as write_graphviz_node_label; /// If possible, suggest replacing `ref` with `ref mut`. pub fn suggest_ref_mut<'cx, 'gcx, 'tcx>( - tcx: ty::TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'cx, 'gcx, 'tcx>, binding_span: Span, ) -> Option<(String)> { let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap();