Skip to content

Commit

Permalink
bring Ty into scope
Browse files Browse the repository at this point in the history
  • Loading branch information
qmx committed Sep 15, 2017
1 parent 2bde694 commit 3fe4612
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 59 deletions.
10 changes: 5 additions & 5 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ use hir::map as hir_map;
use hir::def_id::DefId;
use middle::region;
use traits::{ObligationCause, ObligationCauseCode};
use ty::{self, Region, TyCtxt, TypeFoldable};
use ty::{self, Region, Ty, TyCtxt, TypeFoldable};
use ty::error::TypeError;
use syntax::ast::DUMMY_NODE_ID;
use syntax_pos::{Pos, Span};
Expand Down Expand Up @@ -418,7 +418,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
name: String,
sub: &ty::subst::Substs<'tcx>,
pos: usize,
other_ty: &ty::Ty<'tcx>) {
other_ty: &Ty<'tcx>) {
// `value` and `other_value` hold two incomplete type representation for display.
// `name` is the path of both types being compared. `sub`
value.push_highlighted(name);
Expand Down Expand Up @@ -491,7 +491,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
path: String,
sub: &ty::subst::Substs<'tcx>,
other_path: String,
other_ty: &ty::Ty<'tcx>) -> Option<()> {
other_ty: &Ty<'tcx>) -> Option<()> {
for (i, ta) in sub.types().enumerate() {
if &ta == other_ty {
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
Expand Down Expand Up @@ -522,7 +522,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {

/// Compare two given types, eliding parts that are the same between them and highlighting
/// relevant differences, and return two representation of those types for highlighted printing.
fn cmp(&self, t1: ty::Ty<'tcx>, t2: ty::Ty<'tcx>)
fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>)
-> (DiagnosticStyledString, DiagnosticStyledString)
{
match (&t1.sty, &t2.sty) {
Expand Down Expand Up @@ -743,7 +743,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}

fn expected_found_str_ty(&self,
exp_found: &ty::error::ExpectedFound<ty::Ty<'tcx>>)
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>)
-> Option<(DiagnosticStyledString, DiagnosticStyledString)> {
let exp_found = self.resolve_type_vars_if_possible(exp_found);
if exp_found.references_error() {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/error_reporting/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! anonymous regions.
use hir;
use infer::InferCtxt;
use ty::{self, Region};
use ty::{self, Region, Ty};
use hir::def_id::DefId;
use hir::map as hir_map;

Expand All @@ -35,7 +35,7 @@ pub struct AnonymousArgInfo<'tcx> {
// the argument corresponding to the anonymous region
pub arg: &'tcx hir::Arg,
// the type corresponding to the anonymopus region argument
pub arg_ty: ty::Ty<'tcx>,
pub arg_ty: Ty<'tcx>,
// the ty::BoundRegion corresponding to the anonymous region
pub bound_region: ty::BoundRegion,
// corresponds to id the argument is the first parameter
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
}
}

pub fn unsolved_variables(&self) -> Vec<ty::Ty<'tcx>> {
pub fn unsolved_variables(&self) -> Vec<Ty<'tcx>> {
let mut variables = Vec::new();

let unbound_ty_vars = self.type_variables
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ pub struct VtableObjectData<'tcx, N> {

#[derive(Clone, PartialEq, Eq)]
pub struct VtableFnPointerData<'tcx, N> {
pub fn_ty: ty::Ty<'tcx>,
pub fn_ty: Ty<'tcx>,
pub nested: Vec<N>
}

Expand Down
8 changes: 4 additions & 4 deletions src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use rustc::middle::mem_categorization::Categorization;
use rustc::middle::mem_categorization::ImmutabilityBlame;
use rustc::middle::region;
use rustc::middle::free_region::RegionRelations;
use rustc::ty::{self, TyCtxt};
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::maps::Providers;
use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin};

Expand Down Expand Up @@ -275,7 +275,7 @@ impl<'tcx> Loan<'tcx> {
#[derive(Eq)]
pub struct LoanPath<'tcx> {
kind: LoanPathKind<'tcx>,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
}

impl<'tcx> PartialEq for LoanPath<'tcx> {
Expand All @@ -299,11 +299,11 @@ pub enum LoanPathKind<'tcx> {
}

impl<'tcx> LoanPath<'tcx> {
fn new(kind: LoanPathKind<'tcx>, ty: ty::Ty<'tcx>) -> LoanPath<'tcx> {
fn new(kind: LoanPathKind<'tcx>, ty: Ty<'tcx>) -> LoanPath<'tcx> {
LoanPath { kind: kind, ty: ty }
}

fn to_type(&self) -> ty::Ty<'tcx> { self.ty }
fn to_type(&self) -> Ty<'tcx> { self.ty }
}

// FIXME (pnkfelix): See discussion here
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/build/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use hair::*;
use rustc_const_math::{ConstInt, ConstIsize};
use rustc::middle::const_val::ConstVal;
use rustc::middle::region;
use rustc::ty;
use rustc::ty::{self, Ty};
use rustc::mir::*;
use syntax::ast;
use syntax_pos::Span;
Expand Down Expand Up @@ -291,7 +291,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
}

pub fn build_binary_op(&mut self, mut block: BasicBlock,
op: BinOp, span: Span, ty: ty::Ty<'tcx>,
op: BinOp, span: Span, ty: Ty<'tcx>,
lhs: Operand<'tcx>, rhs: Operand<'tcx>) -> BlockAnd<Rvalue<'tcx>> {
let source_info = self.source_info(span);
let bool_ty = self.hir.bool_ty();
Expand Down Expand Up @@ -378,7 +378,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
}

// Helper to get a `-1` value of the appropriate type
fn neg_1_literal(&mut self, span: Span, ty: ty::Ty<'tcx>) -> Operand<'tcx> {
fn neg_1_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> {
let literal = match ty.sty {
ty::TyInt(ity) => {
let val = match ity {
Expand Down Expand Up @@ -410,7 +410,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
}

// Helper to get the minimum value of the appropriate type
fn minval_literal(&mut self, span: Span, ty: ty::Ty<'tcx>) -> Operand<'tcx> {
fn minval_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> {
let literal = match ty.sty {
ty::TyInt(ity) => {
let val = match ity {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/hair/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc::mir::{BinOp, BorrowKind, Field, Literal, UnOp};
use rustc::hir::def_id::DefId;
use rustc::middle::region;
use rustc::ty::subst::Substs;
use rustc::ty::{self, AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior};
use rustc::ty::{AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior};
use rustc::hir;
use syntax::ast;
use syntax_pos::Span;
Expand Down Expand Up @@ -117,7 +117,7 @@ pub enum ExprKind<'tcx> {
value: ExprRef<'tcx>,
},
Call {
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
fun: ExprRef<'tcx>,
args: Vec<ExprRef<'tcx>>,
},
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_mir/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
/// Build a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`.
fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,
self_ty: ty::Ty<'tcx>)
self_ty: Ty<'tcx>)
-> Mir<'tcx>
{
debug!("build_clone_shim(def_id={:?})", def_id);
Expand Down Expand Up @@ -382,7 +382,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
self.block(vec![ret_statement], TerminatorKind::Return, false);
}

fn make_lvalue(&mut self, mutability: Mutability, ty: ty::Ty<'tcx>) -> Lvalue<'tcx> {
fn make_lvalue(&mut self, mutability: Mutability, ty: Ty<'tcx>) -> Lvalue<'tcx> {
let span = self.span;
Lvalue::Local(
self.local_decls.push(temp_decl(mutability, ty, span))
Expand All @@ -391,7 +391,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {

fn make_clone_call(
&mut self,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
rcvr_field: Lvalue<'tcx>,
next: BasicBlock,
cleanup: BasicBlock
Expand Down Expand Up @@ -487,7 +487,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
}
}

fn array_shim(&mut self, ty: ty::Ty<'tcx>, len: u64) {
fn array_shim(&mut self, ty: Ty<'tcx>, len: u64) {
let tcx = self.tcx;
let span = self.span;
let rcvr = Lvalue::Local(Local::new(1+0)).deref();
Expand Down Expand Up @@ -613,7 +613,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
self.block(vec![], TerminatorKind::Resume, true);
}

fn tuple_shim(&mut self, tys: &ty::Slice<ty::Ty<'tcx>>) {
fn tuple_shim(&mut self, tys: &ty::Slice<Ty<'tcx>>) {
let rcvr = Lvalue::Local(Local::new(1+0)).deref();

let mut returns = Vec::new();
Expand Down
18 changes: 9 additions & 9 deletions src/librustc_trans/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ use rustc::middle::const_val::ConstVal;
use rustc::middle::lang_items::{ExchangeMallocFnLangItem};
use rustc::traits;
use rustc::ty::subst::Substs;
use rustc::ty::{self, TypeFoldable, TyCtxt};
use rustc::ty::{self, TypeFoldable, Ty, TyCtxt};
use rustc::ty::adjustment::CustomCoerceUnsized;
use rustc::mir::{self, Location};
use rustc::mir::visit::Visitor as MirVisitor;
Expand Down Expand Up @@ -648,7 +648,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
}

fn visit_drop_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
is_direct_call: bool,
output: &mut Vec<TransItem<'tcx>>)
{
Expand All @@ -657,7 +657,7 @@ fn visit_drop_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
}

fn visit_fn_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
is_direct_call: bool,
output: &mut Vec<TransItem<'tcx>>)
{
Expand Down Expand Up @@ -776,10 +776,10 @@ fn should_trans_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instan
/// Finally, there is also the case of custom unsizing coercions, e.g. for
/// smart pointers such as `Rc` and `Arc`.
fn find_vtable_types_for_unsizing<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
source_ty: ty::Ty<'tcx>,
target_ty: ty::Ty<'tcx>)
-> (ty::Ty<'tcx>, ty::Ty<'tcx>) {
let ptr_vtable = |inner_source: ty::Ty<'tcx>, inner_target: ty::Ty<'tcx>| {
source_ty: Ty<'tcx>,
target_ty: Ty<'tcx>)
-> (Ty<'tcx>, Ty<'tcx>) {
let ptr_vtable = |inner_source: Ty<'tcx>, inner_target: Ty<'tcx>| {
if !scx.type_is_sized(inner_source) {
(inner_source, inner_target)
} else {
Expand Down Expand Up @@ -836,8 +836,8 @@ fn create_fn_trans_item<'a, 'tcx>(instance: Instance<'tcx>) -> TransItem<'tcx> {
/// Creates a `TransItem` for each method that is referenced by the vtable for
/// the given trait/impl pair.
fn create_trans_items_for_vtable_methods<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
trait_ty: ty::Ty<'tcx>,
impl_ty: ty::Ty<'tcx>,
trait_ty: Ty<'tcx>,
impl_ty: Ty<'tcx>,
output: &mut Vec<TransItem<'tcx>>) {
assert!(!trait_ty.needs_subst() && !trait_ty.has_escaping_regions() &&
!impl_ty.needs_subst() && !impl_ty.has_escaping_regions());
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_trans/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub struct LocalCrateContext<'a, 'tcx: 'a> {
/// Cache instances of monomorphic and polymorphic items
instances: RefCell<FxHashMap<Instance<'tcx>, ValueRef>>,
/// Cache generated vtables
vtables: RefCell<FxHashMap<(ty::Ty<'tcx>,
vtables: RefCell<FxHashMap<(Ty<'tcx>,
Option<ty::PolyExistentialTraitRef<'tcx>>), ValueRef>>,
/// Cache of constant strings,
const_cstr_cache: RefCell<FxHashMap<InternedString, ValueRef>>,
Expand Down Expand Up @@ -512,7 +512,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
}

pub fn vtables<'a>(&'a self)
-> &'a RefCell<FxHashMap<(ty::Ty<'tcx>,
-> &'a RefCell<FxHashMap<(Ty<'tcx>,
Option<ty::PolyExistentialTraitRef<'tcx>>), ValueRef>> {
&self.local().vtables
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_trans/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

use llvm::{self, ValueRef};
use llvm::AttributePlace::Function;
use rustc::ty;
use rustc::ty::Ty;
use rustc::session::config::Sanitizer;
use abi::{Abi, FnType};
use attributes;
Expand Down Expand Up @@ -119,7 +119,7 @@ pub fn declare_cfn(ccx: &CrateContext, name: &str, fn_type: Type) -> ValueRef {
/// If there’s a value with the same name already declared, the function will
/// update the declaration and return existing ValueRef instead.
pub fn declare_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
fn_type: ty::Ty<'tcx>) -> ValueRef {
fn_type: Ty<'tcx>) -> ValueRef {
debug!("declare_rust_fn(name={:?}, fn_type={:?})", name, fn_type);
let sig = common::ty_fn_sig(ccx, fn_type);
let sig = ccx.tcx().erase_late_bound_regions_and_normalize(&sig);
Expand Down Expand Up @@ -164,7 +164,7 @@ pub fn define_global(ccx: &CrateContext, name: &str, ty: Type) -> Option<ValueRe
/// can happen with #[no_mangle] or #[export_name], for example.
pub fn define_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
name: &str,
fn_type: ty::Ty<'tcx>) -> ValueRef {
fn_type: Ty<'tcx>) -> ValueRef {
if get_defined_value(ccx, name).is_some() {
ccx.sess().fatal(&format!("symbol `{}` already defined", name))
} else {
Expand All @@ -179,7 +179,7 @@ pub fn define_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
/// can happen with #[no_mangle] or #[export_name], for example.
pub fn define_internal_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
name: &str,
fn_type: ty::Ty<'tcx>) -> ValueRef {
fn_type: Ty<'tcx>) -> ValueRef {
let llfn = define_fn(ccx, name, fn_type);
unsafe { llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::InternalLinkage) };
llfn
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_trans/meth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use machine;
use monomorphize;
use type_::Type;
use value::Value;
use rustc::ty;
use rustc::ty::{self, Ty};

#[derive(Copy, Clone, Debug)]
pub struct VirtualIndex(usize);
Expand Down Expand Up @@ -63,7 +63,7 @@ impl<'a, 'tcx> VirtualIndex {
/// making an object `Foo<Trait>` from a value of type `Foo<T>`, then
/// `trait_ref` would map `T:Trait`.
pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>)
-> ValueRef
{
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_trans/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use llvm::{self, ValueRef, BasicBlockRef};
use rustc::middle::lang_items;
use rustc::middle::const_val::{ConstEvalErr, ConstInt, ErrKind};
use rustc::ty::{self, TypeFoldable};
use rustc::ty::{self, Ty, TypeFoldable};
use rustc::ty::layout::{self, LayoutTyper};
use rustc::mir;
use abi::{Abi, FnType, ArgType};
Expand Down Expand Up @@ -119,7 +119,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {
fn_ty: FnType<'tcx>,
fn_ptr: ValueRef,
llargs: &[ValueRef],
destination: Option<(ReturnDest, ty::Ty<'tcx>, mir::BasicBlock)>,
destination: Option<(ReturnDest, Ty<'tcx>, mir::BasicBlock)>,
cleanup: Option<mir::BasicBlock>
| {
if let Some(cleanup) = cleanup {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/dropck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>(
///
pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>(
rcx: &mut RegionCtxt<'a, 'gcx, 'tcx>,
ty: ty::Ty<'tcx>,
ty: Ty<'tcx>,
span: Span,
scope: region::Scope)
-> Result<(), ErrorReported>
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ fn match_intrinsic_type_to_type<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
position: &str,
span: Span,
structural_to_nominal: &mut FxHashMap<&'a intrinsics::Type, ty::Ty<'tcx>>,
expected: &'a intrinsics::Type, t: ty::Ty<'tcx>)
structural_to_nominal: &mut FxHashMap<&'a intrinsics::Type, Ty<'tcx>>,
expected: &'a intrinsics::Type, t: Ty<'tcx>)
{
use intrinsics::Type::*;

Expand Down
Loading

0 comments on commit 3fe4612

Please sign in to comment.