Remove type parameters from ExprField and ExprTupField
This commit is contained in:
parent
9a857b4472
commit
35316972ff
23 changed files with 125 additions and 254 deletions
|
@ -37,22 +37,18 @@ use util::ppaux::{ty_to_string};
|
||||||
use util::nodemap::{FnvHashMap, NodeSet};
|
use util::nodemap::{FnvHashMap, NodeSet};
|
||||||
use lint::{Context, LintPass, LintArray};
|
use lint::{Context, LintPass, LintArray};
|
||||||
|
|
||||||
use std::cmp;
|
use std::{cmp, slice};
|
||||||
use std::collections::hash_map::{Occupied, Vacant};
|
use std::collections::hash_map::{Occupied, Vacant};
|
||||||
use std::num::SignedInt;
|
use std::num::SignedInt;
|
||||||
use std::slice;
|
|
||||||
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
|
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
|
||||||
use syntax::abi;
|
use syntax::{abi, ast, ast_map};
|
||||||
use syntax::ast_map;
|
use syntax::ast_util::{mod, is_shift_binop};
|
||||||
use syntax::ast_util::is_shift_binop;
|
use syntax::attr::{mod, AttrMetaMethods};
|
||||||
use syntax::attr::AttrMetaMethods;
|
|
||||||
use syntax::attr;
|
|
||||||
use syntax::codemap::{Span, DUMMY_SP};
|
use syntax::codemap::{Span, DUMMY_SP};
|
||||||
use syntax::parse::token;
|
use syntax::parse::token;
|
||||||
use syntax::{ast, ast_util, visit};
|
|
||||||
use syntax::ast::{TyI, TyU, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
|
use syntax::ast::{TyI, TyU, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::visit::Visitor;
|
use syntax::visit::{mod, Visitor};
|
||||||
|
|
||||||
declare_lint!(WHILE_TRUE, Warn,
|
declare_lint!(WHILE_TRUE, Warn,
|
||||||
"suggest using `loop { }` instead of `while true { }`")
|
"suggest using `loop { }` instead of `while true { }`")
|
||||||
|
@ -1112,8 +1108,8 @@ impl UnusedParens {
|
||||||
}
|
}
|
||||||
ast::ExprUnary(_, ref x) |
|
ast::ExprUnary(_, ref x) |
|
||||||
ast::ExprCast(ref x, _) |
|
ast::ExprCast(ref x, _) |
|
||||||
ast::ExprField(ref x, _, _) |
|
ast::ExprField(ref x, _) |
|
||||||
ast::ExprTupField(ref x, _, _) |
|
ast::ExprTupField(ref x, _) |
|
||||||
ast::ExprIndex(ref x, _) => {
|
ast::ExprIndex(ref x, _) => {
|
||||||
// &X { y: 1 }, X { y: 1 }.y
|
// &X { y: 1 }, X { y: 1 }.y
|
||||||
contains_exterior_struct_lit(&**x)
|
contains_exterior_struct_lit(&**x)
|
||||||
|
|
|
@ -475,8 +475,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||||
ast::ExprCast(ref e, _) |
|
ast::ExprCast(ref e, _) |
|
||||||
ast::ExprUnary(_, ref e) |
|
ast::ExprUnary(_, ref e) |
|
||||||
ast::ExprParen(ref e) |
|
ast::ExprParen(ref e) |
|
||||||
ast::ExprField(ref e, _, _) |
|
ast::ExprField(ref e, _) |
|
||||||
ast::ExprTupField(ref e, _, _) => {
|
ast::ExprTupField(ref e, _) => {
|
||||||
self.straightline(expr, pred, Some(&**e).into_iter())
|
self.straightline(expr, pred, Some(&**e).into_iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,19 +15,16 @@ pub use self::const_val::*;
|
||||||
pub use self::constness::*;
|
pub use self::constness::*;
|
||||||
|
|
||||||
use metadata::csearch;
|
use metadata::csearch;
|
||||||
use middle::astencode;
|
use middle::{astencode, def};
|
||||||
use middle::def;
|
|
||||||
use middle::pat_util::def_to_path;
|
use middle::pat_util::def_to_path;
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use middle::typeck::astconv;
|
use middle::typeck::{astconv, check};
|
||||||
use middle::typeck::check;
|
use util::nodemap::DefIdMap;
|
||||||
use util::nodemap::{DefIdMap};
|
|
||||||
|
|
||||||
use syntax::ast::{mod, Expr};
|
use syntax::ast::{mod, Expr};
|
||||||
use syntax::parse::token::InternedString;
|
use syntax::parse::token::InternedString;
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::visit::Visitor;
|
use syntax::visit::{mod, Visitor};
|
||||||
use syntax::visit;
|
|
||||||
use syntax::{ast_map, ast_util, codemap};
|
use syntax::{ast_map, ast_util, codemap};
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -234,9 +231,9 @@ impl<'a, 'tcx> ConstEvalVisitor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ExprField(ref base, _, _) => self.classify(&**base),
|
ast::ExprField(ref base, _) => self.classify(&**base),
|
||||||
|
|
||||||
ast::ExprTupField(ref base, _, _) => self.classify(&**base),
|
ast::ExprTupField(ref base, _) => self.classify(&**base),
|
||||||
|
|
||||||
ast::ExprIndex(ref base, ref idx) =>
|
ast::ExprIndex(ref base, ref idx) =>
|
||||||
join(self.classify(&**base), self.classify(&**idx)),
|
join(self.classify(&**base), self.classify(&**idx)),
|
||||||
|
|
|
@ -12,20 +12,14 @@
|
||||||
// closely. The idea is that all reachable symbols are live, codes called
|
// closely. The idea is that all reachable symbols are live, codes called
|
||||||
// from live codes are live, and everything else is dead.
|
// from live codes are live, and everything else is dead.
|
||||||
|
|
||||||
use middle::def;
|
use middle::{def, pat_util, privacy, ty, typeck};
|
||||||
use middle::pat_util;
|
|
||||||
use middle::privacy;
|
|
||||||
use middle::ty;
|
|
||||||
use middle::typeck;
|
|
||||||
use lint;
|
use lint;
|
||||||
use util::nodemap::NodeSet;
|
use util::nodemap::NodeSet;
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use syntax::ast;
|
use syntax::{ast, ast_map, codemap};
|
||||||
use syntax::ast_map;
|
|
||||||
use syntax::ast_util::{local_def, is_local, PostExpansionMethod};
|
use syntax::ast_util::{local_def, is_local, PostExpansionMethod};
|
||||||
use syntax::attr::{mod, AttrMetaMethods};
|
use syntax::attr::{mod, AttrMetaMethods};
|
||||||
use syntax::codemap;
|
|
||||||
use syntax::visit::{mod, Visitor};
|
use syntax::visit::{mod, Visitor};
|
||||||
|
|
||||||
// Any local node that may call something in its body block should be
|
// 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> {
|
||||||
ast::ExprMethodCall(..) => {
|
ast::ExprMethodCall(..) => {
|
||||||
self.lookup_and_handle_method(expr.id, expr.span);
|
self.lookup_and_handle_method(expr.id, expr.span);
|
||||||
}
|
}
|
||||||
ast::ExprField(ref lhs, ref ident, _) => {
|
ast::ExprField(ref lhs, ref ident) => {
|
||||||
self.handle_field_access(&**lhs, &ident.node);
|
self.handle_field_access(&**lhs, &ident.node);
|
||||||
}
|
}
|
||||||
ast::ExprTupField(ref lhs, idx, _) => {
|
ast::ExprTupField(ref lhs, idx) => {
|
||||||
self.handle_tup_field_access(&**lhs, idx.node);
|
self.handle_tup_field_access(&**lhs, idx.node);
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
|
|
@ -20,11 +20,9 @@ pub use self::ConsumeMode::*;
|
||||||
pub use self::MoveReason::*;
|
pub use self::MoveReason::*;
|
||||||
use self::OverloadedCallType::*;
|
use self::OverloadedCallType::*;
|
||||||
|
|
||||||
|
use middle::{def, region, pat_util};
|
||||||
use middle::mem_categorization as mc;
|
use middle::mem_categorization as mc;
|
||||||
use middle::def;
|
|
||||||
use middle::mem_categorization::Typer;
|
use middle::mem_categorization::Typer;
|
||||||
use middle::region;
|
|
||||||
use middle::pat_util;
|
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use middle::typeck::{MethodCall, MethodObject, MethodTraitObject};
|
use middle::typeck::{MethodCall, MethodObject, MethodTraitObject};
|
||||||
use middle::typeck::{MethodOrigin, MethodParam, MethodTypeParam};
|
use middle::typeck::{MethodOrigin, MethodParam, MethodTypeParam};
|
||||||
|
@ -331,11 +329,11 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ExprField(ref base, _, _) => { // base.f
|
ast::ExprField(ref base, _) => { // base.f
|
||||||
self.select_from_expr(&**base);
|
self.select_from_expr(&**base);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ExprTupField(ref base, _, _) => { // base.<n>
|
ast::ExprTupField(ref base, _) => { // base.<n>
|
||||||
self.select_from_expr(&**base);
|
self.select_from_expr(&**base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,24 +113,19 @@ use self::VarKind::*;
|
||||||
|
|
||||||
use middle::def::*;
|
use middle::def::*;
|
||||||
use middle::mem_categorization::Typer;
|
use middle::mem_categorization::Typer;
|
||||||
use middle::pat_util;
|
use middle::{pat_util, typeck, ty};
|
||||||
use middle::typeck;
|
|
||||||
use middle::ty;
|
|
||||||
use lint;
|
use lint;
|
||||||
use util::nodemap::NodeMap;
|
use util::nodemap::NodeMap;
|
||||||
|
|
||||||
use std::fmt;
|
use std::{fmt, io, uint};
|
||||||
use std::io;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::uint;
|
|
||||||
use syntax::ast::{mod, NodeId, Expr};
|
use syntax::ast::{mod, NodeId, Expr};
|
||||||
use syntax::codemap::{BytePos, original_sp, Span};
|
use syntax::codemap::{BytePos, original_sp, Span};
|
||||||
use syntax::parse::token::special_idents;
|
use syntax::parse::token::{mod, special_idents};
|
||||||
use syntax::parse::token;
|
|
||||||
use syntax::print::pprust::{expr_to_string, block_to_string};
|
use syntax::print::pprust::{expr_to_string, block_to_string};
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::{visit, ast_util};
|
use syntax::ast_util;
|
||||||
use syntax::visit::{Visitor, FnKind};
|
use syntax::visit::{mod, Visitor, FnKind};
|
||||||
|
|
||||||
/// For use with `propagate_through_loop`.
|
/// For use with `propagate_through_loop`.
|
||||||
enum LoopKind<'a> {
|
enum LoopKind<'a> {
|
||||||
|
@ -967,11 +962,11 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||||
self.access_path(expr, succ, ACC_READ | ACC_USE)
|
self.access_path(expr, succ, ACC_READ | ACC_USE)
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ExprField(ref e, _, _) => {
|
ast::ExprField(ref e, _) => {
|
||||||
self.propagate_through_expr(&**e, succ)
|
self.propagate_through_expr(&**e, succ)
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ExprTupField(ref e, _, _) => {
|
ast::ExprTupField(ref e, _) => {
|
||||||
self.propagate_through_expr(&**e, succ)
|
self.propagate_through_expr(&**e, succ)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,8 +1290,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||||
|
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ast::ExprPath(_) => succ,
|
ast::ExprPath(_) => succ,
|
||||||
ast::ExprField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
|
ast::ExprField(ref e, _) => self.propagate_through_expr(&**e, succ),
|
||||||
ast::ExprTupField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
|
ast::ExprTupField(ref e, _) => self.propagate_through_expr(&**e, succ),
|
||||||
_ => self.propagate_through_expr(expr, succ)
|
_ => self.propagate_through_expr(expr, succ)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
||||||
Ok(self.cat_deref(expr, base_cmt, 0, false))
|
Ok(self.cat_deref(expr, base_cmt, 0, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ExprField(ref base, f_name, _) => {
|
ast::ExprField(ref base, f_name) => {
|
||||||
let base_cmt = if_ok!(self.cat_expr(&**base));
|
let base_cmt = if_ok!(self.cat_expr(&**base));
|
||||||
debug!("cat_expr(cat_field): id={} expr={} base={}",
|
debug!("cat_expr(cat_field): id={} expr={} base={}",
|
||||||
expr.id,
|
expr.id,
|
||||||
|
@ -486,7 +486,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
||||||
Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
|
Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::ExprTupField(ref base, idx, _) => {
|
ast::ExprTupField(ref base, idx) => {
|
||||||
let base_cmt = if_ok!(self.cat_expr(&**base));
|
let base_cmt = if_ok!(self.cat_expr(&**base));
|
||||||
Ok(self.cat_tup_field(expr, base_cmt, idx.node, expr_ty))
|
Ok(self.cat_tup_field(expr, base_cmt, idx.node, expr_ty))
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,20 +17,17 @@ use self::FieldName::*;
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
|
|
||||||
use metadata::csearch;
|
use metadata::csearch;
|
||||||
use middle::def;
|
use middle::{def, resolve};
|
||||||
use middle::resolve;
|
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam};
|
use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam};
|
||||||
use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure, MethodObject, MethodTraitObject};
|
use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure, MethodObject, MethodTraitObject};
|
||||||
use util::nodemap::{NodeMap, NodeSet};
|
use util::nodemap::{NodeMap, NodeSet};
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::{ast, ast_map};
|
||||||
use syntax::ast_map;
|
|
||||||
use syntax::ast_util::{is_local, local_def, PostExpansionMethod};
|
use syntax::ast_util::{is_local, local_def, PostExpansionMethod};
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
use syntax::parse::token;
|
use syntax::parse::token;
|
||||||
use syntax::visit;
|
use syntax::visit::{mod, Visitor};
|
||||||
use syntax::visit::Visitor;
|
|
||||||
|
|
||||||
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap2);
|
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap2);
|
||||||
|
|
||||||
|
@ -836,20 +833,14 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
|
||||||
|
|
||||||
fn visit_expr(&mut self, expr: &ast::Expr) {
|
fn visit_expr(&mut self, expr: &ast::Expr) {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ast::ExprField(ref base, ident, _) => {
|
ast::ExprField(ref base, ident) => {
|
||||||
match ty::expr_ty_adjusted(self.tcx, &**base).sty {
|
if let ty::ty_struct(id, _) = ty::expr_ty_adjusted(self.tcx, &**base).sty {
|
||||||
ty::ty_struct(id, _) => {
|
self.check_field(expr.span, id, NamedField(ident.node));
|
||||||
self.check_field(expr.span, id, NamedField(ident.node));
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::ExprTupField(ref base, idx, _) => {
|
ast::ExprTupField(ref base, idx) => {
|
||||||
match ty::expr_ty_adjusted(self.tcx, &**base).sty {
|
if let ty::ty_struct(id, _) = ty::expr_ty_adjusted(self.tcx, &**base).sty {
|
||||||
ty::ty_struct(id, _) => {
|
self.check_field(expr.span, id, UnnamedField(idx.node));
|
||||||
self.check_field(expr.span, id, UnnamedField(idx.node));
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::ExprMethodCall(ident, _, _) => {
|
ast::ExprMethodCall(ident, _, _) => {
|
||||||
|
|
|
@ -22,8 +22,7 @@ Most of the documentation on regions can be found in
|
||||||
|
|
||||||
|
|
||||||
use session::Session;
|
use session::Session;
|
||||||
use middle::ty::{FreeRegion};
|
use middle::ty::{mod, Ty, FreeRegion};
|
||||||
use middle::ty::{mod, Ty};
|
|
||||||
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
|
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
|
||||||
use util::common::can_reach;
|
use util::common::can_reach;
|
||||||
|
|
||||||
|
@ -33,7 +32,6 @@ use syntax::codemap::Span;
|
||||||
use syntax::{ast, visit};
|
use syntax::{ast, visit};
|
||||||
use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
|
use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
|
||||||
use syntax::ast_util::{stmt_id};
|
use syntax::ast_util::{stmt_id};
|
||||||
use syntax::ptr::P;
|
|
||||||
use syntax::visit::{Visitor, FnKind};
|
use syntax::visit::{Visitor, FnKind};
|
||||||
|
|
||||||
/// CodeExtent represents a statically-describable extent that can be
|
/// CodeExtent represents a statically-describable extent that can be
|
||||||
|
@ -824,11 +822,10 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor, local: &ast::Local) {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ast::ExprAddrOf(_, ref subexpr) |
|
ast::ExprAddrOf(_, ref subexpr) |
|
||||||
ast::ExprUnary(ast::UnDeref, ref subexpr) |
|
ast::ExprUnary(ast::UnDeref, ref subexpr) |
|
||||||
ast::ExprField(ref subexpr, _, _) |
|
ast::ExprField(ref subexpr, _) |
|
||||||
ast::ExprTupField(ref subexpr, _, _) |
|
ast::ExprTupField(ref subexpr, _) |
|
||||||
ast::ExprIndex(ref subexpr, _) |
|
ast::ExprIndex(ref subexpr, _) |
|
||||||
ast::ExprParen(ref subexpr) => {
|
ast::ExprParen(ref subexpr) => {
|
||||||
let subexpr: &'a P<Expr> = subexpr; // FIXME(#11586)
|
|
||||||
expr = &**subexpr;
|
expr = &**subexpr;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -71,17 +71,13 @@ use syntax::ast::{Variant, ViewItem, ViewItemExternCrate};
|
||||||
use syntax::ast::{ViewItemUse, ViewPathGlob, ViewPathList, ViewPathSimple};
|
use syntax::ast::{ViewItemUse, ViewPathGlob, ViewPathList, ViewPathSimple};
|
||||||
use syntax::ast::{Visibility};
|
use syntax::ast::{Visibility};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ast_util::{PostExpansionMethod, local_def, walk_pat};
|
use syntax::ast_util::{mod, PostExpansionMethod, local_def, walk_pat};
|
||||||
use syntax::ast_util;
|
|
||||||
use syntax::attr::AttrMetaMethods;
|
use syntax::attr::AttrMetaMethods;
|
||||||
use syntax::ext::mtwt;
|
use syntax::ext::mtwt;
|
||||||
use syntax::parse::token::special_names;
|
use syntax::parse::token::{mod, special_names, special_idents};
|
||||||
use syntax::parse::token::special_idents;
|
|
||||||
use syntax::parse::token;
|
|
||||||
use syntax::codemap::{Span, DUMMY_SP, Pos};
|
use syntax::codemap::{Span, DUMMY_SP, Pos};
|
||||||
use syntax::owned_slice::OwnedSlice;
|
use syntax::owned_slice::OwnedSlice;
|
||||||
use syntax::visit;
|
use syntax::visit::{mod, Visitor};
|
||||||
use syntax::visit::Visitor;
|
|
||||||
|
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::collections::hash_map::{Occupied, Vacant};
|
use std::collections::hash_map::{Occupied, Vacant};
|
||||||
|
@ -5959,7 +5955,7 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &Expr) {
|
fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &Expr) {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ExprField(_, ident, _) => {
|
ExprField(_, ident) => {
|
||||||
// FIXME(#6890): Even though you can't treat a method like a
|
// FIXME(#6890): Even though you can't treat a method like a
|
||||||
// field, we need to add any trait methods we find that match
|
// field, we need to add any trait methods we find that match
|
||||||
// the field name so that we can do some nice error reporting
|
// the field name so that we can do some nice error reporting
|
||||||
|
|
|
@ -10,16 +10,13 @@
|
||||||
|
|
||||||
use super::probe;
|
use super::probe;
|
||||||
|
|
||||||
use middle::subst;
|
use middle::subst::{mod, Subst};
|
||||||
use middle::subst::Subst;
|
|
||||||
use middle::traits;
|
use middle::traits;
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use middle::typeck::check;
|
use middle::typeck::check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
|
||||||
use middle::typeck::check::{FnCtxt, NoPreference, PreferMutLvalue};
|
|
||||||
use middle::typeck::{MethodCall, MethodCallee, MethodObject, MethodOrigin,
|
use middle::typeck::{MethodCall, MethodCallee, MethodObject, MethodOrigin,
|
||||||
MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam};
|
MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam};
|
||||||
use middle::typeck::infer;
|
use middle::typeck::infer::{mod, InferCtxt};
|
||||||
use middle::typeck::infer::InferCtxt;
|
|
||||||
use middle::ty_fold::HigherRankedFoldable;
|
use middle::ty_fold::HigherRankedFoldable;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::codemap::Span;
|
use syntax::codemap::Span;
|
||||||
|
@ -510,8 +507,8 @@ impl<'a,'tcx> ConfirmContext<'a,'tcx> {
|
||||||
let last = exprs[exprs.len() - 1];
|
let last = exprs[exprs.len() - 1];
|
||||||
match last.node {
|
match last.node {
|
||||||
ast::ExprParen(ref expr) |
|
ast::ExprParen(ref expr) |
|
||||||
ast::ExprField(ref expr, _, _) |
|
ast::ExprField(ref expr, _) |
|
||||||
ast::ExprTupField(ref expr, _, _) |
|
ast::ExprTupField(ref expr, _) |
|
||||||
ast::ExprSlice(ref expr, _, _, _) |
|
ast::ExprSlice(ref expr, _, _, _) |
|
||||||
ast::ExprIndex(ref expr, _) |
|
ast::ExprIndex(ref expr, _) |
|
||||||
ast::ExprUnary(ast::UnDeref, ref expr) => exprs.push(&**expr),
|
ast::ExprUnary(ast::UnDeref, ref expr) => exprs.push(&**expr),
|
||||||
|
|
|
@ -83,62 +83,41 @@ use self::IsBinopAssignment::*;
|
||||||
use self::TupleArgumentsFlag::*;
|
use self::TupleArgumentsFlag::*;
|
||||||
|
|
||||||
use session::Session;
|
use session::Session;
|
||||||
use middle::const_eval;
|
use middle::{const_eval, def, traits};
|
||||||
use middle::def;
|
|
||||||
use middle::lang_items::IteratorItem;
|
use middle::lang_items::IteratorItem;
|
||||||
use middle::mem_categorization::McResult;
|
use middle::mem_categorization::{mod, McResult};
|
||||||
use middle::mem_categorization;
|
use middle::pat_util::{mod, pat_id_map};
|
||||||
use middle::pat_util::pat_id_map;
|
|
||||||
use middle::pat_util;
|
|
||||||
use middle::region::CodeExtent;
|
use middle::region::CodeExtent;
|
||||||
use middle::subst;
|
use middle::subst::{mod, Subst, Substs, VecPerParamSpace, ParamSpace};
|
||||||
use middle::subst::{Subst, Substs, VecPerParamSpace, ParamSpace};
|
use middle::ty::{FnSig, VariantInfo, Polytype};
|
||||||
use middle::traits;
|
|
||||||
use middle::ty::{FnSig, VariantInfo};
|
|
||||||
use middle::ty::{Polytype};
|
|
||||||
use middle::ty::{Disr, ParamTy, ParameterEnvironment};
|
use middle::ty::{Disr, ParamTy, ParameterEnvironment};
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use middle::ty::liberate_late_bound_regions;
|
use middle::ty::liberate_late_bound_regions;
|
||||||
use middle::ty_fold::TypeFolder;
|
use middle::ty_fold::TypeFolder;
|
||||||
use middle::typeck::astconv::AstConv;
|
use middle::typeck::astconv::{mod, ast_region_to_region, ast_ty_to_ty, AstConv};
|
||||||
use middle::typeck::astconv::{ast_region_to_region, ast_ty_to_ty};
|
|
||||||
use middle::typeck::astconv;
|
|
||||||
use middle::typeck::check::_match::pat_ctxt;
|
use middle::typeck::check::_match::pat_ctxt;
|
||||||
use middle::typeck::CrateCtxt;
|
|
||||||
use middle::typeck::infer;
|
|
||||||
use middle::typeck::rscope::RegionScope;
|
use middle::typeck::rscope::RegionScope;
|
||||||
use middle::typeck::{lookup_def_ccx};
|
use middle::typeck::{mod, CrateCtxt, infer, lookup_def_ccx, no_params, require_same_types};
|
||||||
use middle::typeck::no_params;
|
use middle::typeck::{MethodCall, MethodCallee, MethodMap, ObjectCastMap, TypeAndSubsts};
|
||||||
use middle::typeck::{require_same_types};
|
|
||||||
use middle::typeck::{MethodCall, MethodCallee, MethodMap, ObjectCastMap};
|
|
||||||
use middle::typeck::{TypeAndSubsts};
|
|
||||||
use middle::typeck;
|
|
||||||
use middle::lang_items::TypeIdLangItem;
|
use middle::lang_items::TypeIdLangItem;
|
||||||
use lint;
|
use lint;
|
||||||
use util::common::{block_query, indenter, loop_query};
|
use util::common::{block_query, indenter, loop_query};
|
||||||
use util::ppaux;
|
use util::ppaux::{mod, UserString, Repr};
|
||||||
use util::ppaux::{UserString, Repr};
|
|
||||||
use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
|
use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
|
||||||
|
|
||||||
use std::cell::{Cell, Ref, RefCell};
|
use std::cell::{Cell, Ref, RefCell};
|
||||||
use std::collections::hash_map::{Occupied, Vacant};
|
use std::collections::hash_map::{Occupied, Vacant};
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use syntax::abi;
|
use syntax::{mod, abi, attr};
|
||||||
use syntax::ast::{ProvidedMethod, RequiredMethod, TypeTraitItem};
|
use syntax::ast::{mod, ProvidedMethod, RequiredMethod, TypeTraitItem};
|
||||||
use syntax::ast;
|
use syntax::ast_util::{mod, local_def, PostExpansionMethod};
|
||||||
use syntax::ast_util::{local_def, PostExpansionMethod};
|
use syntax::codemap::{mod, Span};
|
||||||
use syntax::ast_util;
|
|
||||||
use syntax::attr;
|
|
||||||
use syntax::codemap::Span;
|
|
||||||
use syntax::codemap;
|
|
||||||
use syntax::owned_slice::OwnedSlice;
|
use syntax::owned_slice::OwnedSlice;
|
||||||
use syntax::parse::token;
|
use syntax::parse::token;
|
||||||
use syntax::print::pprust;
|
use syntax::print::pprust;
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::visit;
|
use syntax::visit::{mod, Visitor};
|
||||||
use syntax::visit::Visitor;
|
|
||||||
use syntax;
|
|
||||||
|
|
||||||
pub mod _match;
|
pub mod _match;
|
||||||
pub mod vtable;
|
pub mod vtable;
|
||||||
|
@ -4405,10 +4384,10 @@ fn check_expr_with_unifier<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
||||||
|
|
||||||
fcx.require_expr_have_sized_type(expr, traits::StructInitializerSized);
|
fcx.require_expr_have_sized_type(expr, traits::StructInitializerSized);
|
||||||
}
|
}
|
||||||
ast::ExprField(ref base, ref field, _) => {
|
ast::ExprField(ref base, ref field) => {
|
||||||
check_field(fcx, expr, lvalue_pref, &**base, field);
|
check_field(fcx, expr, lvalue_pref, &**base, field);
|
||||||
}
|
}
|
||||||
ast::ExprTupField(ref base, idx, _) => {
|
ast::ExprTupField(ref base, idx) => {
|
||||||
check_tup_field(fcx, expr, lvalue_pref, &**base, idx);
|
check_tup_field(fcx, expr, lvalue_pref, &**base, idx);
|
||||||
}
|
}
|
||||||
ast::ExprIndex(ref base, ref idx) => {
|
ast::ExprIndex(ref base, ref idx) => {
|
||||||
|
|
|
@ -278,8 +278,8 @@ mod svh_visitor {
|
||||||
ExprBlock(..) => SawExprBlock,
|
ExprBlock(..) => SawExprBlock,
|
||||||
ExprAssign(..) => SawExprAssign,
|
ExprAssign(..) => SawExprAssign,
|
||||||
ExprAssignOp(op, _, _) => SawExprAssignOp(op),
|
ExprAssignOp(op, _, _) => SawExprAssignOp(op),
|
||||||
ExprField(_, id, _) => SawExprField(content(id.node)),
|
ExprField(_, id) => SawExprField(content(id.node)),
|
||||||
ExprTupField(_, id, _) => SawExprTupField(id.node),
|
ExprTupField(_, id) => SawExprTupField(id.node),
|
||||||
ExprIndex(..) => SawExprIndex,
|
ExprIndex(..) => SawExprIndex,
|
||||||
ExprSlice(..) => SawExprSlice,
|
ExprSlice(..) => SawExprSlice,
|
||||||
ExprPath(..) => SawExprPath,
|
ExprPath(..) => SawExprPath,
|
||||||
|
|
|
@ -30,34 +30,26 @@
|
||||||
use driver::driver::CrateAnalysis;
|
use driver::driver::CrateAnalysis;
|
||||||
use session::Session;
|
use session::Session;
|
||||||
|
|
||||||
use middle::def;
|
use middle::{def, typeck};
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use middle::typeck;
|
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::io;
|
use std::io::{mod, File, fs};
|
||||||
use std::io::File;
|
|
||||||
use std::io::fs;
|
|
||||||
use std::os;
|
use std::os;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast_util::{mod, PostExpansionMethod};
|
||||||
use syntax::ast_util;
|
use syntax::ast::{mod, NodeId, DefId};
|
||||||
use syntax::ast_util::PostExpansionMethod;
|
|
||||||
use syntax::ast::{NodeId,DefId};
|
|
||||||
use syntax::ast_map::NodeItem;
|
use syntax::ast_map::NodeItem;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::codemap::*;
|
use syntax::codemap::*;
|
||||||
use syntax::parse::token;
|
use syntax::parse::token::{mod, get_ident, keywords};
|
||||||
use syntax::parse::token::{get_ident,keywords};
|
|
||||||
use syntax::owned_slice::OwnedSlice;
|
use syntax::owned_slice::OwnedSlice;
|
||||||
use syntax::visit;
|
use syntax::visit::{mod, Visitor};
|
||||||
use syntax::visit::Visitor;
|
|
||||||
use syntax::print::pprust::{path_to_string,ty_to_string};
|
use syntax::print::pprust::{path_to_string,ty_to_string};
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
|
|
||||||
use self::span_utils::SpanUtils;
|
use self::span_utils::SpanUtils;
|
||||||
use self::recorder::Recorder;
|
use self::recorder::{Recorder, FmtStrs};
|
||||||
use self::recorder::FmtStrs;
|
|
||||||
|
|
||||||
use util::ppaux;
|
use util::ppaux;
|
||||||
|
|
||||||
|
@ -1293,7 +1285,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
|
||||||
ast::ExprStruct(ref path, ref fields, ref base) =>
|
ast::ExprStruct(ref path, ref fields, ref base) =>
|
||||||
self.process_struct_lit(ex, path, fields, base),
|
self.process_struct_lit(ex, path, fields, base),
|
||||||
ast::ExprMethodCall(_, _, ref args) => self.process_method_call(ex, args),
|
ast::ExprMethodCall(_, _, ref args) => self.process_method_call(ex, args),
|
||||||
ast::ExprField(ref sub_ex, ident, _) => {
|
ast::ExprField(ref sub_ex, ident) => {
|
||||||
if generated_code(sub_ex.span) {
|
if generated_code(sub_ex.span) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1319,7 +1311,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DxrVisitor<'l, 'tcx> {
|
||||||
"Expected struct type, but not ty_struct"),
|
"Expected struct type, but not ty_struct"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ast::ExprTupField(ref sub_ex, idx, _) => {
|
ast::ExprTupField(ref sub_ex, idx) => {
|
||||||
if generated_code(sub_ex.span) {
|
if generated_code(sub_ex.span) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,22 +13,14 @@ use back::abi;
|
||||||
use llvm;
|
use llvm;
|
||||||
use llvm::{ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, True, False};
|
use llvm::{ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, True, False};
|
||||||
use llvm::{IntEQ, IntNE, IntUGT, IntUGE, IntULT, IntULE, IntSGT, IntSGE, IntSLT, IntSLE,
|
use llvm::{IntEQ, IntNE, IntUGT, IntUGE, IntULT, IntULE, IntSGT, IntSGE, IntSLT, IntSLE,
|
||||||
RealOEQ, RealOGT, RealOGE, RealOLT, RealOLE, RealONE};
|
RealOEQ, RealOGT, RealOGE, RealOLT, RealOLE, RealONE};
|
||||||
use metadata::csearch;
|
use metadata::csearch;
|
||||||
use middle::const_eval;
|
use middle::{const_eval, def};
|
||||||
use middle::def;
|
use trans::{adt, closure, consts, debuginfo, expr, inline, machine};
|
||||||
use trans::adt;
|
use trans::base::{mod, push_ctxt};
|
||||||
use trans::base;
|
|
||||||
use trans::base::push_ctxt;
|
|
||||||
use trans::closure;
|
|
||||||
use trans::common::*;
|
use trans::common::*;
|
||||||
use trans::consts;
|
|
||||||
use trans::expr;
|
|
||||||
use trans::inline;
|
|
||||||
use trans::machine;
|
|
||||||
use trans::type_::Type;
|
use trans::type_::Type;
|
||||||
use trans::type_of;
|
use trans::type_of;
|
||||||
use trans::debuginfo;
|
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use util::ppaux::{Repr, ty_to_string};
|
use util::ppaux::{Repr, ty_to_string};
|
||||||
|
|
||||||
|
@ -418,7 +410,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast::ExprField(ref base, field, _) => {
|
ast::ExprField(ref base, field) => {
|
||||||
let (bv, bt) = const_expr(cx, &**base);
|
let (bv, bt) = const_expr(cx, &**base);
|
||||||
let brepr = adt::represent_type(cx, bt);
|
let brepr = adt::represent_type(cx, bt);
|
||||||
expr::with_field_tys(cx.tcx(), bt, None, |discr, field_tys| {
|
expr::with_field_tys(cx.tcx(), bt, None, |discr, field_tys| {
|
||||||
|
@ -426,7 +418,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
|
||||||
adt::const_get_field(cx, &*brepr, bv, discr, ix)
|
adt::const_get_field(cx, &*brepr, bv, discr, ix)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ast::ExprTupField(ref base, idx, _) => {
|
ast::ExprTupField(ref base, idx) => {
|
||||||
let (bv, bt) = const_expr(cx, &**base);
|
let (bv, bt) = const_expr(cx, &**base);
|
||||||
let brepr = adt::represent_type(cx, bt);
|
let brepr = adt::represent_type(cx, bt);
|
||||||
expr::with_field_tys(cx.tcx(), bt, None, |discr, _| {
|
expr::with_field_tys(cx.tcx(), bt, None, |discr, _| {
|
||||||
|
|
|
@ -197,13 +197,10 @@ use llvm::{ModuleRef, ContextRef, ValueRef};
|
||||||
use llvm::debuginfo::*;
|
use llvm::debuginfo::*;
|
||||||
use metadata::csearch;
|
use metadata::csearch;
|
||||||
use middle::subst::{mod, Subst, Substs};
|
use middle::subst::{mod, Subst, Substs};
|
||||||
use trans::adt;
|
use trans::{mod, adt, machine, type_of};
|
||||||
use trans::common::*;
|
use trans::common::*;
|
||||||
use trans::machine;
|
|
||||||
use trans::_match::{BindingInfo, TrByCopy, TrByMove, TrByRef};
|
use trans::_match::{BindingInfo, TrByCopy, TrByMove, TrByRef};
|
||||||
use trans::type_of;
|
|
||||||
use trans::type_::Type;
|
use trans::type_::Type;
|
||||||
use trans;
|
|
||||||
use middle::ty::{mod, Ty};
|
use middle::ty::{mod, Ty};
|
||||||
use middle::pat_util;
|
use middle::pat_util;
|
||||||
use session::config::{mod, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
|
use session::config::{mod, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
|
||||||
|
@ -219,8 +216,7 @@ use syntax::util::interner::Interner;
|
||||||
use syntax::codemap::{Span, Pos};
|
use syntax::codemap::{Span, Pos};
|
||||||
use syntax::{ast, codemap, ast_util, ast_map};
|
use syntax::{ast, codemap, ast_util, ast_map};
|
||||||
use syntax::ast_util::PostExpansionMethod;
|
use syntax::ast_util::PostExpansionMethod;
|
||||||
use syntax::parse::token;
|
use syntax::parse::token::{mod, special_idents};
|
||||||
use syntax::parse::token::special_idents;
|
|
||||||
|
|
||||||
static DW_LANG_RUST: c_uint = 0x9000;
|
static DW_LANG_RUST: c_uint = 0x9000;
|
||||||
|
|
||||||
|
@ -3456,8 +3452,8 @@ fn populate_scope_map(cx: &CrateContext,
|
||||||
|
|
||||||
ast::ExprCast(ref sub_exp, _) |
|
ast::ExprCast(ref sub_exp, _) |
|
||||||
ast::ExprAddrOf(_, ref sub_exp) |
|
ast::ExprAddrOf(_, ref sub_exp) |
|
||||||
ast::ExprField(ref sub_exp, _, _) |
|
ast::ExprField(ref sub_exp, _) |
|
||||||
ast::ExprTupField(ref sub_exp, _, _) |
|
ast::ExprTupField(ref sub_exp, _) |
|
||||||
ast::ExprParen(ref sub_exp) =>
|
ast::ExprParen(ref sub_exp) =>
|
||||||
walk_expr(cx, &**sub_exp, scope_stack, scope_map),
|
walk_expr(cx, &**sub_exp, scope_stack, scope_map),
|
||||||
|
|
||||||
|
|
|
@ -38,47 +38,26 @@ pub use self::Dest::*;
|
||||||
use self::lazy_binop_ty::*;
|
use self::lazy_binop_ty::*;
|
||||||
|
|
||||||
use back::abi;
|
use back::abi;
|
||||||
use llvm;
|
use llvm::{mod, ValueRef};
|
||||||
use llvm::{ValueRef};
|
|
||||||
use middle::def;
|
use middle::def;
|
||||||
use middle::mem_categorization::Typer;
|
use middle::mem_categorization::Typer;
|
||||||
use middle::subst;
|
use middle::subst::{mod, Subst};
|
||||||
use middle::subst::Subst;
|
use trans::{_match, adt, asm, base, callee, closure, consts, controlflow};
|
||||||
use trans::_match;
|
use trans::{debuginfo, glue, machine, meth, inline, tvec, type_of};
|
||||||
use trans::adt;
|
|
||||||
use trans::asm;
|
|
||||||
use trans::base::*;
|
use trans::base::*;
|
||||||
use trans::base;
|
|
||||||
use trans::build::*;
|
use trans::build::*;
|
||||||
use trans::callee;
|
use trans::cleanup::{mod, CleanupMethods};
|
||||||
use trans::cleanup;
|
|
||||||
use trans::cleanup::CleanupMethods;
|
|
||||||
use trans::closure;
|
|
||||||
use trans::common::*;
|
use trans::common::*;
|
||||||
use trans::consts;
|
|
||||||
use trans::controlflow;
|
|
||||||
use trans::datum::*;
|
use trans::datum::*;
|
||||||
use trans::debuginfo;
|
use middle::ty::{mod, struct_fields, tup_fields};
|
||||||
use trans::glue;
|
use middle::ty::{AdjustDerefRef, AdjustAddEnv, AutoUnsafe, AutoPtr, Ty};
|
||||||
use trans::machine;
|
use middle::typeck::{mod, MethodCall};
|
||||||
use trans::meth;
|
|
||||||
use trans::inline;
|
|
||||||
use trans::tvec;
|
|
||||||
use trans::type_of;
|
|
||||||
use middle::ty::{struct_fields, tup_fields};
|
|
||||||
use middle::ty::{AdjustDerefRef, AdjustAddEnv, AutoUnsafe};
|
|
||||||
use middle::ty::{AutoPtr};
|
|
||||||
use middle::ty::{mod, Ty};
|
|
||||||
use middle::typeck;
|
|
||||||
use middle::typeck::MethodCall;
|
|
||||||
use util::common::indenter;
|
use util::common::indenter;
|
||||||
use util::ppaux::Repr;
|
use util::ppaux::Repr;
|
||||||
use trans::machine::{llsize_of, llsize_of_alloc};
|
use trans::machine::{llsize_of, llsize_of_alloc};
|
||||||
use trans::type_::Type;
|
use trans::type_::Type;
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::{ast, ast_util, codemap};
|
||||||
use syntax::ast_util;
|
|
||||||
use syntax::codemap;
|
|
||||||
use syntax::print::pprust::{expr_to_string};
|
use syntax::print::pprust::{expr_to_string};
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -599,10 +578,10 @@ fn trans_datum_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
ast::ExprPath(_) => {
|
ast::ExprPath(_) => {
|
||||||
trans_def(bcx, expr, bcx.def(expr.id))
|
trans_def(bcx, expr, bcx.def(expr.id))
|
||||||
}
|
}
|
||||||
ast::ExprField(ref base, ident, _) => {
|
ast::ExprField(ref base, ident) => {
|
||||||
trans_rec_field(bcx, &**base, ident.node)
|
trans_rec_field(bcx, &**base, ident.node)
|
||||||
}
|
}
|
||||||
ast::ExprTupField(ref base, idx, _) => {
|
ast::ExprTupField(ref base, idx) => {
|
||||||
trans_rec_tup_field(bcx, &**base, idx.node)
|
trans_rec_tup_field(bcx, &**base, idx.node)
|
||||||
}
|
}
|
||||||
ast::ExprIndex(ref base, ref idx) => {
|
ast::ExprIndex(ref base, ref idx) => {
|
||||||
|
|
|
@ -673,8 +673,8 @@ pub enum Expr_ {
|
||||||
|
|
||||||
ExprAssign(P<Expr>, P<Expr>),
|
ExprAssign(P<Expr>, P<Expr>),
|
||||||
ExprAssignOp(BinOp, P<Expr>, P<Expr>),
|
ExprAssignOp(BinOp, P<Expr>, P<Expr>),
|
||||||
ExprField(P<Expr>, SpannedIdent, Vec<P<Ty>>),
|
ExprField(P<Expr>, SpannedIdent),
|
||||||
ExprTupField(P<Expr>, Spanned<uint>, Vec<P<Ty>>),
|
ExprTupField(P<Expr>, Spanned<uint>),
|
||||||
ExprIndex(P<Expr>, P<Expr>),
|
ExprIndex(P<Expr>, P<Expr>),
|
||||||
ExprSlice(P<Expr>, Option<P<Expr>>, Option<P<Expr>>, Mutability),
|
ExprSlice(P<Expr>, Option<P<Expr>>, Option<P<Expr>>, Mutability),
|
||||||
|
|
||||||
|
|
|
@ -577,7 +577,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let id = Spanned { node: ident, span: field_span };
|
let id = Spanned { node: ident, span: field_span };
|
||||||
self.expr(sp, ast::ExprField(expr, id, Vec::new()))
|
self.expr(sp, ast::ExprField(expr, id))
|
||||||
}
|
}
|
||||||
fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>, idx: uint) -> P<ast::Expr> {
|
fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>, idx: uint) -> P<ast::Expr> {
|
||||||
let field_span = Span {
|
let field_span = Span {
|
||||||
|
@ -587,7 +587,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let id = Spanned { node: idx, span: field_span };
|
let id = Spanned { node: idx, span: field_span };
|
||||||
self.expr(sp, ast::ExprTupField(expr, id, Vec::new()))
|
self.expr(sp, ast::ExprTupField(expr, id))
|
||||||
}
|
}
|
||||||
fn expr_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
|
fn expr_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
|
||||||
self.expr(sp, ast::ExprAddrOf(ast::MutImmutable, e))
|
self.expr(sp, ast::ExprAddrOf(ast::MutImmutable, e))
|
||||||
|
|
|
@ -1345,15 +1345,13 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span}: Expr, folder: &mut T) ->
|
||||||
folder.fold_expr(el),
|
folder.fold_expr(el),
|
||||||
folder.fold_expr(er))
|
folder.fold_expr(er))
|
||||||
}
|
}
|
||||||
ExprField(el, ident, tys) => {
|
ExprField(el, ident) => {
|
||||||
ExprField(folder.fold_expr(el),
|
ExprField(folder.fold_expr(el),
|
||||||
respan(ident.span, folder.fold_ident(ident.node)),
|
respan(ident.span, folder.fold_ident(ident.node)))
|
||||||
tys.move_map(|x| folder.fold_ty(x)))
|
|
||||||
}
|
}
|
||||||
ExprTupField(el, ident, tys) => {
|
ExprTupField(el, ident) => {
|
||||||
ExprTupField(folder.fold_expr(el),
|
ExprTupField(folder.fold_expr(el),
|
||||||
respan(ident.span, folder.fold_uint(ident.node)),
|
respan(ident.span, folder.fold_uint(ident.node)))
|
||||||
tys.move_map(|x| folder.fold_ty(x)))
|
|
||||||
}
|
}
|
||||||
ExprIndex(el, er) => {
|
ExprIndex(el, er) => {
|
||||||
ExprIndex(folder.fold_expr(el), folder.fold_expr(er))
|
ExprIndex(folder.fold_expr(el), folder.fold_expr(er))
|
||||||
|
|
|
@ -71,14 +71,11 @@ use ext::tt::macro_parser;
|
||||||
use parse;
|
use parse;
|
||||||
use parse::attr::ParserAttr;
|
use parse::attr::ParserAttr;
|
||||||
use parse::classify;
|
use parse::classify;
|
||||||
use parse::common::{SeqSep, seq_sep_none};
|
use parse::common::{SeqSep, seq_sep_none, seq_sep_trailing_allowed};
|
||||||
use parse::common::{seq_sep_trailing_allowed};
|
use parse::lexer::{Reader, TokenAndSpan};
|
||||||
use parse::lexer::Reader;
|
|
||||||
use parse::lexer::TokenAndSpan;
|
|
||||||
use parse::obsolete::*;
|
use parse::obsolete::*;
|
||||||
use parse::token::{MatchNt, SubstNt, InternedString};
|
use parse::token::{mod, MatchNt, SubstNt, InternedString};
|
||||||
use parse::token::{keywords, special_idents};
|
use parse::token::{keywords, special_idents};
|
||||||
use parse::token;
|
|
||||||
use parse::{new_sub_parser_from_file, ParseSess};
|
use parse::{new_sub_parser_from_file, ParseSess};
|
||||||
use print::pprust;
|
use print::pprust;
|
||||||
use ptr::P;
|
use ptr::P;
|
||||||
|
@ -86,7 +83,6 @@ use owned_slice::OwnedSlice;
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::io::fs::PathExtensions;
|
use std::io::fs::PathExtensions;
|
||||||
use std::mem::replace;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::num::Float;
|
use std::num::Float;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -912,7 +908,7 @@ impl<'a> Parser<'a> {
|
||||||
tok: token::Underscore,
|
tok: token::Underscore,
|
||||||
sp: self.span,
|
sp: self.span,
|
||||||
};
|
};
|
||||||
replace(&mut self.buffer[buffer_start], placeholder)
|
mem::replace(&mut self.buffer[buffer_start], placeholder)
|
||||||
};
|
};
|
||||||
self.span = next.sp;
|
self.span = next.sp;
|
||||||
self.token = next.tok;
|
self.token = next.tok;
|
||||||
|
@ -921,7 +917,7 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
/// Advance the parser by one token and return the bumped token.
|
/// Advance the parser by one token and return the bumped token.
|
||||||
pub fn bump_and_get(&mut self) -> token::Token {
|
pub fn bump_and_get(&mut self) -> token::Token {
|
||||||
let old_token = replace(&mut self.token, token::Underscore);
|
let old_token = mem::replace(&mut self.token, token::Underscore);
|
||||||
self.bump();
|
self.bump();
|
||||||
old_token
|
old_token
|
||||||
}
|
}
|
||||||
|
@ -2100,14 +2096,12 @@ impl<'a> Parser<'a> {
|
||||||
ExprSlice(expr, start, end, mutbl)
|
ExprSlice(expr, start, end, mutbl)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mk_field(&mut self, expr: P<Expr>, ident: ast::SpannedIdent,
|
pub fn mk_field(&mut self, expr: P<Expr>, ident: ast::SpannedIdent) -> ast::Expr_ {
|
||||||
tys: Vec<P<Ty>>) -> ast::Expr_ {
|
ExprField(expr, ident)
|
||||||
ExprField(expr, ident, tys)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mk_tup_field(&mut self, expr: P<Expr>, idx: codemap::Spanned<uint>,
|
pub fn mk_tup_field(&mut self, expr: P<Expr>, idx: codemap::Spanned<uint>) -> ast::Expr_ {
|
||||||
tys: Vec<P<Ty>>) -> ast::Expr_ {
|
ExprTupField(expr, idx)
|
||||||
ExprTupField(expr, idx, tys)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mk_assign_op(&mut self, binop: ast::BinOp,
|
pub fn mk_assign_op(&mut self, binop: ast::BinOp,
|
||||||
|
@ -2462,7 +2456,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = spanned(dot, hi, i);
|
let id = spanned(dot, hi, i);
|
||||||
let field = self.mk_field(e, id, tys);
|
let field = self.mk_field(e, id);
|
||||||
e = self.mk_expr(lo, hi, field);
|
e = self.mk_expr(lo, hi, field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2481,7 +2475,7 @@ impl<'a> Parser<'a> {
|
||||||
match index {
|
match index {
|
||||||
Some(n) => {
|
Some(n) => {
|
||||||
let id = spanned(dot, hi, n);
|
let id = spanned(dot, hi, n);
|
||||||
let field = self.mk_tup_field(e, id, Vec::new());
|
let field = self.mk_tup_field(e, id);
|
||||||
e = self.mk_expr(lo, hi, field);
|
e = self.mk_expr(lo, hi, field);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -1734,29 +1734,15 @@ impl<'a> State<'a> {
|
||||||
try!(self.word_space("="));
|
try!(self.word_space("="));
|
||||||
try!(self.print_expr(&**rhs));
|
try!(self.print_expr(&**rhs));
|
||||||
}
|
}
|
||||||
ast::ExprField(ref expr, id, ref tys) => {
|
ast::ExprField(ref expr, id) => {
|
||||||
try!(self.print_expr(&**expr));
|
try!(self.print_expr(&**expr));
|
||||||
try!(word(&mut self.s, "."));
|
try!(word(&mut self.s, "."));
|
||||||
try!(self.print_ident(id.node));
|
try!(self.print_ident(id.node));
|
||||||
if tys.len() > 0u {
|
|
||||||
try!(word(&mut self.s, "::<"));
|
|
||||||
try!(self.commasep(
|
|
||||||
Inconsistent, tys.as_slice(),
|
|
||||||
|s, ty| s.print_type(&**ty)));
|
|
||||||
try!(word(&mut self.s, ">"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ast::ExprTupField(ref expr, id, ref tys) => {
|
ast::ExprTupField(ref expr, id) => {
|
||||||
try!(self.print_expr(&**expr));
|
try!(self.print_expr(&**expr));
|
||||||
try!(word(&mut self.s, "."));
|
try!(word(&mut self.s, "."));
|
||||||
try!(self.print_uint(id.node));
|
try!(self.print_uint(id.node));
|
||||||
if tys.len() > 0u {
|
|
||||||
try!(word(&mut self.s, "::<"));
|
|
||||||
try!(self.commasep(
|
|
||||||
Inconsistent, tys.as_slice(),
|
|
||||||
|s, ty| s.print_type(&**ty)));
|
|
||||||
try!(word(&mut self.s, ">"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ast::ExprIndex(ref expr, ref index) => {
|
ast::ExprIndex(ref expr, ref index) => {
|
||||||
try!(self.print_expr(&**expr));
|
try!(self.print_expr(&**expr));
|
||||||
|
|
|
@ -838,17 +838,11 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
|
||||||
visitor.visit_expr(&**right_expression);
|
visitor.visit_expr(&**right_expression);
|
||||||
visitor.visit_expr(&**left_expression)
|
visitor.visit_expr(&**left_expression)
|
||||||
}
|
}
|
||||||
ExprField(ref subexpression, _, ref types) => {
|
ExprField(ref subexpression, _) => {
|
||||||
visitor.visit_expr(&**subexpression);
|
visitor.visit_expr(&**subexpression);
|
||||||
for typ in types.iter() {
|
|
||||||
visitor.visit_ty(&**typ)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ExprTupField(ref subexpression, _, ref types) => {
|
ExprTupField(ref subexpression, _) => {
|
||||||
visitor.visit_expr(&**subexpression);
|
visitor.visit_expr(&**subexpression);
|
||||||
for typ in types.iter() {
|
|
||||||
visitor.visit_ty(&**typ)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ExprIndex(ref main_expression, ref index_expression) => {
|
ExprIndex(ref main_expression, ref index_expression) => {
|
||||||
visitor.visit_expr(&**main_expression);
|
visitor.visit_expr(&**main_expression);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue