Skip to content

Commit 3531697

Browse files
committed
Remove type parameters from ExprField and ExprTupField
1 parent 9a857b4 commit 3531697

File tree

23 files changed

+125
-254
lines changed

23 files changed

+125
-254
lines changed

src/librustc/lint/builtin.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,18 @@ use util::ppaux::{ty_to_string};
3737
use util::nodemap::{FnvHashMap, NodeSet};
3838
use lint::{Context, LintPass, LintArray};
3939

40-
use std::cmp;
40+
use std::{cmp, slice};
4141
use std::collections::hash_map::{Occupied, Vacant};
4242
use std::num::SignedInt;
43-
use std::slice;
4443
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
45-
use syntax::abi;
46-
use syntax::ast_map;
47-
use syntax::ast_util::is_shift_binop;
48-
use syntax::attr::AttrMetaMethods;
49-
use syntax::attr;
44+
use syntax::{abi, ast, ast_map};
45+
use syntax::ast_util::{mod, is_shift_binop};
46+
use syntax::attr::{mod, AttrMetaMethods};
5047
use syntax::codemap::{Span, DUMMY_SP};
5148
use syntax::parse::token;
52-
use syntax::{ast, ast_util, visit};
5349
use syntax::ast::{TyI, TyU, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
5450
use syntax::ptr::P;
55-
use syntax::visit::Visitor;
51+
use syntax::visit::{mod, Visitor};
5652

5753
declare_lint!(WHILE_TRUE, Warn,
5854
"suggest using `loop { }` instead of `while true { }`")
@@ -1112,8 +1108,8 @@ impl UnusedParens {
11121108
}
11131109
ast::ExprUnary(_, ref x) |
11141110
ast::ExprCast(ref x, _) |
1115-
ast::ExprField(ref x, _, _) |
1116-
ast::ExprTupField(ref x, _, _) |
1111+
ast::ExprField(ref x, _) |
1112+
ast::ExprTupField(ref x, _) |
11171113
ast::ExprIndex(ref x, _) => {
11181114
// &X { y: 1 }, X { y: 1 }.y
11191115
contains_exterior_struct_lit(&**x)

src/librustc/middle/cfg/construct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
475475
ast::ExprCast(ref e, _) |
476476
ast::ExprUnary(_, ref e) |
477477
ast::ExprParen(ref e) |
478-
ast::ExprField(ref e, _, _) |
479-
ast::ExprTupField(ref e, _, _) => {
478+
ast::ExprField(ref e, _) |
479+
ast::ExprTupField(ref e, _) => {
480480
self.straightline(expr, pred, Some(&**e).into_iter())
481481
}
482482

src/librustc/middle/const_eval.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ pub use self::const_val::*;
1515
pub use self::constness::*;
1616

1717
use metadata::csearch;
18-
use middle::astencode;
19-
use middle::def;
18+
use middle::{astencode, def};
2019
use middle::pat_util::def_to_path;
2120
use middle::ty::{mod, Ty};
22-
use middle::typeck::astconv;
23-
use middle::typeck::check;
24-
use util::nodemap::{DefIdMap};
21+
use middle::typeck::{astconv, check};
22+
use util::nodemap::DefIdMap;
2523

2624
use syntax::ast::{mod, Expr};
2725
use syntax::parse::token::InternedString;
2826
use syntax::ptr::P;
29-
use syntax::visit::Visitor;
30-
use syntax::visit;
27+
use syntax::visit::{mod, Visitor};
3128
use syntax::{ast_map, ast_util, codemap};
3229

3330
use std::rc::Rc;
@@ -234,9 +231,9 @@ impl<'a, 'tcx> ConstEvalVisitor<'a, 'tcx> {
234231
}
235232
}
236233

237-
ast::ExprField(ref base, _, _) => self.classify(&**base),
234+
ast::ExprField(ref base, _) => self.classify(&**base),
238235

239-
ast::ExprTupField(ref base, _, _) => self.classify(&**base),
236+
ast::ExprTupField(ref base, _) => self.classify(&**base),
240237

241238
ast::ExprIndex(ref base, ref idx) =>
242239
join(self.classify(&**base), self.classify(&**idx)),

src/librustc/middle/dead.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,14 @@
1212
// closely. The idea is that all reachable symbols are live, codes called
1313
// from live codes are live, and everything else is dead.
1414

15-
use middle::def;
16-
use middle::pat_util;
17-
use middle::privacy;
18-
use middle::ty;
19-
use middle::typeck;
15+
use middle::{def, pat_util, privacy, ty, typeck};
2016
use lint;
2117
use util::nodemap::NodeSet;
2218

2319
use std::collections::HashSet;
24-
use syntax::ast;
25-
use syntax::ast_map;
20+
use syntax::{ast, ast_map, codemap};
2621
use syntax::ast_util::{local_def, is_local, PostExpansionMethod};
2722
use syntax::attr::{mod, AttrMetaMethods};
28-
use syntax::codemap;
2923
use syntax::visit::{mod, Visitor};
3024

3125
// Any local node that may call something in its body block should be
@@ -277,10 +271,10 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
277271
ast::ExprMethodCall(..) => {
278272
self.lookup_and_handle_method(expr.id, expr.span);
279273
}
280-
ast::ExprField(ref lhs, ref ident, _) => {
274+
ast::ExprField(ref lhs, ref ident) => {
281275
self.handle_field_access(&**lhs, &ident.node);
282276
}
283-
ast::ExprTupField(ref lhs, idx, _) => {
277+
ast::ExprTupField(ref lhs, idx) => {
284278
self.handle_tup_field_access(&**lhs, idx.node);
285279
}
286280
_ => ()

src/librustc/middle/expr_use_visitor.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ pub use self::ConsumeMode::*;
2020
pub use self::MoveReason::*;
2121
use self::OverloadedCallType::*;
2222

23+
use middle::{def, region, pat_util};
2324
use middle::mem_categorization as mc;
24-
use middle::def;
2525
use middle::mem_categorization::Typer;
26-
use middle::region;
27-
use middle::pat_util;
2826
use middle::ty::{mod, Ty};
2927
use middle::typeck::{MethodCall, MethodObject, MethodTraitObject};
3028
use middle::typeck::{MethodOrigin, MethodParam, MethodTypeParam};
@@ -331,11 +329,11 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
331329
}
332330
}
333331

334-
ast::ExprField(ref base, _, _) => { // base.f
332+
ast::ExprField(ref base, _) => { // base.f
335333
self.select_from_expr(&**base);
336334
}
337335

338-
ast::ExprTupField(ref base, _, _) => { // base.<n>
336+
ast::ExprTupField(ref base, _) => { // base.<n>
339337
self.select_from_expr(&**base);
340338
}
341339

src/librustc/middle/liveness.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -113,24 +113,19 @@ use self::VarKind::*;
113113

114114
use middle::def::*;
115115
use middle::mem_categorization::Typer;
116-
use middle::pat_util;
117-
use middle::typeck;
118-
use middle::ty;
116+
use middle::{pat_util, typeck, ty};
119117
use lint;
120118
use util::nodemap::NodeMap;
121119

122-
use std::fmt;
123-
use std::io;
120+
use std::{fmt, io, uint};
124121
use std::rc::Rc;
125-
use std::uint;
126122
use syntax::ast::{mod, NodeId, Expr};
127123
use syntax::codemap::{BytePos, original_sp, Span};
128-
use syntax::parse::token::special_idents;
129-
use syntax::parse::token;
124+
use syntax::parse::token::{mod, special_idents};
130125
use syntax::print::pprust::{expr_to_string, block_to_string};
131126
use syntax::ptr::P;
132-
use syntax::{visit, ast_util};
133-
use syntax::visit::{Visitor, FnKind};
127+
use syntax::ast_util;
128+
use syntax::visit::{mod, Visitor, FnKind};
134129

135130
/// For use with `propagate_through_loop`.
136131
enum LoopKind<'a> {
@@ -967,11 +962,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
967962
self.access_path(expr, succ, ACC_READ | ACC_USE)
968963
}
969964

970-
ast::ExprField(ref e, _, _) => {
965+
ast::ExprField(ref e, _) => {
971966
self.propagate_through_expr(&**e, succ)
972967
}
973968

974-
ast::ExprTupField(ref e, _, _) => {
969+
ast::ExprTupField(ref e, _) => {
975970
self.propagate_through_expr(&**e, succ)
976971
}
977972

@@ -1295,8 +1290,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
12951290

12961291
match expr.node {
12971292
ast::ExprPath(_) => succ,
1298-
ast::ExprField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
1299-
ast::ExprTupField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
1293+
ast::ExprField(ref e, _) => self.propagate_through_expr(&**e, succ),
1294+
ast::ExprTupField(ref e, _) => self.propagate_through_expr(&**e, succ),
13001295
_ => self.propagate_through_expr(expr, succ)
13011296
}
13021297
}

src/librustc/middle/mem_categorization.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
477477
Ok(self.cat_deref(expr, base_cmt, 0, false))
478478
}
479479

480-
ast::ExprField(ref base, f_name, _) => {
480+
ast::ExprField(ref base, f_name) => {
481481
let base_cmt = if_ok!(self.cat_expr(&**base));
482482
debug!("cat_expr(cat_field): id={} expr={} base={}",
483483
expr.id,
@@ -486,7 +486,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
486486
Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
487487
}
488488

489-
ast::ExprTupField(ref base, idx, _) => {
489+
ast::ExprTupField(ref base, idx) => {
490490
let base_cmt = if_ok!(self.cat_expr(&**base));
491491
Ok(self.cat_tup_field(expr, base_cmt, idx.node, expr_ty))
492492
}

src/librustc/middle/privacy.rs

+9-18
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,17 @@ use self::FieldName::*;
1717
use std::mem::replace;
1818

1919
use metadata::csearch;
20-
use middle::def;
21-
use middle::resolve;
20+
use middle::{def, resolve};
2221
use middle::ty::{mod, Ty};
2322
use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam};
2423
use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure, MethodObject, MethodTraitObject};
2524
use util::nodemap::{NodeMap, NodeSet};
2625

27-
use syntax::ast;
28-
use syntax::ast_map;
26+
use syntax::{ast, ast_map};
2927
use syntax::ast_util::{is_local, local_def, PostExpansionMethod};
3028
use syntax::codemap::Span;
3129
use syntax::parse::token;
32-
use syntax::visit;
33-
use syntax::visit::Visitor;
30+
use syntax::visit::{mod, Visitor};
3431

3532
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap2);
3633

@@ -836,20 +833,14 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
836833

837834
fn visit_expr(&mut self, expr: &ast::Expr) {
838835
match expr.node {
839-
ast::ExprField(ref base, ident, _) => {
840-
match ty::expr_ty_adjusted(self.tcx, &**base).sty {
841-
ty::ty_struct(id, _) => {
842-
self.check_field(expr.span, id, NamedField(ident.node));
843-
}
844-
_ => {}
836+
ast::ExprField(ref base, ident) => {
837+
if let ty::ty_struct(id, _) = ty::expr_ty_adjusted(self.tcx, &**base).sty {
838+
self.check_field(expr.span, id, NamedField(ident.node));
845839
}
846840
}
847-
ast::ExprTupField(ref base, idx, _) => {
848-
match ty::expr_ty_adjusted(self.tcx, &**base).sty {
849-
ty::ty_struct(id, _) => {
850-
self.check_field(expr.span, id, UnnamedField(idx.node));
851-
}
852-
_ => {}
841+
ast::ExprTupField(ref base, idx) => {
842+
if let ty::ty_struct(id, _) = ty::expr_ty_adjusted(self.tcx, &**base).sty {
843+
self.check_field(expr.span, id, UnnamedField(idx.node));
853844
}
854845
}
855846
ast::ExprMethodCall(ident, _, _) => {

src/librustc/middle/region.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ Most of the documentation on regions can be found in
2222

2323

2424
use session::Session;
25-
use middle::ty::{FreeRegion};
26-
use middle::ty::{mod, Ty};
25+
use middle::ty::{mod, Ty, FreeRegion};
2726
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
2827
use util::common::can_reach;
2928

@@ -33,7 +32,6 @@ use syntax::codemap::Span;
3332
use syntax::{ast, visit};
3433
use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
3534
use syntax::ast_util::{stmt_id};
36-
use syntax::ptr::P;
3735
use syntax::visit::{Visitor, FnKind};
3836

3937
/// CodeExtent represents a statically-describable extent that can be
@@ -824,11 +822,10 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor, local: &ast::Local) {
824822
match expr.node {
825823
ast::ExprAddrOf(_, ref subexpr) |
826824
ast::ExprUnary(ast::UnDeref, ref subexpr) |
827-
ast::ExprField(ref subexpr, _, _) |
828-
ast::ExprTupField(ref subexpr, _, _) |
825+
ast::ExprField(ref subexpr, _) |
826+
ast::ExprTupField(ref subexpr, _) |
829827
ast::ExprIndex(ref subexpr, _) |
830828
ast::ExprParen(ref subexpr) => {
831-
let subexpr: &'a P<Expr> = subexpr; // FIXME(#11586)
832829
expr = &**subexpr;
833830
}
834831
_ => {

src/librustc/middle/resolve.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,13 @@ use syntax::ast::{Variant, ViewItem, ViewItemExternCrate};
7171
use syntax::ast::{ViewItemUse, ViewPathGlob, ViewPathList, ViewPathSimple};
7272
use syntax::ast::{Visibility};
7373
use syntax::ast;
74-
use syntax::ast_util::{PostExpansionMethod, local_def, walk_pat};
75-
use syntax::ast_util;
74+
use syntax::ast_util::{mod, PostExpansionMethod, local_def, walk_pat};
7675
use syntax::attr::AttrMetaMethods;
7776
use syntax::ext::mtwt;
78-
use syntax::parse::token::special_names;
79-
use syntax::parse::token::special_idents;
80-
use syntax::parse::token;
77+
use syntax::parse::token::{mod, special_names, special_idents};
8178
use syntax::codemap::{Span, DUMMY_SP, Pos};
8279
use syntax::owned_slice::OwnedSlice;
83-
use syntax::visit;
84-
use syntax::visit::Visitor;
80+
use syntax::visit::{mod, Visitor};
8581

8682
use std::collections::{HashMap, HashSet};
8783
use std::collections::hash_map::{Occupied, Vacant};
@@ -5959,7 +5955,7 @@ impl<'a> Resolver<'a> {
59595955

59605956
fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &Expr) {
59615957
match expr.node {
5962-
ExprField(_, ident, _) => {
5958+
ExprField(_, ident) => {
59635959
// FIXME(#6890): Even though you can't treat a method like a
59645960
// field, we need to add any trait methods we find that match
59655961
// the field name so that we can do some nice error reporting

src/librustc/middle/typeck/check/method/confirm.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@
1010

1111
use super::probe;
1212

13-
use middle::subst;
14-
use middle::subst::Subst;
13+
use middle::subst::{mod, Subst};
1514
use middle::traits;
1615
use middle::ty::{mod, Ty};
17-
use middle::typeck::check;
18-
use middle::typeck::check::{FnCtxt, NoPreference, PreferMutLvalue};
16+
use middle::typeck::check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
1917
use middle::typeck::{MethodCall, MethodCallee, MethodObject, MethodOrigin,
2018
MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam};
21-
use middle::typeck::infer;
22-
use middle::typeck::infer::InferCtxt;
19+
use middle::typeck::infer::{mod, InferCtxt};
2320
use middle::ty_fold::HigherRankedFoldable;
2421
use syntax::ast;
2522
use syntax::codemap::Span;
@@ -510,8 +507,8 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
510507
let last = exprs[exprs.len() - 1];
511508
match last.node {
512509
ast::ExprParen(ref expr) |
513-
ast::ExprField(ref expr, _, _) |
514-
ast::ExprTupField(ref expr, _, _) |
510+
ast::ExprField(ref expr, _) |
511+
ast::ExprTupField(ref expr, _) |
515512
ast::ExprSlice(ref expr, _, _, _) |
516513
ast::ExprIndex(ref expr, _) |
517514
ast::ExprUnary(ast::UnDeref, ref expr) => exprs.push(&**expr),

0 commit comments

Comments
 (0)