Skip to content

Commit

Permalink
Replace _, _, _ with ..
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Sep 4, 2016
1 parent 1ca1de6 commit 6f7e51e
Show file tree
Hide file tree
Showing 50 changed files with 117 additions and 103 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/def.rs
Expand Up @@ -124,7 +124,7 @@ impl Def {
Def::Variant(_, id) | Def::Enum(id) | Def::TyAlias(id) | Def::AssociatedTy(_, id) |
Def::TyParam(id) | Def::Struct(id) | Def::Union(id) | Def::Trait(id) |
Def::Method(id) | Def::Const(id) | Def::AssociatedConst(id) |
Def::Local(id, _) | Def::Upvar(id, _, _, _) => {
Def::Local(id, _) | Def::Upvar(id, ..) => {
id
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/hir/intravisit.rs
Expand Up @@ -49,8 +49,8 @@ pub enum FnKind<'a> {
impl<'a> FnKind<'a> {
pub fn attrs(&self) -> &'a [Attribute] {
match *self {
FnKind::ItemFn(_, _, _, _, _, _, attrs) => attrs,
FnKind::Method(_, _, _, attrs) => attrs,
FnKind::ItemFn(.., attrs) => attrs,
FnKind::Method(.., attrs) => attrs,
FnKind::Closure(attrs) => attrs,
}
}
Expand Down Expand Up @@ -622,7 +622,7 @@ pub fn walk_fn_decl_nopat<'v, V: Visitor<'v>>(visitor: &mut V, function_declarat

pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'v>) {
match function_kind {
FnKind::ItemFn(_, generics, _, _, _, _, _) => {
FnKind::ItemFn(_, generics, ..) => {
visitor.visit_generics(generics);
}
FnKind::Method(_, sig, _, _) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/pat_util.rs
Expand Up @@ -62,7 +62,7 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
_ => false
}
}
PatKind::Vec(_, _, _) => true,
PatKind::Vec(..) => true,
_ => false
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/error_reporting.rs
Expand Up @@ -1787,7 +1787,7 @@ fn lifetimes_in_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
let method_id_opt = match tcx.map.find(parent) {
Some(node) => match node {
ast_map::NodeItem(item) => match item.node {
hir::ItemFn(_, _, _, _, ref gen, _) => {
hir::ItemFn(.., ref gen, _) => {
taken.extend_from_slice(&gen.lifetimes);
None
},
Expand All @@ -1811,7 +1811,7 @@ fn lifetimes_in_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
if let Some(node) = tcx.map.find(parent) {
match node {
ast_map::NodeItem(item) => match item.node {
hir::ItemImpl(_, _, ref gen, _, _, _) => {
hir::ItemImpl(_, _, ref gen, ..) => {
taken.extend_from_slice(&gen.lifetimes);
}
_ => ()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/mod.rs
Expand Up @@ -248,7 +248,7 @@ impl TypeOrigin {
&TypeOrigin::RelateOutputImplTypes(_) => {
"trait type parameters matches those specified on the impl"
}
&TypeOrigin::MatchExpressionArm(_, _, _) => "match arms have compatible types",
&TypeOrigin::MatchExpressionArm(..) => "match arms have compatible types",
&TypeOrigin::IfExpression(_) => "if and else have compatible types",
&TypeOrigin::IfExpressionWithNoElse(_) => "if missing an else returns ()",
&TypeOrigin::RangeExpression(_) => "start and end of range have compatible types",
Expand Down
1 change: 1 addition & 0 deletions src/librustc/lib.rs
Expand Up @@ -30,6 +30,7 @@
#![feature(conservative_impl_trait)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(enumset)]
#![feature(libc)]
#![feature(nonzero)]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/dead.rs
Expand Up @@ -344,7 +344,7 @@ impl<'v> Visitor<'v> for LifeSeeder {
self.worklist.extend(enum_def.variants.iter()
.map(|variant| variant.node.data.id()));
}
hir::ItemTrait(_, _, _, ref trait_items) => {
hir::ItemTrait(.., ref trait_items) => {
for trait_item in trait_items {
match trait_item.node {
hir::ConstTraitItem(_, Some(_)) |
Expand All @@ -357,7 +357,7 @@ impl<'v> Visitor<'v> for LifeSeeder {
}
}
}
hir::ItemImpl(_, _, _, ref opt_trait, _, ref impl_items) => {
hir::ItemImpl(.., ref opt_trait, _, ref impl_items) => {
for impl_item in impl_items {
if opt_trait.is_some() ||
has_allow_dead_code_or_lang_attr(&impl_item.attrs) {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/effect.rs
Expand Up @@ -83,7 +83,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
block: &'v hir::Block, span: Span, id: ast::NodeId) {

let (is_item_fn, is_unsafe_fn) = match fn_kind {
FnKind::ItemFn(_, _, unsafety, _, _, _, _) =>
FnKind::ItemFn(_, _, unsafety, ..) =>
(true, unsafety == hir::Unsafety::Unsafe),
FnKind::Method(_, sig, _, _) =>
(true, sig.unsafety == hir::Unsafety::Unsafe),
Expand Down Expand Up @@ -143,7 +143,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {

fn visit_expr(&mut self, expr: &hir::Expr) {
match expr.node {
hir::ExprMethodCall(_, _, _) => {
hir::ExprMethodCall(..) => {
let method_call = MethodCall::expr(expr.id);
let base_type = self.tcx.tables.borrow().method_map[&method_call].ty;
debug!("effect: method call case, base type is {:?}",
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/expr_use_visitor.rs
Expand Up @@ -544,7 +544,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
self.consume_expr(&count);
}

hir::ExprClosure(_, _, _, fn_decl_span) => {
hir::ExprClosure(.., fn_decl_span) => {
self.walk_captures(expr, fn_decl_span)
}

Expand Down
14 changes: 7 additions & 7 deletions src/librustc/middle/reachable.rs
Expand Up @@ -46,8 +46,8 @@ fn item_might_be_inlined(item: &hir::Item) -> bool {
}

match item.node {
hir::ItemImpl(_, _, ref generics, _, _, _) |
hir::ItemFn(_, _, _, _, ref generics, _) => {
hir::ItemImpl(_, _, ref generics, ..) |
hir::ItemFn(.., ref generics, _) => {
generics_require_inlining(generics)
}
_ => false,
Expand Down Expand Up @@ -187,7 +187,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// does too.
let impl_node_id = self.tcx.map.as_local_node_id(impl_did).unwrap();
match self.tcx.map.expect_item(impl_node_id).node {
hir::ItemImpl(_, _, ref generics, _, _, _) => {
hir::ItemImpl(_, _, ref generics, ..) => {
generics_require_inlining(generics)
}
_ => false
Expand Down Expand Up @@ -226,7 +226,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// If we are building an executable, only explicitly extern
// types need to be exported.
if let ast_map::NodeItem(item) = *node {
let reachable = if let hir::ItemFn(_, _, _, abi, _, _) = item.node {
let reachable = if let hir::ItemFn(.., abi, _, _) = item.node {
abi != Abi::Rust
} else {
false
Expand All @@ -248,7 +248,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
match *node {
ast_map::NodeItem(item) => {
match item.node {
hir::ItemFn(_, _, _, _, _, ref search_block) => {
hir::ItemFn(.., ref search_block) => {
if item_might_be_inlined(&item) {
intravisit::walk_block(self, &search_block)
}
Expand All @@ -265,7 +265,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// inherently and their children are already in the
// worklist, as determined by the privacy pass
hir::ItemExternCrate(_) | hir::ItemUse(_) |
hir::ItemTy(..) | hir::ItemStatic(_, _, _) |
hir::ItemTy(..) | hir::ItemStatic(..) |
hir::ItemMod(..) | hir::ItemForeignMod(..) |
hir::ItemImpl(..) | hir::ItemTrait(..) |
hir::ItemStruct(..) | hir::ItemEnum(..) |
Expand Down Expand Up @@ -329,7 +329,7 @@ struct CollectPrivateImplItemsVisitor<'a> {
impl<'a, 'v> Visitor<'v> for CollectPrivateImplItemsVisitor<'a> {
fn visit_item(&mut self, item: &hir::Item) {
// We need only trait impls here, not inherent impls, and only non-exported ones
if let hir::ItemImpl(_, _, _, Some(_), _, ref impl_items) = item.node {
if let hir::ItemImpl(.., Some(_), _, ref impl_items) = item.node {
if !self.access_levels.is_reachable(item.id) {
for impl_item in impl_items {
self.worklist.push(impl_item.id);
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/resolve_lifetime.rs
Expand Up @@ -158,7 +158,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for LifetimeContext<'a, 'tcx> {
hir::ItemStruct(_, ref generics) |
hir::ItemUnion(_, ref generics) |
hir::ItemTrait(_, ref generics, _, _) |
hir::ItemImpl(_, _, ref generics, _, _, _) => {
hir::ItemImpl(_, _, ref generics, ..) => {
// These kinds of items have only early bound lifetime parameters.
let lifetimes = &generics.lifetimes;
let start = if let hir::ItemTrait(..) = item.node {
Expand Down Expand Up @@ -204,7 +204,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for LifetimeContext<'a, 'tcx> {
fn visit_fn(&mut self, fk: FnKind<'v>, decl: &'v hir::FnDecl,
b: &'v hir::Block, s: Span, fn_id: ast::NodeId) {
match fk {
FnKind::ItemFn(_, generics, _, _, _, _, _) => {
FnKind::ItemFn(_, generics, ..) => {
self.visit_early_late(fn_id,decl, generics, |this| {
this.add_scope_and_walk_fn(fk, decl, b, s, fn_id)
})
Expand Down Expand Up @@ -499,7 +499,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
fn_id: ast::NodeId) {

match fk {
FnKind::ItemFn(_, generics, _, _, _, _, _) => {
FnKind::ItemFn(_, generics, ..) => {
intravisit::walk_fn_decl(self, fd);
self.visit_generics(generics);
}
Expand Down Expand Up @@ -584,7 +584,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}
match parent.node {
hir::ItemTrait(_, ref generics, _, _) |
hir::ItemImpl(_, _, ref generics, _, _, _) => {
hir::ItemImpl(_, _, ref generics, ..) => {
start += generics.lifetimes.len() + generics.ty_params.len();
}
_ => {}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/stability.rs
Expand Up @@ -252,11 +252,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Annotator<'a, 'tcx> {
// they don't have their own stability. They still can be annotated as unstable
// and propagate this unstability to children, but this annotation is completely
// optional. They inherit stability from their parents when unannotated.
hir::ItemImpl(_, _, _, None, _, _) | hir::ItemForeignMod(..) => {
hir::ItemImpl(.., None, _, _) | hir::ItemForeignMod(..) => {
self.in_trait_impl = false;
kind = AnnotationKind::Container;
}
hir::ItemImpl(_, _, _, Some(_), _, _) => {
hir::ItemImpl(.., Some(_), _, _) => {
self.in_trait_impl = true;
}
hir::ItemStruct(ref sd, _) => {
Expand Down Expand Up @@ -528,7 +528,7 @@ pub fn check_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// For implementations of traits, check the stability of each item
// individually as it's possible to have a stable trait with unstable
// items.
hir::ItemImpl(_, _, _, Some(ref t), _, ref impl_items) => {
hir::ItemImpl(.., Some(ref t), _, ref impl_items) => {
let trait_did = tcx.expect_def(t.ref_id).def_id();
let trait_items = tcx.trait_items(trait_did);

Expand Down
10 changes: 5 additions & 5 deletions src/librustc/ty/mod.rs
Expand Up @@ -1336,7 +1336,7 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
}
Some(ast_map::NodeItem(item)) => {
match item.node {
hir::ItemFn(_, _, _, _, _, ref body) => {
hir::ItemFn(.., ref body) => {
// We assume this is a function.
let fn_def_id = tcx.map.local_def_id(id);

Expand Down Expand Up @@ -2262,7 +2262,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

pub fn provided_trait_methods(self, id: DefId) -> Vec<Rc<Method<'gcx>>> {
if let Some(id) = self.map.as_local_node_id(id) {
if let ItemTrait(_, _, _, ref ms) = self.map.expect_item(id).node {
if let ItemTrait(.., ref ms) = self.map.expect_item(id).node {
ms.iter().filter_map(|ti| {
if let hir::MethodTraitItem(_, Some(_)) = ti.node {
match self.impl_or_trait_item(self.map.local_def_id(ti.id)) {
Expand All @@ -2288,7 +2288,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn associated_consts(self, id: DefId) -> Vec<Rc<AssociatedConst<'gcx>>> {
if let Some(id) = self.map.as_local_node_id(id) {
match self.map.expect_item(id).node {
ItemTrait(_, _, _, ref tis) => {
ItemTrait(.., ref tis) => {
tis.iter().filter_map(|ti| {
if let hir::ConstTraitItem(_, _) = ti.node {
match self.impl_or_trait_item(self.map.local_def_id(ti.id)) {
Expand All @@ -2304,7 +2304,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}
}).collect()
}
ItemImpl(_, _, _, _, _, ref iis) => {
ItemImpl(.., ref iis) => {
iis.iter().filter_map(|ii| {
if let hir::ImplItemKind::Const(_, _) = ii.node {
match self.impl_or_trait_item(self.map.local_def_id(ii.id)) {
Expand Down Expand Up @@ -2334,7 +2334,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
match self.map.find(id) {
Some(ast_map::NodeItem(item)) => {
match item.node {
hir::ItemImpl(_, polarity, _, _, _, _) => Some(polarity),
hir::ItemImpl(_, polarity, ..) => Some(polarity),
_ => None
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_borrowck/borrowck/mir/mod.rs
Expand Up @@ -67,8 +67,8 @@ pub fn borrowck_mir<'a, 'tcx: 'a>(
id: ast::NodeId,
attributes: &[ast::Attribute]) {
match fk {
FnKind::ItemFn(name, _, _, _, _, _, _) |
FnKind::Method(name, _, _, _) => {
FnKind::ItemFn(name, ..) |
FnKind::Method(name, ..) => {
debug!("borrowck_mir({}) UNIMPLEMENTED", name);
}
FnKind::Closure(_) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/borrowck/mod.rs
Expand Up @@ -711,7 +711,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {

move_data::Captured =>
(match self.tcx.map.expect_expr(the_move.id).node {
hir::ExprClosure(_, _, _, fn_decl_span) => fn_decl_span,
hir::ExprClosure(.., fn_decl_span) => fn_decl_span,
ref r => bug!("Captured({}) maps to non-closure: {:?}",
the_move.id, r),
}, " (into closure)"),
Expand Down
1 change: 1 addition & 0 deletions src/librustc_borrowck/lib.rs
Expand Up @@ -19,6 +19,7 @@

#![allow(non_camel_case_types)]

#![feature(dotdot_in_tuple_patterns)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_const_eval/eval.rs
Expand Up @@ -228,7 +228,7 @@ pub fn lookup_const_fn_by_id<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefI
};

match fn_like.kind() {
FnKind::ItemFn(_, _, _, hir::Constness::Const, _, _, _) => {
FnKind::ItemFn(_, _, _, hir::Constness::Const, ..) => {
Some(fn_like)
}
FnKind::Method(_, m, _, _) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_const_eval/lib.rs
Expand Up @@ -22,7 +22,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]


#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(rustc_diagnostic_macros)]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_lint/bad_style.rs
Expand Up @@ -239,7 +239,7 @@ impl LateLintPass for NonSnakeCase {
fk: FnKind, _: &hir::FnDecl,
_: &hir::Block, span: Span, id: ast::NodeId) {
match fk {
FnKind::Method(name, _, _, _) => match method_context(cx, id, span) {
FnKind::Method(name, ..) => match method_context(cx, id, span) {
MethodLateContext::PlainImpl => {
self.check_snake_case(cx, "method", &name.as_str(), Some(span))
},
Expand All @@ -248,7 +248,7 @@ impl LateLintPass for NonSnakeCase {
},
_ => (),
},
FnKind::ItemFn(name, _, _, _, _, _, _) => {
FnKind::ItemFn(name, ..) => {
self.check_snake_case(cx, "function", &name.as_str(), Some(span))
},
FnKind::Closure(_) => (),
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_lint/builtin.rs
Expand Up @@ -203,10 +203,10 @@ impl LateLintPass for UnsafeCode {

fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
match it.node {
hir::ItemTrait(hir::Unsafety::Unsafe, _, _, _) =>
hir::ItemTrait(hir::Unsafety::Unsafe, ..) =>
cx.span_lint(UNSAFE_CODE, it.span, "declaration of an `unsafe` trait"),

hir::ItemImpl(hir::Unsafety::Unsafe, _, _, _, _, _) =>
hir::ItemImpl(hir::Unsafety::Unsafe, ..) =>
cx.span_lint(UNSAFE_CODE, it.span, "implementation of an `unsafe` trait"),

_ => return,
Expand All @@ -216,7 +216,7 @@ impl LateLintPass for UnsafeCode {
fn check_fn(&mut self, cx: &LateContext, fk: FnKind, _: &hir::FnDecl,
_: &hir::Block, span: Span, _: ast::NodeId) {
match fk {
FnKind::ItemFn(_, _, hir::Unsafety::Unsafe, _, _, _, _) =>
FnKind::ItemFn(_, _, hir::Unsafety::Unsafe, ..) =>
cx.span_lint(UNSAFE_CODE, span, "declaration of an `unsafe` function"),

FnKind::Method(_, sig, _, _) => {
Expand Down Expand Up @@ -351,7 +351,7 @@ impl LateLintPass for MissingDoc {
hir::ItemEnum(..) => "an enum",
hir::ItemStruct(..) => "a struct",
hir::ItemUnion(..) => "a union",
hir::ItemTrait(_, _, _, ref items) => {
hir::ItemTrait(.., ref items) => {
// Issue #11592, traits are always considered exported, even when private.
if it.vis == hir::Visibility::Inherited {
self.private_traits.insert(it.id);
Expand All @@ -363,7 +363,7 @@ impl LateLintPass for MissingDoc {
"a trait"
},
hir::ItemTy(..) => "a type alias",
hir::ItemImpl(_, _, _, Some(ref trait_ref), _, ref impl_items) => {
hir::ItemImpl(.., Some(ref trait_ref), _, ref impl_items) => {
// If the trait is private, add the impl items to private_traits so they don't get
// reported for missing docs.
let real_trait = cx.tcx.expect_def(trait_ref.ref_id).def_id();
Expand Down Expand Up @@ -1037,7 +1037,7 @@ impl LintPass for InvalidNoMangleItems {
impl LateLintPass for InvalidNoMangleItems {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
match it.node {
hir::ItemFn(_, _, _, _, ref generics, _) => {
hir::ItemFn(.., ref generics, _) => {
if attr::contains_name(&it.attrs, "no_mangle") {
if !cx.access_levels.is_reachable(it.id) {
let msg = format!("function {} is marked #[no_mangle], but not exported",
Expand Down
1 change: 1 addition & 0 deletions src/librustc_lint/lib.rs
Expand Up @@ -31,6 +31,7 @@
#![cfg_attr(test, feature(test))]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
Expand Down

0 comments on commit 6f7e51e

Please sign in to comment.