Skip to content

Commit 3fe4612

Browse files
committed
bring Ty into scope
1 parent 2bde694 commit 3fe4612

File tree

19 files changed

+59
-59
lines changed

19 files changed

+59
-59
lines changed

src/librustc/infer/error_reporting/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use hir::map as hir_map;
6666
use hir::def_id::DefId;
6767
use middle::region;
6868
use traits::{ObligationCause, ObligationCauseCode};
69-
use ty::{self, Region, TyCtxt, TypeFoldable};
69+
use ty::{self, Region, Ty, TyCtxt, TypeFoldable};
7070
use ty::error::TypeError;
7171
use syntax::ast::DUMMY_NODE_ID;
7272
use syntax_pos::{Pos, Span};
@@ -418,7 +418,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
418418
name: String,
419419
sub: &ty::subst::Substs<'tcx>,
420420
pos: usize,
421-
other_ty: &ty::Ty<'tcx>) {
421+
other_ty: &Ty<'tcx>) {
422422
// `value` and `other_value` hold two incomplete type representation for display.
423423
// `name` is the path of both types being compared. `sub`
424424
value.push_highlighted(name);
@@ -491,7 +491,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
491491
path: String,
492492
sub: &ty::subst::Substs<'tcx>,
493493
other_path: String,
494-
other_ty: &ty::Ty<'tcx>) -> Option<()> {
494+
other_ty: &Ty<'tcx>) -> Option<()> {
495495
for (i, ta) in sub.types().enumerate() {
496496
if &ta == other_ty {
497497
self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty);
@@ -522,7 +522,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
522522

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

745745
fn expected_found_str_ty(&self,
746-
exp_found: &ty::error::ExpectedFound<ty::Ty<'tcx>>)
746+
exp_found: &ty::error::ExpectedFound<Ty<'tcx>>)
747747
-> Option<(DiagnosticStyledString, DiagnosticStyledString)> {
748748
let exp_found = self.resolve_type_vars_if_possible(exp_found);
749749
if exp_found.references_error() {

src/librustc/infer/error_reporting/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! anonymous regions.
1313
use hir;
1414
use infer::InferCtxt;
15-
use ty::{self, Region};
15+
use ty::{self, Region, Ty};
1616
use hir::def_id::DefId;
1717
use hir::map as hir_map;
1818

@@ -35,7 +35,7 @@ pub struct AnonymousArgInfo<'tcx> {
3535
// the argument corresponding to the anonymous region
3636
pub arg: &'tcx hir::Arg,
3737
// the type corresponding to the anonymopus region argument
38-
pub arg_ty: ty::Ty<'tcx>,
38+
pub arg_ty: Ty<'tcx>,
3939
// the ty::BoundRegion corresponding to the anonymous region
4040
pub bound_region: ty::BoundRegion,
4141
// corresponds to id the argument is the first parameter

src/librustc/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
644644
}
645645
}
646646

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

650650
let unbound_ty_vars = self.type_variables

src/librustc/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ pub struct VtableObjectData<'tcx, N> {
381381

382382
#[derive(Clone, PartialEq, Eq)]
383383
pub struct VtableFnPointerData<'tcx, N> {
384-
pub fn_ty: ty::Ty<'tcx>,
384+
pub fn_ty: Ty<'tcx>,
385385
pub nested: Vec<N>
386386
}
387387

src/librustc_borrowck/borrowck/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use rustc::middle::mem_categorization::Categorization;
3434
use rustc::middle::mem_categorization::ImmutabilityBlame;
3535
use rustc::middle::region;
3636
use rustc::middle::free_region::RegionRelations;
37-
use rustc::ty::{self, TyCtxt};
37+
use rustc::ty::{self, Ty, TyCtxt};
3838
use rustc::ty::maps::Providers;
3939
use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin};
4040

@@ -275,7 +275,7 @@ impl<'tcx> Loan<'tcx> {
275275
#[derive(Eq)]
276276
pub struct LoanPath<'tcx> {
277277
kind: LoanPathKind<'tcx>,
278-
ty: ty::Ty<'tcx>,
278+
ty: Ty<'tcx>,
279279
}
280280

281281
impl<'tcx> PartialEq for LoanPath<'tcx> {
@@ -299,11 +299,11 @@ pub enum LoanPathKind<'tcx> {
299299
}
300300

301301
impl<'tcx> LoanPath<'tcx> {
302-
fn new(kind: LoanPathKind<'tcx>, ty: ty::Ty<'tcx>) -> LoanPath<'tcx> {
302+
fn new(kind: LoanPathKind<'tcx>, ty: Ty<'tcx>) -> LoanPath<'tcx> {
303303
LoanPath { kind: kind, ty: ty }
304304
}
305305

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

309309
// FIXME (pnkfelix): See discussion here

src/librustc_mir/build/expr/as_rvalue.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use hair::*;
2222
use rustc_const_math::{ConstInt, ConstIsize};
2323
use rustc::middle::const_val::ConstVal;
2424
use rustc::middle::region;
25-
use rustc::ty;
25+
use rustc::ty::{self, Ty};
2626
use rustc::mir::*;
2727
use syntax::ast;
2828
use syntax_pos::Span;
@@ -291,7 +291,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
291291
}
292292

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

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

412412
// Helper to get the minimum value of the appropriate type
413-
fn minval_literal(&mut self, span: Span, ty: ty::Ty<'tcx>) -> Operand<'tcx> {
413+
fn minval_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> {
414414
let literal = match ty.sty {
415415
ty::TyInt(ity) => {
416416
let val = match ity {

src/librustc_mir/hair/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc::mir::{BinOp, BorrowKind, Field, Literal, UnOp};
1919
use rustc::hir::def_id::DefId;
2020
use rustc::middle::region;
2121
use rustc::ty::subst::Substs;
22-
use rustc::ty::{self, AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior};
22+
use rustc::ty::{AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior};
2323
use rustc::hir;
2424
use syntax::ast;
2525
use syntax_pos::Span;
@@ -117,7 +117,7 @@ pub enum ExprKind<'tcx> {
117117
value: ExprRef<'tcx>,
118118
},
119119
Call {
120-
ty: ty::Ty<'tcx>,
120+
ty: Ty<'tcx>,
121121
fun: ExprRef<'tcx>,
122122
args: Vec<ExprRef<'tcx>>,
123123
},

src/librustc_mir/shim.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
282282
/// Build a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`.
283283
fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
284284
def_id: DefId,
285-
self_ty: ty::Ty<'tcx>)
285+
self_ty: Ty<'tcx>)
286286
-> Mir<'tcx>
287287
{
288288
debug!("build_clone_shim(def_id={:?})", def_id);
@@ -382,7 +382,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
382382
self.block(vec![ret_statement], TerminatorKind::Return, false);
383383
}
384384

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

392392
fn make_clone_call(
393393
&mut self,
394-
ty: ty::Ty<'tcx>,
394+
ty: Ty<'tcx>,
395395
rcvr_field: Lvalue<'tcx>,
396396
next: BasicBlock,
397397
cleanup: BasicBlock
@@ -487,7 +487,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
487487
}
488488
}
489489

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

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

619619
let mut returns = Vec::new();

src/librustc_trans/collector.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ use rustc::middle::const_val::ConstVal;
197197
use rustc::middle::lang_items::{ExchangeMallocFnLangItem};
198198
use rustc::traits;
199199
use rustc::ty::subst::Substs;
200-
use rustc::ty::{self, TypeFoldable, TyCtxt};
200+
use rustc::ty::{self, TypeFoldable, Ty, TyCtxt};
201201
use rustc::ty::adjustment::CustomCoerceUnsized;
202202
use rustc::mir::{self, Location};
203203
use rustc::mir::visit::Visitor as MirVisitor;
@@ -648,7 +648,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
648648
}
649649

650650
fn visit_drop_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
651-
ty: ty::Ty<'tcx>,
651+
ty: Ty<'tcx>,
652652
is_direct_call: bool,
653653
output: &mut Vec<TransItem<'tcx>>)
654654
{
@@ -657,7 +657,7 @@ fn visit_drop_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
657657
}
658658

659659
fn visit_fn_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
660-
ty: ty::Ty<'tcx>,
660+
ty: Ty<'tcx>,
661661
is_direct_call: bool,
662662
output: &mut Vec<TransItem<'tcx>>)
663663
{
@@ -776,10 +776,10 @@ fn should_trans_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instan
776776
/// Finally, there is also the case of custom unsizing coercions, e.g. for
777777
/// smart pointers such as `Rc` and `Arc`.
778778
fn find_vtable_types_for_unsizing<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
779-
source_ty: ty::Ty<'tcx>,
780-
target_ty: ty::Ty<'tcx>)
781-
-> (ty::Ty<'tcx>, ty::Ty<'tcx>) {
782-
let ptr_vtable = |inner_source: ty::Ty<'tcx>, inner_target: ty::Ty<'tcx>| {
779+
source_ty: Ty<'tcx>,
780+
target_ty: Ty<'tcx>)
781+
-> (Ty<'tcx>, Ty<'tcx>) {
782+
let ptr_vtable = |inner_source: Ty<'tcx>, inner_target: Ty<'tcx>| {
783783
if !scx.type_is_sized(inner_source) {
784784
(inner_source, inner_target)
785785
} else {
@@ -836,8 +836,8 @@ fn create_fn_trans_item<'a, 'tcx>(instance: Instance<'tcx>) -> TransItem<'tcx> {
836836
/// Creates a `TransItem` for each method that is referenced by the vtable for
837837
/// the given trait/impl pair.
838838
fn create_trans_items_for_vtable_methods<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
839-
trait_ty: ty::Ty<'tcx>,
840-
impl_ty: ty::Ty<'tcx>,
839+
trait_ty: Ty<'tcx>,
840+
impl_ty: Ty<'tcx>,
841841
output: &mut Vec<TransItem<'tcx>>) {
842842
assert!(!trait_ty.needs_subst() && !trait_ty.has_escaping_regions() &&
843843
!impl_ty.needs_subst() && !impl_ty.has_escaping_regions());

src/librustc_trans/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub struct LocalCrateContext<'a, 'tcx: 'a> {
104104
/// Cache instances of monomorphic and polymorphic items
105105
instances: RefCell<FxHashMap<Instance<'tcx>, ValueRef>>,
106106
/// Cache generated vtables
107-
vtables: RefCell<FxHashMap<(ty::Ty<'tcx>,
107+
vtables: RefCell<FxHashMap<(Ty<'tcx>,
108108
Option<ty::PolyExistentialTraitRef<'tcx>>), ValueRef>>,
109109
/// Cache of constant strings,
110110
const_cstr_cache: RefCell<FxHashMap<InternedString, ValueRef>>,
@@ -512,7 +512,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
512512
}
513513

514514
pub fn vtables<'a>(&'a self)
515-
-> &'a RefCell<FxHashMap<(ty::Ty<'tcx>,
515+
-> &'a RefCell<FxHashMap<(Ty<'tcx>,
516516
Option<ty::PolyExistentialTraitRef<'tcx>>), ValueRef>> {
517517
&self.local().vtables
518518
}

src/librustc_trans/declare.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
2323
use llvm::{self, ValueRef};
2424
use llvm::AttributePlace::Function;
25-
use rustc::ty;
25+
use rustc::ty::Ty;
2626
use rustc::session::config::Sanitizer;
2727
use abi::{Abi, FnType};
2828
use attributes;
@@ -119,7 +119,7 @@ pub fn declare_cfn(ccx: &CrateContext, name: &str, fn_type: Type) -> ValueRef {
119119
/// If there’s a value with the same name already declared, the function will
120120
/// update the declaration and return existing ValueRef instead.
121121
pub fn declare_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
122-
fn_type: ty::Ty<'tcx>) -> ValueRef {
122+
fn_type: Ty<'tcx>) -> ValueRef {
123123
debug!("declare_rust_fn(name={:?}, fn_type={:?})", name, fn_type);
124124
let sig = common::ty_fn_sig(ccx, fn_type);
125125
let sig = ccx.tcx().erase_late_bound_regions_and_normalize(&sig);
@@ -164,7 +164,7 @@ pub fn define_global(ccx: &CrateContext, name: &str, ty: Type) -> Option<ValueRe
164164
/// can happen with #[no_mangle] or #[export_name], for example.
165165
pub fn define_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
166166
name: &str,
167-
fn_type: ty::Ty<'tcx>) -> ValueRef {
167+
fn_type: Ty<'tcx>) -> ValueRef {
168168
if get_defined_value(ccx, name).is_some() {
169169
ccx.sess().fatal(&format!("symbol `{}` already defined", name))
170170
} else {
@@ -179,7 +179,7 @@ pub fn define_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
179179
/// can happen with #[no_mangle] or #[export_name], for example.
180180
pub fn define_internal_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
181181
name: &str,
182-
fn_type: ty::Ty<'tcx>) -> ValueRef {
182+
fn_type: Ty<'tcx>) -> ValueRef {
183183
let llfn = define_fn(ccx, name, fn_type);
184184
unsafe { llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::InternalLinkage) };
185185
llfn

src/librustc_trans/meth.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use machine;
1818
use monomorphize;
1919
use type_::Type;
2020
use value::Value;
21-
use rustc::ty;
21+
use rustc::ty::{self, Ty};
2222

2323
#[derive(Copy, Clone, Debug)]
2424
pub struct VirtualIndex(usize);
@@ -63,7 +63,7 @@ impl<'a, 'tcx> VirtualIndex {
6363
/// making an object `Foo<Trait>` from a value of type `Foo<T>`, then
6464
/// `trait_ref` would map `T:Trait`.
6565
pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
66-
ty: ty::Ty<'tcx>,
66+
ty: Ty<'tcx>,
6767
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>)
6868
-> ValueRef
6969
{

src/librustc_trans/mir/block.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use llvm::{self, ValueRef, BasicBlockRef};
1212
use rustc::middle::lang_items;
1313
use rustc::middle::const_val::{ConstEvalErr, ConstInt, ErrKind};
14-
use rustc::ty::{self, TypeFoldable};
14+
use rustc::ty::{self, Ty, TypeFoldable};
1515
use rustc::ty::layout::{self, LayoutTyper};
1616
use rustc::mir;
1717
use abi::{Abi, FnType, ArgType};
@@ -119,7 +119,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {
119119
fn_ty: FnType<'tcx>,
120120
fn_ptr: ValueRef,
121121
llargs: &[ValueRef],
122-
destination: Option<(ReturnDest, ty::Ty<'tcx>, mir::BasicBlock)>,
122+
destination: Option<(ReturnDest, Ty<'tcx>, mir::BasicBlock)>,
123123
cleanup: Option<mir::BasicBlock>
124124
| {
125125
if let Some(cleanup) = cleanup {

src/librustc_typeck/check/dropck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>(
268268
///
269269
pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>(
270270
rcx: &mut RegionCtxt<'a, 'gcx, 'tcx>,
271-
ty: ty::Ty<'tcx>,
271+
ty: Ty<'tcx>,
272272
span: Span,
273273
scope: region::Scope)
274274
-> Result<(), ErrorReported>

src/librustc_typeck/check/intrinsic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ fn match_intrinsic_type_to_type<'a, 'tcx>(
423423
tcx: TyCtxt<'a, 'tcx, 'tcx>,
424424
position: &str,
425425
span: Span,
426-
structural_to_nominal: &mut FxHashMap<&'a intrinsics::Type, ty::Ty<'tcx>>,
427-
expected: &'a intrinsics::Type, t: ty::Ty<'tcx>)
426+
structural_to_nominal: &mut FxHashMap<&'a intrinsics::Type, Ty<'tcx>>,
427+
expected: &'a intrinsics::Type, t: Ty<'tcx>)
428428
{
429429
use intrinsics::Type::*;
430430

0 commit comments

Comments
 (0)