Skip to content

Commit 9f7aa7f

Browse files
committed
rustc: middle: remove obsolete ty::get.
1 parent 01105ff commit 9f7aa7f

Some content is hidden

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

65 files changed

+326
-346
lines changed

src/librustc/lint/builtin.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl LintPass for UnusedCasts {
100100
match e.node {
101101
ast::ExprCast(ref expr, ref ty) => {
102102
let t_t = ast_ty_to_ty(cx, &infer::new_infer_ctxt(cx.tcx), &**ty);
103-
if ty::get(ty::expr_ty(cx.tcx, &**expr)).sty == ty::get(t_t).sty {
103+
if ty::expr_ty(cx.tcx, &**expr) == t_t {
104104
cx.span_lint(UNUSED_TYPECASTS, ty.span, "unnecessary type cast");
105105
}
106106
}
@@ -156,7 +156,7 @@ impl LintPass for TypeLimits {
156156
},
157157
_ => {
158158
let t = ty::expr_ty(cx.tcx, &**expr);
159-
match ty::get(t).sty {
159+
match t.sty {
160160
ty::ty_uint(_) => {
161161
cx.span_lint(UNSIGNED_NEGATION, e.span,
162162
"negation of unsigned int variable may \
@@ -181,7 +181,7 @@ impl LintPass for TypeLimits {
181181
}
182182

183183
if is_shift_binop(binop) {
184-
let opt_ty_bits = match ty::get(ty::expr_ty(cx.tcx, &**l)).sty {
184+
let opt_ty_bits = match ty::expr_ty(cx.tcx, &**l).sty {
185185
ty::ty_int(t) => Some(int_ty_bits(t, cx.sess().target.int_type)),
186186
ty::ty_uint(t) => Some(uint_ty_bits(t, cx.sess().target.uint_type)),
187187
_ => None
@@ -206,7 +206,7 @@ impl LintPass for TypeLimits {
206206
}
207207
},
208208
ast::ExprLit(ref lit) => {
209-
match ty::get(ty::expr_ty(cx.tcx, e)).sty {
209+
match ty::expr_ty(cx.tcx, e).sty {
210210
ty::ty_int(t) => {
211211
match lit.node {
212212
ast::LitInt(v, ast::SignedIntLit(_, ast::Plus)) |
@@ -344,7 +344,7 @@ impl LintPass for TypeLimits {
344344
// Normalize the binop so that the literal is always on the RHS in
345345
// the comparison
346346
let norm_binop = if swap { rev_binop(binop) } else { binop };
347-
match ty::get(ty::expr_ty(tcx, expr)).sty {
347+
match ty::expr_ty(tcx, expr).sty {
348348
ty::ty_int(int_ty) => {
349349
let (min, max) = int_ty_range(int_ty);
350350
let lit_val: i64 = match lit.node {
@@ -478,7 +478,7 @@ impl BoxPointers {
478478
span: Span, ty: Ty<'tcx>) {
479479
let mut n_uniq = 0i;
480480
ty::fold_ty(cx.tcx, ty, |t| {
481-
match ty::get(t).sty {
481+
match t.sty {
482482
ty::ty_uniq(_) |
483483
ty::ty_closure(box ty::ClosureTy {
484484
store: ty::UniqTraitStore,
@@ -578,7 +578,7 @@ impl LintPass for RawPointerDeriving {
578578
}
579579
let did = match item.node {
580580
ast::ItemImpl(..) => {
581-
match ty::get(ty::node_id_to_type(cx.tcx, item.id)).sty {
581+
match ty::node_id_to_type(cx.tcx, item.id).sty {
582582
ty::ty_enum(did, _) => did,
583583
ty::ty_struct(did, _) => did,
584584
_ => return,
@@ -740,7 +740,7 @@ impl LintPass for UnusedResults {
740740

741741
let t = ty::expr_ty(cx.tcx, expr);
742742
let mut warned = false;
743-
match ty::get(t).sty {
743+
match t.sty {
744744
ty::ty_tup(ref tys) if tys.is_empty() => return,
745745
ty::ty_bool => return,
746746
ty::ty_struct(did, _) |

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ pub fn get_enum_variants<'tcx>(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::Nod
699699
let ctor_ty = item_type(ast::DefId { krate: cdata.cnum, node: id},
700700
item, tcx, cdata);
701701
let name = item_name(&*intr, item);
702-
let (ctor_ty, arg_tys) = match ty::get(ctor_ty).sty {
702+
let (ctor_ty, arg_tys) = match ctor_ty.sty {
703703
ty::ty_bare_fn(ref f) =>
704704
(Some(ctor_ty), f.sig.inputs.clone()),
705705
_ => // 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
@@ -589,7 +589,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
589589
fn move_suggestion<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>,
590590
default_msgs: (&'static str, &'static str))
591591
-> (&'static str, &'static str) {
592-
match ty::get(ty).sty {
592+
match ty.sty {
593593
ty::ty_closure(box ty::ClosureTy {
594594
store: ty::RegionTraitStore(..),
595595
..

src/librustc/middle/check_match.rs

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

412412
ty::ty_enum(cid, _) | ty::ty_struct(cid, _) => {
@@ -438,7 +438,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
438438
}
439439

440440
ty::ty_rptr(_, ty::mt { ty, .. }) => {
441-
match ty::get(ty).sty {
441+
match ty.sty {
442442
ty::ty_vec(_, Some(n)) => match ctor {
443443
&Single => {
444444
assert_eq!(pats_len, n);
@@ -498,11 +498,11 @@ fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
498498
/// the column of patterns being analyzed.
499499
fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty,
500500
max_slice_length: uint) -> Vec<Constructor> {
501-
match ty::get(left_ty).sty {
501+
match left_ty.sty {
502502
ty::ty_bool =>
503503
[true, false].iter().map(|b| ConstantValue(const_bool(*b))).collect(),
504504

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

src/librustc/middle/check_static.rs

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

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

165-
match ty::get(node_ty).sty {
165+
match node_ty.sty {
166166
ty::ty_struct(did, _) |
167167
ty::ty_enum(did, _) if ty::has_dtor(self.tcx, did) => {
168168
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
@@ -524,7 +524,7 @@ pub fn eval_const_expr_partial(tcx: &ty::ctxt, e: &Expr) -> Result<const_val, St
524524
$const_type:ident,
525525
$target_ty:ty
526526
)),*
527-
}) => (match ty::get(ety).sty {
527+
}) => (match ety.sty {
528528
$($ty_pat => {
529529
match $val {
530530
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
@@ -140,7 +140,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
140140
}
141141

142142
fn handle_field_access(&mut self, lhs: &ast::Expr, name: &ast::Ident) {
143-
match ty::get(ty::expr_ty_adjusted(self.tcx, lhs)).sty {
143+
match ty::expr_ty_adjusted(self.tcx, lhs).sty {
144144
ty::ty_struct(id, _) => {
145145
let fields = ty::lookup_struct_fields(self.tcx, id);
146146
let field_id = fields.iter()
@@ -152,7 +152,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
152152
}
153153

154154
fn handle_tup_field_access(&mut self, lhs: &ast::Expr, idx: uint) {
155-
match ty::get(ty::expr_ty_adjusted(self.tcx, lhs)).sty {
155+
match ty::expr_ty_adjusted(self.tcx, lhs).sty {
156156
ty::ty_struct(id, _) => {
157157
let fields = ty::lookup_struct_fields(self.tcx, id);
158158
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
@@ -31,7 +31,7 @@ enum UnsafeContext {
3131
}
3232

3333
fn type_is_unsafe_function(ty: Ty) -> bool {
34-
match ty::get(ty).sty {
34+
match ty.sty {
3535
ty::ty_bare_fn(ref f) => f.fn_style == ast::UnsafeFn,
3636
ty::ty_closure(ref f) => f.fn_style == ast::UnsafeFn,
3737
_ => false,
@@ -70,8 +70,8 @@ impl<'a, 'tcx> EffectCheckVisitor<'a, 'tcx> {
7070
};
7171
debug!("effect: checking index with base type {}",
7272
ppaux::ty_to_string(self.tcx, base_type));
73-
match ty::get(base_type).sty {
74-
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty::get(ty).sty {
73+
match base_type.sty {
74+
ty::ty_uniq(ty) | ty::ty_rptr(_, ty::mt{ty, ..}) => match ty.sty {
7575
ty::ty_str => {
7676
span_err!(self.tcx.sess, e.span, E0134,
7777
"modification of string types is not allowed");
@@ -166,7 +166,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
166166
let base_type = ty::node_id_to_type(self.tcx, base.id);
167167
debug!("effect: unary case, base type is {}",
168168
ppaux::ty_to_string(self.tcx, base_type));
169-
match ty::get(base_type).sty {
169+
match base_type.sty {
170170
ty::ty_ptr(_) => {
171171
self.require_unsafe(expr.span,
172172
"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
@@ -519,7 +519,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
519519
let callee_ty = ty::expr_ty_adjusted(self.tcx(), callee);
520520
debug!("walk_callee: callee={} callee_ty={}",
521521
callee.repr(self.tcx()), callee_ty.repr(self.tcx()));
522-
match ty::get(callee_ty).sty {
522+
match callee_ty.sty {
523523
ty::ty_bare_fn(..) => {
524524
self.consume_expr(callee);
525525
}
@@ -656,7 +656,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
656656

657657
// Select just those fields of the `with`
658658
// expression that will actually be used
659-
let with_fields = match ty::get(with_cmt.ty).sty {
659+
let with_fields = match with_cmt.ty.sty {
660660
ty::ty_struct(did, ref substs) => {
661661
ty::struct_fields(self.tcx(), did, substs)
662662
}
@@ -745,7 +745,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
745745
Some(method_ty) => {
746746
let cmt = return_if_err!(self.mc.cat_expr_autoderefd(expr, i));
747747
let self_ty = ty::ty_fn_args(method_ty)[0];
748-
let (m, r) = match ty::get(self_ty).sty {
748+
let (m, r) = match self_ty.sty {
749749
ty::ty_rptr(r, ref m) => (m.mutbl, r),
750750
_ => self.tcx().sess.span_bug(expr.span,
751751
format!("bad overloaded deref type {}",

src/librustc/middle/fast_reject.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn simplify_type(tcx: &ty::ctxt,
5353
* are to be considered bound.
5454
*/
5555

56-
match ty::get(ty).sty {
56+
match ty.sty {
5757
ty::ty_bool => Some(BoolSimplifiedType),
5858
ty::ty_char => Some(CharSimplifiedType),
5959
ty::ty_int(int_type) => Some(IntSimplifiedType(int_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
@@ -1520,7 +1520,7 @@ fn check_fn(_v: &Liveness,
15201520
impl<'a, 'tcx> Liveness<'a, 'tcx> {
15211521
fn fn_ret(&self, id: NodeId) -> ty::FnOutput<'tcx> {
15221522
let fn_ty = ty::node_id_to_type(self.ir.tcx, id);
1523-
match ty::get(fn_ty).sty {
1523+
match fn_ty.sty {
15241524
ty::ty_unboxed_closure(closure_def_id, _, _) =>
15251525
self.ir.tcx.unboxed_closures()
15261526
.borrow()
@@ -1550,8 +1550,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
15501550
None if body.stmts.len() > 0 =>
15511551
match body.stmts.last().unwrap().node {
15521552
ast::StmtSemi(ref e, _) => {
1553-
let t_stmt = ty::expr_ty(self.ir.tcx, &**e);
1554-
ty::get(t_stmt).sty == ty::get(t_ret).sty
1553+
ty::expr_ty(self.ir.tcx, &**e) == t_ret
15551554
},
15561555
_ => false
15571556
},

src/librustc/middle/mem_categorization.rs

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

586586
def::DefUpvar(var_id, fn_node_id, _) => {
587587
let ty = if_ok!(self.node_ty(fn_node_id));
588-
match ty::get(ty).sty {
588+
match ty.sty {
589589
ty::ty_closure(ref closure_ty) => {
590590
// Translate old closure type info into unboxed
591591
// closure kind/capture mode
@@ -808,7 +808,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
808808
-> cmt<'tcx> {
809809
match self.typer.temporary_scope(id) {
810810
Some(scope) => {
811-
match ty::get(expr_ty).sty {
811+
match expr_ty.sty {
812812
ty::ty_vec(_, Some(0)) => self.cat_rvalue(id, span, ty::ReStatic, expr_ty),
813813
_ => self.cat_rvalue(id, span, ty::ReScope(scope), expr_ty)
814814
}
@@ -1069,8 +1069,8 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
10691069
* to recurse through rptrs.
10701070
*/
10711071

1072-
match ty::get(slice_ty).sty {
1073-
ty::ty_rptr(r, ref mt) => match ty::get(mt.ty).sty {
1072+
match slice_ty.sty {
1073+
ty::ty_rptr(r, ref mt) => match mt.ty.sty {
10741074
ty::ty_vec(_, None) => (mt.mutbl, r),
10751075
_ => vec_slice_info(tcx, pat, mt.ty),
10761076
},
@@ -1533,9 +1533,9 @@ impl<'tcx> Repr<'tcx> for InteriorKind {
15331533
}
15341534

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

0 commit comments

Comments
 (0)