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;

0 commit comments

Comments
 (0)