Skip to content

Commit 1035de8

Browse files
committed
rustc: middle: remove obsolete ty::get.
1 parent cb428a6 commit 1035de8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+333
-352
lines changed

src/librustc/lint/builtin.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl LintPass for UnusedCasts {
9999
match e.node {
100100
ast::ExprCast(ref expr, ref ty) => {
101101
let t_t = ast_ty_to_ty(cx, &infer::new_infer_ctxt(cx.tcx), &**ty);
102-
if ty::get(ty::expr_ty(cx.tcx, &**expr)).sty == ty::get(t_t).sty {
102+
if ty::expr_ty(cx.tcx, &**expr) == t_t {
103103
cx.span_lint(UNUSED_TYPECASTS, ty.span, "unnecessary type cast");
104104
}
105105
}
@@ -155,7 +155,7 @@ impl LintPass for TypeLimits {
155155
},
156156
_ => {
157157
let t = ty::expr_ty(cx.tcx, &**expr);
158-
match ty::get(t).sty {
158+
match t.sty {
159159
ty::ty_uint(_) => {
160160
cx.span_lint(UNSIGNED_NEGATION, e.span,
161161
"negation of unsigned int variable may \
@@ -180,7 +180,7 @@ impl LintPass for TypeLimits {
180180
}
181181

182182
if is_shift_binop(binop) {
183-
let opt_ty_bits = match ty::get(ty::expr_ty(cx.tcx, &**l)).sty {
183+
let opt_ty_bits = match ty::expr_ty(cx.tcx, &**l).sty {
184184
ty::ty_int(t) => Some(int_ty_bits(t, cx.sess().target.int_type)),
185185
ty::ty_uint(t) => Some(uint_ty_bits(t, cx.sess().target.uint_type)),
186186
_ => None
@@ -205,7 +205,7 @@ impl LintPass for TypeLimits {
205205
}
206206
},
207207
ast::ExprLit(ref lit) => {
208-
match ty::get(ty::expr_ty(cx.tcx, e)).sty {
208+
match ty::expr_ty(cx.tcx, e).sty {
209209
ty::ty_int(t) => {
210210
match lit.node {
211211
ast::LitInt(v, ast::SignedIntLit(_, ast::Plus)) |
@@ -343,7 +343,7 @@ impl LintPass for TypeLimits {
343343
// Normalize the binop so that the literal is always on the RHS in
344344
// the comparison
345345
let norm_binop = if swap { rev_binop(binop) } else { binop };
346-
match ty::get(ty::expr_ty(tcx, expr)).sty {
346+
match ty::expr_ty(tcx, expr).sty {
347347
ty::ty_int(int_ty) => {
348348
let (min, max) = int_ty_range(int_ty);
349349
let lit_val: i64 = match lit.node {
@@ -475,7 +475,7 @@ impl BoxPointers {
475475
span: Span, ty: Ty<'tcx>) {
476476
let mut n_uniq = 0i;
477477
ty::fold_ty(cx.tcx, ty, |t| {
478-
match ty::get(t).sty {
478+
match t.sty {
479479
ty::ty_uniq(_) |
480480
ty::ty_closure(box ty::ClosureTy {
481481
store: ty::UniqTraitStore,
@@ -575,7 +575,7 @@ impl LintPass for RawPointerDeriving {
575575
}
576576
let did = match item.node {
577577
ast::ItemImpl(..) => {
578-
match ty::get(ty::node_id_to_type(cx.tcx, item.id)).sty {
578+
match ty::node_id_to_type(cx.tcx, item.id).sty {
579579
ty::ty_enum(did, _) => did,
580580
ty::ty_struct(did, _) => did,
581581
_ => return,
@@ -736,7 +736,7 @@ impl LintPass for UnusedResults {
736736

737737
let t = ty::expr_ty(cx.tcx, expr);
738738
let mut warned = false;
739-
match ty::get(t).sty {
739+
match t.sty {
740740
ty::ty_nil | ty::ty_bool => return,
741741
ty::ty_struct(did, _) |
742742
ty::ty_enum(did, _) => {

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ pub fn get_enum_variants<'tcx>(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::Nod
696696
let ctor_ty = item_type(ast::DefId { krate: cdata.cnum, node: id},
697697
item, tcx, cdata);
698698
let name = item_name(&*intr, item);
699-
let (ctor_ty, arg_tys) = match ty::get(ctor_ty).sty {
699+
let (ctor_ty, arg_tys) = match ctor_ty.sty {
700700
ty::ty_bare_fn(ref f) =>
701701
(Some(ctor_ty), f.sig.inputs.clone()),
702702
_ => // Nullary or struct enum variant.

src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
5454
None => {}
5555
}
5656
let pos = w.tell().unwrap();
57-
enc_sty(w, cx, &ty::get(t).sty);
57+
enc_sty(w, cx, &t.sty);
5858
let end = w.tell().unwrap();
5959
let len = end - pos;
6060
fn estimate_sz(u: u64) -> u64 {

src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn check_and_get_illegal_move_origin<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
146146

147147
mc::cat_downcast(ref b) |
148148
mc::cat_interior(ref b, _) => {
149-
match ty::get(b.ty).sty {
149+
match b.ty.sty {
150150
ty::ty_struct(did, _) | ty::ty_enum(did, _) => {
151151
if ty::has_dtor(bccx.tcx, did) {
152152
Some(cmt.clone())

src/librustc/middle/borrowck/gather_loans/move_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
126126

127127
mc::cat_downcast(ref b) |
128128
mc::cat_interior(ref b, _) => {
129-
match ty::get(b.ty).sty {
129+
match b.ty.sty {
130130
ty::ty_struct(did, _)
131131
| ty::ty_enum(did, _) if ty::has_dtor(bccx.tcx, did) => {
132132
bccx.span_err(

src/librustc/middle/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
583583
fn move_suggestion<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>,
584584
default_msgs: (&'static str, &'static str))
585585
-> (&'static str, &'static str) {
586-
match ty::get(ty).sty {
586+
match ty.sty {
587587
ty::ty_closure(box ty::ClosureTy {
588588
store: ty::RegionTraitStore(..),
589589
..

src/librustc/middle/check_match.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
402402
pats: Vec<&Pat>, left_ty: Ty) -> P<Pat> {
403403
let pats_len = pats.len();
404404
let mut pats = pats.into_iter().map(|p| P((*p).clone()));
405-
let pat = match ty::get(left_ty).sty {
405+
let pat = match left_ty.sty {
406406
ty::ty_tup(_) => ast::PatTup(pats.collect()),
407407

408408
ty::ty_enum(cid, _) | ty::ty_struct(cid, _) => {
@@ -434,7 +434,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
434434
}
435435

436436
ty::ty_rptr(_, ty::mt { ty, .. }) => {
437-
match ty::get(ty).sty {
437+
match ty.sty {
438438
ty::ty_vec(_, Some(n)) => match ctor {
439439
&Single => {
440440
assert_eq!(pats_len, n);
@@ -494,14 +494,14 @@ fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
494494
/// the column of patterns being analyzed.
495495
fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty,
496496
max_slice_length: uint) -> Vec<Constructor> {
497-
match ty::get(left_ty).sty {
497+
match left_ty.sty {
498498
ty::ty_bool =>
499499
[true, false].iter().map(|b| ConstantValue(const_bool(*b))).collect(),
500500

501501
ty::ty_nil =>
502502
vec!(ConstantValue(const_nil)),
503503

504-
ty::ty_rptr(_, ty::mt { ty, .. }) => match ty::get(ty).sty {
504+
ty::ty_rptr(_, ty::mt { ty, .. }) => match ty.sty {
505505
ty::ty_vec(_, None) =>
506506
range_inclusive(0, max_slice_length).map(|length| Slice(length)).collect(),
507507
_ => vec!(Single)
@@ -670,7 +670,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
670670
ast::PatRange(ref lo, ref hi) =>
671671
vec!(ConstantRange(eval_const_expr(cx.tcx, &**lo), eval_const_expr(cx.tcx, &**hi))),
672672
ast::PatVec(ref before, ref slice, ref after) =>
673-
match ty::get(left_ty).sty {
673+
match left_ty.sty {
674674
ty::ty_vec(_, Some(_)) => vec!(Single),
675675
_ => if slice.is_some() {
676676
range_inclusive(before.len() + after.len(), max_slice_length)
@@ -695,10 +695,10 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
695695
/// For instance, a tuple pattern (_, 42u, Some([])) has the arity of 3.
696696
/// A struct pattern's arity is the number of fields it contains, etc.
697697
pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> uint {
698-
match ty::get(ty).sty {
698+
match ty.sty {
699699
ty::ty_tup(ref fs) => fs.len(),
700700
ty::ty_uniq(_) => 1u,
701-
ty::ty_rptr(_, ty::mt { ty, .. }) => match ty::get(ty).sty {
701+
ty::ty_rptr(_, ty::mt { ty, .. }) => match ty.sty {
702702
ty::ty_vec(_, None) => match *ctor {
703703
Slice(length) => length,
704704
ConstantValue(_) => 0u,

src/librustc/middle/check_static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckStaticVisitor<'a, 'tcx> {
161161

162162
let node_ty = ty::node_id_to_type(self.tcx, e.id);
163163

164-
match ty::get(node_ty).sty {
164+
match node_ty.sty {
165165
ty::ty_struct(did, _) |
166166
ty::ty_enum(did, _) if ty::has_dtor(self.tcx, did) => {
167167
self.tcx.sess.span_err(e.span,

src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ pub fn eval_const_expr_partial(tcx: &ty::ctxt, e: &Expr) -> Result<const_val, St
522522
$const_type:ident,
523523
$target_ty:ty
524524
)),*
525-
}) => (match ty::get(ety).sty {
525+
}) => (match ety.sty {
526526
$($ty_pat => {
527527
match $val {
528528
const_bool(b) => Ok($const_type(b as $intermediate_ty as $target_ty)),

src/librustc/middle/dead.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
138138
}
139139

140140
fn handle_field_access(&mut self, lhs: &ast::Expr, name: &ast::Ident) {
141-
match ty::get(ty::expr_ty_adjusted(self.tcx, lhs)).sty {
141+
match ty::expr_ty_adjusted(self.tcx, lhs).sty {
142142
ty::ty_struct(id, _) => {
143143
let fields = ty::lookup_struct_fields(self.tcx, id);
144144
let field_id = fields.iter()
@@ -150,7 +150,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
150150
}
151151

152152
fn handle_tup_field_access(&mut self, lhs: &ast::Expr, idx: uint) {
153-
match ty::get(ty::expr_ty_adjusted(self.tcx, lhs)).sty {
153+
match ty::expr_ty_adjusted(self.tcx, lhs).sty {
154154
ty::ty_struct(id, _) => {
155155
let fields = ty::lookup_struct_fields(self.tcx, id);
156156
let field_id = fields[idx].id;

src/librustc/middle/effect.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ enum UnsafeContext {
3030
}
3131

3232
fn type_is_unsafe_function(ty: Ty) -> bool {
33-
match ty::get(ty).sty {
33+
match ty.sty {
3434
ty::ty_bare_fn(ref f) => f.fn_style == ast::UnsafeFn,
3535
ty::ty_closure(ref f) => f.fn_style == ast::UnsafeFn,
3636
_ => false,
@@ -69,8 +69,8 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
6969
};
7070
debug!("effect: checking index with base type {}",
7171
ppaux::ty_to_string(self.tcx, base_type));
72-
match ty::get(base_type).sty {
73-
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
72+
match base_type.sty {
73+
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty.sty {
7474
ty::ty_str => {
7575
span_err!(self.tcx.sess, e.span, E0134,
7676
"modification of string types is not allowed");
@@ -165,7 +165,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
165165
let base_type = ty::node_id_to_type(self.tcx, base.id);
166166
debug!("effect: unary case, base type is {}",
167167
ppaux::ty_to_string(self.tcx, base_type));
168-
match ty::get(base_type).sty {
168+
match base_type.sty {
169169
ty::ty_ptr(_) => {
170170
self.require_unsafe(expr.span,
171171
"dereference of unsafe pointer")

src/librustc/middle/expr_use_visitor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
513513
let callee_ty = ty::expr_ty_adjusted(self.tcx(), callee);
514514
debug!("walk_callee: callee={} callee_ty={}",
515515
callee.repr(self.tcx()), callee_ty.repr(self.tcx()));
516-
match ty::get(callee_ty).sty {
516+
match callee_ty.sty {
517517
ty::ty_bare_fn(..) => {
518518
self.consume_expr(callee);
519519
}
@@ -650,7 +650,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
650650

651651
// Select just those fields of the `with`
652652
// expression that will actually be used
653-
let with_fields = match ty::get(with_cmt.ty).sty {
653+
let with_fields = match with_cmt.ty.sty {
654654
ty::ty_struct(did, ref substs) => {
655655
ty::struct_fields(self.tcx(), did, substs)
656656
}
@@ -735,7 +735,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
735735
Some(method_ty) => {
736736
let cmt = return_if_err!(self.mc.cat_expr_autoderefd(expr, i));
737737
let self_ty = ty::ty_fn_args(method_ty)[0];
738-
let (m, r) = match ty::get(self_ty).sty {
738+
let (m, r) = match self_ty.sty {
739739
ty::ty_rptr(r, ref m) => (m.mutbl, r),
740740
_ => self.tcx().sess.span_bug(expr.span,
741741
format!("bad overloaded deref type {}",

src/librustc/middle/intrinsicck.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn type_size_is_affected_by_type_parameters<'tcx>(tcx: &ty::ctxt<'tcx>, typ: Ty<
2727
-> bool {
2828
let mut result = false;
2929
ty::maybe_walk_ty(typ, |typ| {
30-
match ty::get(typ).sty {
30+
match typ.sty {
3131
ty::ty_uniq(_) | ty::ty_ptr(_) | ty::ty_rptr(..) |
3232
ty::ty_bare_fn(..) | ty::ty_closure(..) => {
3333
false
@@ -73,7 +73,7 @@ struct IntrinsicCheckingVisitor<'a, 'tcx: 'a> {
7373

7474
impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
7575
fn def_id_is_transmute(&self, def_id: DefId) -> bool {
76-
let intrinsic = match ty::get(ty::lookup_item_type(self.tcx, def_id).ty).sty {
76+
let intrinsic = match ty::lookup_item_type(self.tcx, def_id).ty.sty {
7777
ty::ty_bare_fn(ref bfty) => bfty.abi == RustIntrinsic,
7878
_ => return false
7979
};
@@ -123,7 +123,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for IntrinsicCheckingVisitor<'a, 'tcx> {
123123
match ty::resolve_expr(self.tcx, expr) {
124124
DefFn(did, _) if self.def_id_is_transmute(did) => {
125125
let typ = ty::node_id_to_type(self.tcx, expr.id);
126-
match ty::get(typ).sty {
126+
match typ.sty {
127127
ty_bare_fn(ref bare_fn_ty)
128128
if bare_fn_ty.abi == RustIntrinsic => {
129129
if let ty::FnConverging(to) = bare_fn_ty.sig.output {

src/librustc/middle/liveness.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ fn check_fn(_v: &Liveness,
15191519
impl<'a, 'tcx> Liveness<'a, 'tcx> {
15201520
fn fn_ret(&self, id: NodeId) -> ty::FnOutput<'tcx> {
15211521
let fn_ty = ty::node_id_to_type(self.ir.tcx, id);
1522-
match ty::get(fn_ty).sty {
1522+
match fn_ty.sty {
15231523
ty::ty_unboxed_closure(closure_def_id, _, _) =>
15241524
self.ir.tcx.unboxed_closures()
15251525
.borrow()
@@ -1549,8 +1549,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
15491549
None if body.stmts.len() > 0 =>
15501550
match body.stmts.last().unwrap().node {
15511551
ast::StmtSemi(ref e, _) => {
1552-
let t_stmt = ty::expr_ty(self.ir.tcx, &**e);
1553-
ty::get(t_stmt).sty == ty::get(t_ret).sty
1552+
ty::expr_ty(self.ir.tcx, &**e) == t_ret
15541553
},
15551554
_ => false
15561555
},

src/librustc/middle/mem_categorization.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pub enum deref_kind {
199199
// derefable (we model an index as the combination of a deref and then a
200200
// pointer adjustment).
201201
pub fn opt_deref_kind(t: Ty) -> Option<deref_kind> {
202-
match ty::get(t).sty {
202+
match t.sty {
203203
ty::ty_uniq(_) |
204204
ty::ty_closure(box ty::ClosureTy {store: ty::UniqTraitStore, ..}) => {
205205
Some(deref_ptr(OwnedPtr))
@@ -587,7 +587,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
587587

588588
def::DefUpvar(var_id, fn_node_id, _) => {
589589
let ty = if_ok!(self.node_ty(fn_node_id));
590-
match ty::get(ty).sty {
590+
match ty.sty {
591591
ty::ty_closure(ref closure_ty) => {
592592
// Translate old closure type info into unboxed
593593
// closure kind/capture mode
@@ -810,7 +810,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
810810
-> cmt<'tcx> {
811811
match self.typer.temporary_scope(id) {
812812
Some(scope) => {
813-
match ty::get(expr_ty).sty {
813+
match expr_ty.sty {
814814
ty::ty_vec(_, Some(0)) => self.cat_rvalue(id, span, ty::ReStatic, expr_ty),
815815
_ => self.cat_rvalue(id, span, ty::ReScope(scope), expr_ty)
816816
}
@@ -1071,8 +1071,8 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
10711071
* to recurse through rptrs.
10721072
*/
10731073

1074-
match ty::get(slice_ty).sty {
1075-
ty::ty_rptr(r, ref mt) => match ty::get(mt.ty).sty {
1074+
match slice_ty.sty {
1075+
ty::ty_rptr(r, ref mt) => match mt.ty.sty {
10761076
ty::ty_vec(_, None) => (mt.mutbl, r),
10771077
_ => vec_slice_info(tcx, pat, mt.ty),
10781078
},
@@ -1535,9 +1535,9 @@ impl<'tcx> Repr<'tcx> for InteriorKind {
15351535
}
15361536

15371537
fn element_kind(t: Ty) -> ElementKind {
1538-
match ty::get(t).sty {
1538+
match t.sty {
15391539
ty::ty_rptr(_, ty::mt{ty, ..}) |
1540-
ty::ty_uniq(ty) => match ty::get(ty).sty {
1540+
ty::ty_uniq(ty) => match ty.sty {
15411541
ty::ty_vec(_, None) => VecElement,
15421542
_ => OtherElement
15431543
},

0 commit comments

Comments
 (0)