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;

0 commit comments

Comments
 (0)