Replace _, _, _ with ..

This commit is contained in:
Vadim Petrochenkov 2016-08-26 19:23:42 +03:00
parent 1ca1de6b26
commit 6f7e51e49b
50 changed files with 117 additions and 103 deletions

View File

@ -124,7 +124,7 @@ impl Def {
Def::Variant(_, id) | Def::Enum(id) | Def::TyAlias(id) | Def::AssociatedTy(_, id) | 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::TyParam(id) | Def::Struct(id) | Def::Union(id) | Def::Trait(id) |
Def::Method(id) | Def::Const(id) | Def::AssociatedConst(id) | Def::Method(id) | Def::Const(id) | Def::AssociatedConst(id) |
Def::Local(id, _) | Def::Upvar(id, _, _, _) => { Def::Local(id, _) | Def::Upvar(id, ..) => {
id id
} }

View File

@ -49,8 +49,8 @@ pub enum FnKind<'a> {
impl<'a> FnKind<'a> { impl<'a> FnKind<'a> {
pub fn attrs(&self) -> &'a [Attribute] { pub fn attrs(&self) -> &'a [Attribute] {
match *self { match *self {
FnKind::ItemFn(_, _, _, _, _, _, attrs) => attrs, FnKind::ItemFn(.., attrs) => attrs,
FnKind::Method(_, _, _, attrs) => attrs, FnKind::Method(.., attrs) => attrs,
FnKind::Closure(attrs) => attrs, FnKind::Closure(attrs) => attrs,
} }
} }
@ -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>) { pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'v>) {
match function_kind { match function_kind {
FnKind::ItemFn(_, generics, _, _, _, _, _) => { FnKind::ItemFn(_, generics, ..) => {
visitor.visit_generics(generics); visitor.visit_generics(generics);
} }
FnKind::Method(_, sig, _, _) => { FnKind::Method(_, sig, _, _) => {

View File

@ -62,7 +62,7 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
_ => false _ => false
} }
} }
PatKind::Vec(_, _, _) => true, PatKind::Vec(..) => true,
_ => false _ => false
} }
} }

View File

@ -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) { let method_id_opt = match tcx.map.find(parent) {
Some(node) => match node { Some(node) => match node {
ast_map::NodeItem(item) => match item.node { ast_map::NodeItem(item) => match item.node {
hir::ItemFn(_, _, _, _, ref gen, _) => { hir::ItemFn(.., ref gen, _) => {
taken.extend_from_slice(&gen.lifetimes); taken.extend_from_slice(&gen.lifetimes);
None None
}, },
@ -1811,7 +1811,7 @@ fn lifetimes_in_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
if let Some(node) = tcx.map.find(parent) { if let Some(node) = tcx.map.find(parent) {
match node { match node {
ast_map::NodeItem(item) => match item.node { ast_map::NodeItem(item) => match item.node {
hir::ItemImpl(_, _, ref gen, _, _, _) => { hir::ItemImpl(_, _, ref gen, ..) => {
taken.extend_from_slice(&gen.lifetimes); taken.extend_from_slice(&gen.lifetimes);
} }
_ => () _ => ()

View File

@ -248,7 +248,7 @@ impl TypeOrigin {
&TypeOrigin::RelateOutputImplTypes(_) => { &TypeOrigin::RelateOutputImplTypes(_) => {
"trait type parameters matches those specified on the impl" "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::IfExpression(_) => "if and else have compatible types",
&TypeOrigin::IfExpressionWithNoElse(_) => "if missing an else returns ()", &TypeOrigin::IfExpressionWithNoElse(_) => "if missing an else returns ()",
&TypeOrigin::RangeExpression(_) => "start and end of range have compatible types", &TypeOrigin::RangeExpression(_) => "start and end of range have compatible types",

View File

@ -30,6 +30,7 @@
#![feature(conservative_impl_trait)] #![feature(conservative_impl_trait)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(enumset)] #![feature(enumset)]
#![feature(libc)] #![feature(libc)]
#![feature(nonzero)] #![feature(nonzero)]

View File

@ -344,7 +344,7 @@ impl<'v> Visitor<'v> for LifeSeeder {
self.worklist.extend(enum_def.variants.iter() self.worklist.extend(enum_def.variants.iter()
.map(|variant| variant.node.data.id())); .map(|variant| variant.node.data.id()));
} }
hir::ItemTrait(_, _, _, ref trait_items) => { hir::ItemTrait(.., ref trait_items) => {
for trait_item in trait_items { for trait_item in trait_items {
match trait_item.node { match trait_item.node {
hir::ConstTraitItem(_, Some(_)) | hir::ConstTraitItem(_, Some(_)) |
@ -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 { for impl_item in impl_items {
if opt_trait.is_some() || if opt_trait.is_some() ||
has_allow_dead_code_or_lang_attr(&impl_item.attrs) { has_allow_dead_code_or_lang_attr(&impl_item.attrs) {

View File

@ -83,7 +83,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
block: &'v hir::Block, span: Span, id: ast::NodeId) { block: &'v hir::Block, span: Span, id: ast::NodeId) {
let (is_item_fn, is_unsafe_fn) = match fn_kind { let (is_item_fn, is_unsafe_fn) = match fn_kind {
FnKind::ItemFn(_, _, unsafety, _, _, _, _) => FnKind::ItemFn(_, _, unsafety, ..) =>
(true, unsafety == hir::Unsafety::Unsafe), (true, unsafety == hir::Unsafety::Unsafe),
FnKind::Method(_, sig, _, _) => FnKind::Method(_, sig, _, _) =>
(true, sig.unsafety == hir::Unsafety::Unsafe), (true, sig.unsafety == hir::Unsafety::Unsafe),
@ -143,7 +143,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &hir::Expr) { fn visit_expr(&mut self, expr: &hir::Expr) {
match expr.node { match expr.node {
hir::ExprMethodCall(_, _, _) => { hir::ExprMethodCall(..) => {
let method_call = MethodCall::expr(expr.id); let method_call = MethodCall::expr(expr.id);
let base_type = self.tcx.tables.borrow().method_map[&method_call].ty; let base_type = self.tcx.tables.borrow().method_map[&method_call].ty;
debug!("effect: method call case, base type is {:?}", debug!("effect: method call case, base type is {:?}",

View File

@ -544,7 +544,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
self.consume_expr(&count); self.consume_expr(&count);
} }
hir::ExprClosure(_, _, _, fn_decl_span) => { hir::ExprClosure(.., fn_decl_span) => {
self.walk_captures(expr, fn_decl_span) self.walk_captures(expr, fn_decl_span)
} }

View File

@ -46,8 +46,8 @@ fn item_might_be_inlined(item: &hir::Item) -> bool {
} }
match item.node { match item.node {
hir::ItemImpl(_, _, ref generics, _, _, _) | hir::ItemImpl(_, _, ref generics, ..) |
hir::ItemFn(_, _, _, _, ref generics, _) => { hir::ItemFn(.., ref generics, _) => {
generics_require_inlining(generics) generics_require_inlining(generics)
} }
_ => false, _ => false,
@ -187,7 +187,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// does too. // does too.
let impl_node_id = self.tcx.map.as_local_node_id(impl_did).unwrap(); let impl_node_id = self.tcx.map.as_local_node_id(impl_did).unwrap();
match self.tcx.map.expect_item(impl_node_id).node { match self.tcx.map.expect_item(impl_node_id).node {
hir::ItemImpl(_, _, ref generics, _, _, _) => { hir::ItemImpl(_, _, ref generics, ..) => {
generics_require_inlining(generics) generics_require_inlining(generics)
} }
_ => false _ => false
@ -226,7 +226,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// If we are building an executable, only explicitly extern // If we are building an executable, only explicitly extern
// types need to be exported. // types need to be exported.
if let ast_map::NodeItem(item) = *node { 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 abi != Abi::Rust
} else { } else {
false false
@ -248,7 +248,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
match *node { match *node {
ast_map::NodeItem(item) => { ast_map::NodeItem(item) => {
match item.node { match item.node {
hir::ItemFn(_, _, _, _, _, ref search_block) => { hir::ItemFn(.., ref search_block) => {
if item_might_be_inlined(&item) { if item_might_be_inlined(&item) {
intravisit::walk_block(self, &search_block) intravisit::walk_block(self, &search_block)
} }
@ -265,7 +265,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// inherently and their children are already in the // inherently and their children are already in the
// worklist, as determined by the privacy pass // worklist, as determined by the privacy pass
hir::ItemExternCrate(_) | hir::ItemUse(_) | hir::ItemExternCrate(_) | hir::ItemUse(_) |
hir::ItemTy(..) | hir::ItemStatic(_, _, _) | hir::ItemTy(..) | hir::ItemStatic(..) |
hir::ItemMod(..) | hir::ItemForeignMod(..) | hir::ItemMod(..) | hir::ItemForeignMod(..) |
hir::ItemImpl(..) | hir::ItemTrait(..) | hir::ItemImpl(..) | hir::ItemTrait(..) |
hir::ItemStruct(..) | hir::ItemEnum(..) | hir::ItemStruct(..) | hir::ItemEnum(..) |
@ -329,7 +329,7 @@ struct CollectPrivateImplItemsVisitor<'a> {
impl<'a, 'v> Visitor<'v> for CollectPrivateImplItemsVisitor<'a> { impl<'a, 'v> Visitor<'v> for CollectPrivateImplItemsVisitor<'a> {
fn visit_item(&mut self, item: &hir::Item) { fn visit_item(&mut self, item: &hir::Item) {
// We need only trait impls here, not inherent impls, and only non-exported ones // 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) { if !self.access_levels.is_reachable(item.id) {
for impl_item in impl_items { for impl_item in impl_items {
self.worklist.push(impl_item.id); self.worklist.push(impl_item.id);

View File

@ -158,7 +158,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for LifetimeContext<'a, 'tcx> {
hir::ItemStruct(_, ref generics) | hir::ItemStruct(_, ref generics) |
hir::ItemUnion(_, ref generics) | hir::ItemUnion(_, ref generics) |
hir::ItemTrait(_, ref generics, _, _) | hir::ItemTrait(_, ref generics, _, _) |
hir::ItemImpl(_, _, ref generics, _, _, _) => { hir::ItemImpl(_, _, ref generics, ..) => {
// These kinds of items have only early bound lifetime parameters. // These kinds of items have only early bound lifetime parameters.
let lifetimes = &generics.lifetimes; let lifetimes = &generics.lifetimes;
let start = if let hir::ItemTrait(..) = item.node { let start = if let hir::ItemTrait(..) = item.node {
@ -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, fn visit_fn(&mut self, fk: FnKind<'v>, decl: &'v hir::FnDecl,
b: &'v hir::Block, s: Span, fn_id: ast::NodeId) { b: &'v hir::Block, s: Span, fn_id: ast::NodeId) {
match fk { match fk {
FnKind::ItemFn(_, generics, _, _, _, _, _) => { FnKind::ItemFn(_, generics, ..) => {
self.visit_early_late(fn_id,decl, generics, |this| { self.visit_early_late(fn_id,decl, generics, |this| {
this.add_scope_and_walk_fn(fk, decl, b, s, fn_id) this.add_scope_and_walk_fn(fk, decl, b, s, fn_id)
}) })
@ -499,7 +499,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
fn_id: ast::NodeId) { fn_id: ast::NodeId) {
match fk { match fk {
FnKind::ItemFn(_, generics, _, _, _, _, _) => { FnKind::ItemFn(_, generics, ..) => {
intravisit::walk_fn_decl(self, fd); intravisit::walk_fn_decl(self, fd);
self.visit_generics(generics); self.visit_generics(generics);
} }
@ -584,7 +584,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
} }
match parent.node { match parent.node {
hir::ItemTrait(_, ref generics, _, _) | hir::ItemTrait(_, ref generics, _, _) |
hir::ItemImpl(_, _, ref generics, _, _, _) => { hir::ItemImpl(_, _, ref generics, ..) => {
start += generics.lifetimes.len() + generics.ty_params.len(); start += generics.lifetimes.len() + generics.ty_params.len();
} }
_ => {} _ => {}

View File

@ -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 // 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 // and propagate this unstability to children, but this annotation is completely
// optional. They inherit stability from their parents when unannotated. // optional. They inherit stability from their parents when unannotated.
hir::ItemImpl(_, _, _, None, _, _) | hir::ItemForeignMod(..) => { hir::ItemImpl(.., None, _, _) | hir::ItemForeignMod(..) => {
self.in_trait_impl = false; self.in_trait_impl = false;
kind = AnnotationKind::Container; kind = AnnotationKind::Container;
} }
hir::ItemImpl(_, _, _, Some(_), _, _) => { hir::ItemImpl(.., Some(_), _, _) => {
self.in_trait_impl = true; self.in_trait_impl = true;
} }
hir::ItemStruct(ref sd, _) => { hir::ItemStruct(ref sd, _) => {
@ -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 // For implementations of traits, check the stability of each item
// individually as it's possible to have a stable trait with unstable // individually as it's possible to have a stable trait with unstable
// items. // 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_did = tcx.expect_def(t.ref_id).def_id();
let trait_items = tcx.trait_items(trait_did); let trait_items = tcx.trait_items(trait_did);

View File

@ -1336,7 +1336,7 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
} }
Some(ast_map::NodeItem(item)) => { Some(ast_map::NodeItem(item)) => {
match item.node { match item.node {
hir::ItemFn(_, _, _, _, _, ref body) => { hir::ItemFn(.., ref body) => {
// We assume this is a function. // We assume this is a function.
let fn_def_id = tcx.map.local_def_id(id); let fn_def_id = tcx.map.local_def_id(id);
@ -2262,7 +2262,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn provided_trait_methods(self, id: DefId) -> Vec<Rc<Method<'gcx>>> { 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 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| { ms.iter().filter_map(|ti| {
if let hir::MethodTraitItem(_, Some(_)) = ti.node { if let hir::MethodTraitItem(_, Some(_)) = ti.node {
match self.impl_or_trait_item(self.map.local_def_id(ti.id)) { match self.impl_or_trait_item(self.map.local_def_id(ti.id)) {
@ -2288,7 +2288,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn associated_consts(self, id: DefId) -> Vec<Rc<AssociatedConst<'gcx>>> { pub fn associated_consts(self, id: DefId) -> Vec<Rc<AssociatedConst<'gcx>>> {
if let Some(id) = self.map.as_local_node_id(id) { if let Some(id) = self.map.as_local_node_id(id) {
match self.map.expect_item(id).node { match self.map.expect_item(id).node {
ItemTrait(_, _, _, ref tis) => { ItemTrait(.., ref tis) => {
tis.iter().filter_map(|ti| { tis.iter().filter_map(|ti| {
if let hir::ConstTraitItem(_, _) = ti.node { if let hir::ConstTraitItem(_, _) = ti.node {
match self.impl_or_trait_item(self.map.local_def_id(ti.id)) { match self.impl_or_trait_item(self.map.local_def_id(ti.id)) {
@ -2304,7 +2304,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
} }
}).collect() }).collect()
} }
ItemImpl(_, _, _, _, _, ref iis) => { ItemImpl(.., ref iis) => {
iis.iter().filter_map(|ii| { iis.iter().filter_map(|ii| {
if let hir::ImplItemKind::Const(_, _) = ii.node { if let hir::ImplItemKind::Const(_, _) = ii.node {
match self.impl_or_trait_item(self.map.local_def_id(ii.id)) { match self.impl_or_trait_item(self.map.local_def_id(ii.id)) {
@ -2334,7 +2334,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
match self.map.find(id) { match self.map.find(id) {
Some(ast_map::NodeItem(item)) => { Some(ast_map::NodeItem(item)) => {
match item.node { match item.node {
hir::ItemImpl(_, polarity, _, _, _, _) => Some(polarity), hir::ItemImpl(_, polarity, ..) => Some(polarity),
_ => None _ => None
} }
} }

View File

@ -67,8 +67,8 @@ pub fn borrowck_mir<'a, 'tcx: 'a>(
id: ast::NodeId, id: ast::NodeId,
attributes: &[ast::Attribute]) { attributes: &[ast::Attribute]) {
match fk { match fk {
FnKind::ItemFn(name, _, _, _, _, _, _) | FnKind::ItemFn(name, ..) |
FnKind::Method(name, _, _, _) => { FnKind::Method(name, ..) => {
debug!("borrowck_mir({}) UNIMPLEMENTED", name); debug!("borrowck_mir({}) UNIMPLEMENTED", name);
} }
FnKind::Closure(_) => { FnKind::Closure(_) => {

View File

@ -711,7 +711,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
move_data::Captured => move_data::Captured =>
(match self.tcx.map.expect_expr(the_move.id).node { (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: {:?}", ref r => bug!("Captured({}) maps to non-closure: {:?}",
the_move.id, r), the_move.id, r),
}, " (into closure)"), }, " (into closure)"),

View File

@ -19,6 +19,7 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]

View File

@ -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() { match fn_like.kind() {
FnKind::ItemFn(_, _, _, hir::Constness::Const, _, _, _) => { FnKind::ItemFn(_, _, _, hir::Constness::Const, ..) => {
Some(fn_like) Some(fn_like)
} }
FnKind::Method(_, m, _, _) => { FnKind::Method(_, m, _, _) => {

View File

@ -22,7 +22,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]

View File

@ -239,7 +239,7 @@ impl LateLintPass for NonSnakeCase {
fk: FnKind, _: &hir::FnDecl, fk: FnKind, _: &hir::FnDecl,
_: &hir::Block, span: Span, id: ast::NodeId) { _: &hir::Block, span: Span, id: ast::NodeId) {
match fk { match fk {
FnKind::Method(name, _, _, _) => match method_context(cx, id, span) { FnKind::Method(name, ..) => match method_context(cx, id, span) {
MethodLateContext::PlainImpl => { MethodLateContext::PlainImpl => {
self.check_snake_case(cx, "method", &name.as_str(), Some(span)) self.check_snake_case(cx, "method", &name.as_str(), Some(span))
}, },
@ -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)) self.check_snake_case(cx, "function", &name.as_str(), Some(span))
}, },
FnKind::Closure(_) => (), FnKind::Closure(_) => (),

View File

@ -203,10 +203,10 @@ impl LateLintPass for UnsafeCode {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
match it.node { 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"), 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"), cx.span_lint(UNSAFE_CODE, it.span, "implementation of an `unsafe` trait"),
_ => return, _ => return,
@ -216,7 +216,7 @@ impl LateLintPass for UnsafeCode {
fn check_fn(&mut self, cx: &LateContext, fk: FnKind, _: &hir::FnDecl, fn check_fn(&mut self, cx: &LateContext, fk: FnKind, _: &hir::FnDecl,
_: &hir::Block, span: Span, _: ast::NodeId) { _: &hir::Block, span: Span, _: ast::NodeId) {
match fk { match fk {
FnKind::ItemFn(_, _, hir::Unsafety::Unsafe, _, _, _, _) => FnKind::ItemFn(_, _, hir::Unsafety::Unsafe, ..) =>
cx.span_lint(UNSAFE_CODE, span, "declaration of an `unsafe` function"), cx.span_lint(UNSAFE_CODE, span, "declaration of an `unsafe` function"),
FnKind::Method(_, sig, _, _) => { FnKind::Method(_, sig, _, _) => {
@ -351,7 +351,7 @@ impl LateLintPass for MissingDoc {
hir::ItemEnum(..) => "an enum", hir::ItemEnum(..) => "an enum",
hir::ItemStruct(..) => "a struct", hir::ItemStruct(..) => "a struct",
hir::ItemUnion(..) => "a union", hir::ItemUnion(..) => "a union",
hir::ItemTrait(_, _, _, ref items) => { hir::ItemTrait(.., ref items) => {
// Issue #11592, traits are always considered exported, even when private. // Issue #11592, traits are always considered exported, even when private.
if it.vis == hir::Visibility::Inherited { if it.vis == hir::Visibility::Inherited {
self.private_traits.insert(it.id); self.private_traits.insert(it.id);
@ -363,7 +363,7 @@ impl LateLintPass for MissingDoc {
"a trait" "a trait"
}, },
hir::ItemTy(..) => "a type alias", 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 // If the trait is private, add the impl items to private_traits so they don't get
// reported for missing docs. // reported for missing docs.
let real_trait = cx.tcx.expect_def(trait_ref.ref_id).def_id(); let real_trait = cx.tcx.expect_def(trait_ref.ref_id).def_id();
@ -1037,7 +1037,7 @@ impl LintPass for InvalidNoMangleItems {
impl LateLintPass for InvalidNoMangleItems { impl LateLintPass for InvalidNoMangleItems {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
match it.node { match it.node {
hir::ItemFn(_, _, _, _, ref generics, _) => { hir::ItemFn(.., ref generics, _) => {
if attr::contains_name(&it.attrs, "no_mangle") { if attr::contains_name(&it.attrs, "no_mangle") {
if !cx.access_levels.is_reachable(it.id) { if !cx.access_levels.is_reachable(it.id) {
let msg = format!("function {} is marked #[no_mangle], but not exported", let msg = format!("function {} is marked #[no_mangle], but not exported",

View File

@ -31,6 +31,7 @@
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]

View File

@ -1065,7 +1065,7 @@ impl<'a, 'tcx, 'encoder> ItemContentBuilder<'a, 'tcx, 'encoder> {
let trait_ref = tcx.impl_trait_ref(ecx.tcx.map.local_def_id(item.id)).unwrap(); let trait_ref = tcx.impl_trait_ref(ecx.tcx.map.local_def_id(item.id)).unwrap();
encode_trait_ref(self.rbml_w, ecx, trait_ref, tag_item_trait_ref); encode_trait_ref(self.rbml_w, ecx, trait_ref, tag_item_trait_ref);
} }
hir::ItemImpl(unsafety, polarity, _, _, _, _) => { hir::ItemImpl(unsafety, polarity, ..) => {
// We need to encode information about the default methods we // We need to encode information about the default methods we
// have inherited, so we drive self based on the impl structure. // have inherited, so we drive self based on the impl structure.
let impl_items = tcx.impl_items.borrow(); let impl_items = tcx.impl_items.borrow();
@ -1129,7 +1129,7 @@ impl<'a, 'tcx, 'encoder> ItemContentBuilder<'a, 'tcx, 'encoder> {
encode_stability(self.rbml_w, stab); encode_stability(self.rbml_w, stab);
encode_deprecation(self.rbml_w, depr); encode_deprecation(self.rbml_w, depr);
} }
hir::ItemTrait(_, _, _, _) => { hir::ItemTrait(..) => {
encode_def_id_and_key(ecx, self.rbml_w, def_id); encode_def_id_and_key(ecx, self.rbml_w, def_id);
encode_family(self.rbml_w, 'I'); encode_family(self.rbml_w, 'I');
encode_item_variances(self.rbml_w, ecx, item.id); encode_item_variances(self.rbml_w, ecx, item.id);
@ -1209,10 +1209,10 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
hir::ItemUnion(..) => { hir::ItemUnion(..) => {
self.encode_addl_union_info(def_id); self.encode_addl_union_info(def_id);
} }
hir::ItemImpl(_, _, _, _, _, ref ast_items) => { hir::ItemImpl(.., ref ast_items) => {
self.encode_addl_impl_info(def_id, item.id, ast_items); self.encode_addl_impl_info(def_id, item.id, ast_items);
} }
hir::ItemTrait(_, _, _, ref trait_items) => { hir::ItemTrait(.., ref trait_items) => {
self.encode_addl_trait_info(def_id, trait_items); self.encode_addl_trait_info(def_id, trait_items);
} }
} }

View File

@ -18,6 +18,7 @@
#![cfg_attr(not(stage0), deny(warnings))] #![cfg_attr(not(stage0), deny(warnings))]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(enumset)] #![feature(enumset)]
#![feature(question_mark)] #![feature(question_mark)]
#![feature(quote)] #![feature(quote)]

View File

@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
MirSource::Fn(id) => { MirSource::Fn(id) => {
let fn_like = FnLikeNode::from_node(infcx.tcx.map.get(id)); let fn_like = FnLikeNode::from_node(infcx.tcx.map.get(id));
match fn_like.map(|f| f.kind()) { match fn_like.map(|f| f.kind()) {
Some(FnKind::ItemFn(_, _, _, c, _, _, _)) => c, Some(FnKind::ItemFn(_, _, _, c, ..)) => c,
Some(FnKind::Method(_, m, _, _)) => m.constness, Some(FnKind::Method(_, m, _, _)) => m.constness,
_ => hir::Constness::NotConst _ => hir::Constness::NotConst
} }

View File

@ -22,6 +22,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(associated_consts)] #![feature(associated_consts)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]

View File

@ -119,7 +119,7 @@ fn is_const_fn(tcx: TyCtxt, def_id: DefId) -> bool {
if let Some(node_id) = tcx.map.as_local_node_id(def_id) { if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
let fn_like = FnLikeNode::from_node(tcx.map.get(node_id)); let fn_like = FnLikeNode::from_node(tcx.map.get(node_id));
match fn_like.map(|f| f.kind()) { match fn_like.map(|f| f.kind()) {
Some(FnKind::ItemFn(_, _, _, c, _, _, _)) => { Some(FnKind::ItemFn(_, _, _, c, ..)) => {
c == hir::Constness::Const c == hir::Constness::Const
} }
Some(FnKind::Method(_, m, _, _)) => { Some(FnKind::Method(_, m, _, _)) => {

View File

@ -100,8 +100,8 @@ impl<'a> Visitor for AstValidator<'a> {
match expr.node { match expr.node {
ExprKind::While(_, _, Some(ident)) | ExprKind::While(_, _, Some(ident)) |
ExprKind::Loop(_, Some(ident)) | ExprKind::Loop(_, Some(ident)) |
ExprKind::WhileLet(_, _, _, Some(ident)) | ExprKind::WhileLet(.., Some(ident)) |
ExprKind::ForLoop(_, _, _, Some(ident)) | ExprKind::ForLoop(.., Some(ident)) |
ExprKind::Break(Some(ident)) | ExprKind::Break(Some(ident)) |
ExprKind::Continue(Some(ident)) => { ExprKind::Continue(Some(ident)) => {
self.check_label(ident.node, ident.span, expr.id); self.check_label(ident.node, ident.span, expr.id);
@ -155,7 +155,7 @@ impl<'a> Visitor for AstValidator<'a> {
.span_err(path.span, "type or lifetime parameters in import path"); .span_err(path.span, "type or lifetime parameters in import path");
} }
} }
ItemKind::Impl(_, _, _, Some(..), _, ref impl_items) => { ItemKind::Impl(.., Some(..), _, ref impl_items) => {
self.invalid_visibility(&item.vis, item.span, None); self.invalid_visibility(&item.vis, item.span, None);
for impl_item in impl_items { for impl_item in impl_items {
self.invalid_visibility(&impl_item.vis, impl_item.span, None); self.invalid_visibility(&impl_item.vis, impl_item.span, None);
@ -164,7 +164,7 @@ impl<'a> Visitor for AstValidator<'a> {
} }
} }
} }
ItemKind::Impl(_, _, _, None, _, _) => { ItemKind::Impl(.., None, _, _) => {
self.invalid_visibility(&item.vis, self.invalid_visibility(&item.vis,
item.span, item.span,
Some("place qualifiers on individual impl items instead")); Some("place qualifiers on individual impl items instead"));
@ -185,7 +185,7 @@ impl<'a> Visitor for AstValidator<'a> {
} }
} }
} }
ItemKind::Trait(_, _, _, ref trait_items) => { ItemKind::Trait(.., ref trait_items) => {
for trait_item in trait_items { for trait_item in trait_items {
if let TraitItemKind::Method(ref sig, _) = trait_item.node { if let TraitItemKind::Method(ref sig, _) = trait_item.node {
self.check_trait_fn_not_const(sig.constness); self.check_trait_fn_not_const(sig.constness);

View File

@ -147,7 +147,7 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> {
} }
let mode = match fk { let mode = match fk {
FnKind::ItemFn(_, _, _, hir::Constness::Const, _, _, _) FnKind::ItemFn(_, _, _, hir::Constness::Const, ..)
=> Mode::ConstFn, => Mode::ConstFn,
FnKind::Method(_, m, _, _) => { FnKind::Method(_, m, _, _) => {
if m.constness == hir::Constness::Const { if m.constness == hir::Constness::Const {

View File

@ -23,6 +23,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))] #![cfg_attr(not(stage0), deny(warnings))]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(rustc_private)] #![feature(rustc_private)]

View File

@ -17,6 +17,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")] html_root_url = "https://doc.rust-lang.org/nightly/")]
#![cfg_attr(not(stage0), deny(warnings))] #![cfg_attr(not(stage0), deny(warnings))]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
@ -125,10 +126,10 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
fn visit_item(&mut self, item: &hir::Item) { fn visit_item(&mut self, item: &hir::Item) {
let inherited_item_level = match item.node { let inherited_item_level = match item.node {
// Impls inherit level from their types and traits // Impls inherit level from their types and traits
hir::ItemImpl(_, _, _, None, ref ty, _) => { hir::ItemImpl(.., None, ref ty, _) => {
self.ty_level(&ty) self.ty_level(&ty)
} }
hir::ItemImpl(_, _, _, Some(ref trait_ref), ref ty, _) => { hir::ItemImpl(.., Some(ref trait_ref), ref ty, _) => {
cmp::min(self.ty_level(&ty), self.trait_level(trait_ref)) cmp::min(self.ty_level(&ty), self.trait_level(trait_ref))
} }
hir::ItemDefaultImpl(_, ref trait_ref) => { hir::ItemDefaultImpl(_, ref trait_ref) => {
@ -157,19 +158,19 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
} }
} }
} }
hir::ItemImpl(_, _, _, None, _, ref impl_items) => { hir::ItemImpl(.., None, _, ref impl_items) => {
for impl_item in impl_items { for impl_item in impl_items {
if impl_item.vis == hir::Public { if impl_item.vis == hir::Public {
self.update(impl_item.id, item_level); self.update(impl_item.id, item_level);
} }
} }
} }
hir::ItemImpl(_, _, _, Some(_), _, ref impl_items) => { hir::ItemImpl(.., Some(_), _, ref impl_items) => {
for impl_item in impl_items { for impl_item in impl_items {
self.update(impl_item.id, item_level); self.update(impl_item.id, item_level);
} }
} }
hir::ItemTrait(_, _, _, ref trait_items) => { hir::ItemTrait(.., ref trait_items) => {
for trait_item in trait_items { for trait_item in trait_items {
self.update(trait_item.id, item_level); self.update(trait_item.id, item_level);
} }
@ -204,7 +205,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
hir::ItemUse(..) => {} hir::ItemUse(..) => {}
// Visit everything // Visit everything
hir::ItemConst(..) | hir::ItemStatic(..) | hir::ItemFn(..) | hir::ItemConst(..) | hir::ItemStatic(..) | hir::ItemFn(..) |
hir::ItemTrait(..) | hir::ItemTy(..) | hir::ItemImpl(_, _, _, Some(..), _, _) => { hir::ItemTrait(..) | hir::ItemTy(..) | hir::ItemImpl(.., Some(..), _, _) => {
if item_level.is_some() { if item_level.is_some() {
self.reach().visit_item(item); self.reach().visit_item(item);
} }

View File

@ -232,7 +232,7 @@ impl<'b> Resolver<'b> {
let def = Def::Const(self.definitions.local_def_id(item.id)); let def = Def::Const(self.definitions.local_def_id(item.id));
self.define(parent, name, ValueNS, (def, sp, vis)); self.define(parent, name, ValueNS, (def, sp, vis));
} }
ItemKind::Fn(_, _, _, _, _, _) => { ItemKind::Fn(..) => {
let def = Def::Fn(self.definitions.local_def_id(item.id)); let def = Def::Fn(self.definitions.local_def_id(item.id));
self.define(parent, name, ValueNS, (def, sp, vis)); self.define(parent, name, ValueNS, (def, sp, vis));
} }
@ -294,7 +294,7 @@ impl<'b> Resolver<'b> {
ItemKind::DefaultImpl(_, _) | ItemKind::Impl(..) => {} ItemKind::DefaultImpl(_, _) | ItemKind::Impl(..) => {}
ItemKind::Trait(_, _, _, ref items) => { ItemKind::Trait(.., ref items) => {
let def_id = self.definitions.local_def_id(item.id); let def_id = self.definitions.local_def_id(item.id);
// Add all the items within to a new module. // Add all the items within to a new module.

View File

@ -19,6 +19,7 @@
#![feature(associated_consts)] #![feature(associated_consts)]
#![feature(borrow_state)] #![feature(borrow_state)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
@ -599,7 +600,7 @@ impl<'a> Visitor for Resolver<'a> {
_: Span, _: Span,
node_id: NodeId) { node_id: NodeId) {
let rib_kind = match function_kind { let rib_kind = match function_kind {
FnKind::ItemFn(_, generics, _, _, _, _) => { FnKind::ItemFn(_, generics, ..) => {
self.visit_generics(generics); self.visit_generics(generics);
ItemRibKind ItemRibKind
} }
@ -1634,7 +1635,7 @@ impl<'a> Resolver<'a> {
ItemKind::Ty(_, ref generics) | ItemKind::Ty(_, ref generics) |
ItemKind::Struct(_, ref generics) | ItemKind::Struct(_, ref generics) |
ItemKind::Union(_, ref generics) | ItemKind::Union(_, ref generics) |
ItemKind::Fn(_, _, _, _, ref generics, _) => { ItemKind::Fn(.., ref generics, _) => {
self.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind), self.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind),
|this| visit::walk_item(this, item)); |this| visit::walk_item(this, item));
} }

View File

@ -1137,7 +1137,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
}.lower(self.tcx)); }.lower(self.tcx));
} }
} }
Fn(ref decl, _, _, _, ref ty_params, ref body) => Fn(ref decl, .., ref ty_params, ref body) =>
self.process_fn(item, &decl, ty_params, &body), self.process_fn(item, &decl, ty_params, &body),
Static(ref typ, _, ref expr) => Static(ref typ, _, ref expr) =>
self.process_static_or_const_item(item, typ, expr), self.process_static_or_const_item(item, typ, expr),

View File

@ -18,6 +18,7 @@
#![cfg_attr(not(stage0), deny(warnings))] #![cfg_attr(not(stage0), deny(warnings))]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(dotdot_in_tuple_patterns)]
#![allow(unused_attributes)] #![allow(unused_attributes)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(staged_api)] #![feature(staged_api)]
@ -124,7 +125,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> { pub fn get_item_data(&self, item: &ast::Item) -> Option<Data> {
match item.node { match item.node {
ast::ItemKind::Fn(ref decl, _, _, _, ref generics, _) => { ast::ItemKind::Fn(ref decl, .., ref generics, _) => {
let qualname = format!("::{}", self.tcx.node_path_str(item.id)); let qualname = format!("::{}", self.tcx.node_path_str(item.id));
let sub_span = self.span_utils.sub_span_after_keyword(item.span, keywords::Fn); let sub_span = self.span_utils.sub_span_after_keyword(item.span, keywords::Fn);
filter!(self.span_utils, sub_span, item.span, None); filter!(self.span_utils, sub_span, item.span, None);
@ -217,7 +218,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
variants: def.variants.iter().map(|v| v.node.data.id()).collect(), variants: def.variants.iter().map(|v| v.node.data.id()).collect(),
})) }))
} }
ast::ItemKind::Impl(_, _, _, ref trait_ref, ref typ, _) => { ast::ItemKind::Impl(.., ref trait_ref, ref typ, _) => {
let mut type_data = None; let mut type_data = None;
let sub_span; let sub_span;
@ -295,7 +296,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
Some(impl_id) => match self.tcx.map.get_if_local(impl_id) { Some(impl_id) => match self.tcx.map.get_if_local(impl_id) {
Some(NodeItem(item)) => { Some(NodeItem(item)) => {
match item.node { match item.node {
hir::ItemImpl(_, _, _, _, ref ty, _) => { hir::ItemImpl(.., ref ty, _) => {
let mut result = String::from("<"); let mut result = String::from("<");
result.push_str(&rustc::hir::print::ty_to_string(&ty)); result.push_str(&rustc::hir::print::ty_to_string(&ty));

View File

@ -1152,7 +1152,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
// const items only generate translation items if they are // const items only generate translation items if they are
// actually used somewhere. Just declaring them is insufficient. // actually used somewhere. Just declaring them is insufficient.
} }
hir::ItemFn(_, _, _, _, ref generics, _) => { hir::ItemFn(.., ref generics, _) => {
if !generics.is_type_parameterized() { if !generics.is_type_parameterized() {
let def_id = self.scx.tcx().map.local_def_id(item.id); let def_id = self.scx.tcx().map.local_def_id(item.id);
@ -1179,7 +1179,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
let parent_node_id = hir_map.get_parent_node(ii.id); let parent_node_id = hir_map.get_parent_node(ii.id);
let is_impl_generic = match hir_map.expect_item(parent_node_id) { let is_impl_generic = match hir_map.expect_item(parent_node_id) {
&hir::Item { &hir::Item {
node: hir::ItemImpl(_, _, ref generics, _, _, _), node: hir::ItemImpl(_, _, ref generics, ..),
.. ..
} => { } => {
generics.is_type_parameterized() generics.is_type_parameterized()

View File

@ -27,6 +27,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(const_fn)] #![feature(const_fn)]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(dotdot_in_tuple_patterns)]
#![allow(unused_attributes)] #![allow(unused_attributes)]
#![feature(libc)] #![feature(libc)]
#![feature(quote)] #![feature(quote)]

View File

@ -1358,7 +1358,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
// `ty::trait_items` used below requires information generated // `ty::trait_items` used below requires information generated
// by type collection, which may be in progress at this point. // by type collection, which may be in progress at this point.
match tcx.map.expect_item(trait_id).node { match tcx.map.expect_item(trait_id).node {
hir::ItemTrait(_, _, _, ref trait_items) => { hir::ItemTrait(.., ref trait_items) => {
let item = trait_items.iter() let item = trait_items.iter()
.find(|i| i.name == assoc_name) .find(|i| i.name == assoc_name)
.expect("missing associated type"); .expect("missing associated type");

View File

@ -741,7 +741,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
it.id); it.id);
} }
hir::ItemFn(..) => {} // entirely within check_item_body hir::ItemFn(..) => {} // entirely within check_item_body
hir::ItemImpl(_, _, _, _, _, ref impl_items) => { hir::ItemImpl(.., ref impl_items) => {
debug!("ItemImpl {} with id {}", it.name, it.id); debug!("ItemImpl {} with id {}", it.name, it.id);
let impl_def_id = ccx.tcx.map.local_def_id(it.id); let impl_def_id = ccx.tcx.map.local_def_id(it.id);
match ccx.tcx.impl_trait_ref(impl_def_id) { match ccx.tcx.impl_trait_ref(impl_def_id) {
@ -808,10 +808,10 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
ccx.tcx.item_path_str(ccx.tcx.map.local_def_id(it.id))); ccx.tcx.item_path_str(ccx.tcx.map.local_def_id(it.id)));
let _indenter = indenter(); let _indenter = indenter();
match it.node { match it.node {
hir::ItemFn(ref decl, _, _, _, _, ref body) => { hir::ItemFn(ref decl, .., ref body) => {
check_bare_fn(ccx, &decl, &body, it.id); check_bare_fn(ccx, &decl, &body, it.id);
} }
hir::ItemImpl(_, _, _, _, _, ref impl_items) => { hir::ItemImpl(.., ref impl_items) => {
debug!("ItemImpl {} with id {}", it.name, it.id); debug!("ItemImpl {} with id {}", it.name, it.id);
for impl_item in impl_items { for impl_item in impl_items {
@ -828,7 +828,7 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
} }
} }
} }
hir::ItemTrait(_, _, _, ref trait_items) => { hir::ItemTrait(.., ref trait_items) => {
for trait_item in trait_items { for trait_item in trait_items {
match trait_item.node { match trait_item.node {
hir::ConstTraitItem(_, Some(ref expr)) => { hir::ConstTraitItem(_, Some(ref expr)) => {

View File

@ -126,7 +126,7 @@ impl<'ccx, 'gcx> CheckTypeWellFormedVisitor<'ccx, 'gcx> {
} }
} }
} }
hir::ItemFn(_, _, _, _, _, ref body) => { hir::ItemFn(.., ref body) => {
self.check_item_fn(item, body); self.check_item_fn(item, body);
} }
hir::ItemStatic(..) => { hir::ItemStatic(..) => {
@ -156,7 +156,7 @@ impl<'ccx, 'gcx> CheckTypeWellFormedVisitor<'ccx, 'gcx> {
self.check_variances_for_type_defn(item, ast_generics); self.check_variances_for_type_defn(item, ast_generics);
} }
hir::ItemTrait(_, _, _, ref items) => { hir::ItemTrait(.., ref items) => {
self.check_trait(item, items); self.check_trait(item, items);
} }
_ => {} _ => {}

View File

@ -195,7 +195,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
// Converts an implementation in the AST to a vector of items. // Converts an implementation in the AST to a vector of items.
fn create_impl_from_item(&self, item: &Item) -> Vec<ImplOrTraitItemId> { fn create_impl_from_item(&self, item: &Item) -> Vec<ImplOrTraitItemId> {
match item.node { match item.node {
ItemImpl(_, _, _, _, _, ref impl_items) => { ItemImpl(.., ref impl_items) => {
impl_items.iter().map(|impl_item| { impl_items.iter().map(|impl_item| {
let impl_def_id = self.crate_context.tcx.map.local_def_id(impl_item.id); let impl_def_id = self.crate_context.tcx.map.local_def_id(impl_item.id);
match impl_item.node { match impl_item.node {
@ -252,7 +252,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
match tcx.map.find(impl_node_id) { match tcx.map.find(impl_node_id) {
Some(hir_map::NodeItem(item)) => { Some(hir_map::NodeItem(item)) => {
let span = match item.node { let span = match item.node {
ItemImpl(_, _, _, _, ref ty, _) => { ItemImpl(.., ref ty, _) => {
ty.span ty.span
}, },
_ => item.span _ => item.span
@ -324,7 +324,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
} }
Err(CopyImplementationError::InfrigingVariant(name)) => { Err(CopyImplementationError::InfrigingVariant(name)) => {
let item = tcx.map.expect_item(impl_node_id); let item = tcx.map.expect_item(impl_node_id);
let span = if let ItemImpl(_, _, _, Some(ref tr), _, _) = item.node { let span = if let ItemImpl(.., Some(ref tr), _, _) = item.node {
tr.path.span tr.path.span
} else { } else {
span span
@ -338,7 +338,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
} }
Err(CopyImplementationError::NotAnAdt) => { Err(CopyImplementationError::NotAnAdt) => {
let item = tcx.map.expect_item(impl_node_id); let item = tcx.map.expect_item(impl_node_id);
let span = if let ItemImpl(_, _, _, _, ref ty, _) = item.node { let span = if let ItemImpl(.., ref ty, _) = item.node {
ty.span ty.span
} else { } else {
span span
@ -463,7 +463,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
return; return;
} else if diff_fields.len() > 1 { } else if diff_fields.len() > 1 {
let item = tcx.map.expect_item(impl_node_id); let item = tcx.map.expect_item(impl_node_id);
let span = if let ItemImpl(_, _, _, Some(ref t), _, _) = item.node { let span = if let ItemImpl(.., Some(ref t), _, _) = item.node {
t.path.span t.path.span
} else { } else {
tcx.map.span(impl_node_id) tcx.map.span(impl_node_id)

View File

@ -68,7 +68,7 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
fn check_item(&self, item: &hir::Item) { fn check_item(&self, item: &hir::Item) {
let def_id = self.tcx.map.local_def_id(item.id); let def_id = self.tcx.map.local_def_id(item.id);
match item.node { match item.node {
hir::ItemImpl(_, _, _, None, ref ty, _) => { hir::ItemImpl(.., None, ref ty, _) => {
// For inherent impls, self type must be a nominal type // For inherent impls, self type must be a nominal type
// defined in this crate. // defined in this crate.
debug!("coherence2::orphan check: inherent impl {}", debug!("coherence2::orphan check: inherent impl {}",
@ -222,7 +222,7 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
} }
} }
} }
hir::ItemImpl(_, _, _, Some(_), _, _) => { hir::ItemImpl(.., Some(_), _, _) => {
// "Trait" impl // "Trait" impl
debug!("coherence2::orphan check: trait impl {}", debug!("coherence2::orphan check: trait impl {}",
self.tcx.map.node_to_string(item.id)); self.tcx.map.node_to_string(item.id));

View File

@ -122,7 +122,7 @@ impl<'cx, 'tcx,'v> intravisit::Visitor<'v> for OverlapChecker<'cx, 'tcx> {
err.emit(); err.emit();
} }
} }
hir::ItemImpl(_, _, _, Some(_), _, _) => { hir::ItemImpl(.., Some(_), _, _) => {
let impl_def_id = self.tcx.map.local_def_id(item.id); let impl_def_id = self.tcx.map.local_def_id(item.id);
let trait_ref = self.tcx.impl_trait_ref(impl_def_id).unwrap(); let trait_ref = self.tcx.impl_trait_ref(impl_def_id).unwrap();
let trait_def_id = trait_ref.def_id; let trait_def_id = trait_ref.def_id;

View File

@ -81,7 +81,7 @@ impl<'cx, 'tcx,'v> intravisit::Visitor<'v> for UnsafetyChecker<'cx, 'tcx> {
hir::ItemDefaultImpl(unsafety, _) => { hir::ItemDefaultImpl(unsafety, _) => {
self.check_unsafety_coherence(item, unsafety, hir::ImplPolarity::Positive); self.check_unsafety_coherence(item, unsafety, hir::ImplPolarity::Positive);
} }
hir::ItemImpl(unsafety, polarity, _, _, _, _) => { hir::ItemImpl(unsafety, polarity, ..) => {
self.check_unsafety_coherence(item, unsafety, polarity); self.check_unsafety_coherence(item, unsafety, polarity);
} }
_ => { } _ => { }

View File

@ -850,7 +850,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
enforce_impl_lifetimes_are_constrained(ccx, generics, def_id, impl_items); enforce_impl_lifetimes_are_constrained(ccx, generics, def_id, impl_items);
}, },
hir::ItemTrait(_, _, _, ref trait_items) => { hir::ItemTrait(.., ref trait_items) => {
let trait_def = trait_def_of_item(ccx, it); let trait_def = trait_def_of_item(ccx, it);
let def_id = trait_def.trait_ref.def_id; let def_id = trait_def.trait_ref.def_id;
let _: Result<(), ErrorReported> = // any error is already reported, can ignore let _: Result<(), ErrorReported> = // any error is already reported, can ignore
@ -1311,7 +1311,7 @@ fn trait_defines_associated_type_named(ccx: &CrateCtxt,
}; };
let trait_items = match item.node { let trait_items = match item.node {
hir::ItemTrait(_, _, _, ref trait_items) => trait_items, hir::ItemTrait(.., ref trait_items) => trait_items,
_ => bug!("trait_node_id {} is not a trait", trait_node_id) _ => bug!("trait_node_id {} is not a trait", trait_node_id)
}; };
@ -1445,8 +1445,8 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
NodeItem(item) => { NodeItem(item) => {
match item.node { match item.node {
ItemFn(_, _, _, _, ref generics, _) | ItemFn(.., ref generics, _) |
ItemImpl(_, _, ref generics, _, _, _) => generics, ItemImpl(_, _, ref generics, ..) => generics,
ItemTy(_, ref generics) | ItemTy(_, ref generics) |
ItemEnum(_, ref generics) | ItemEnum(_, ref generics) |
@ -1651,7 +1651,7 @@ fn predicates_of_item<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
let no_generics = hir::Generics::empty(); let no_generics = hir::Generics::empty();
let generics = match it.node { let generics = match it.node {
hir::ItemFn(_, _, _, _, ref generics, _) | hir::ItemFn(.., ref generics, _) |
hir::ItemTy(_, ref generics) | hir::ItemTy(_, ref generics) |
hir::ItemEnum(_, ref generics) | hir::ItemEnum(_, ref generics) |
hir::ItemStruct(_, ref generics) | hir::ItemStruct(_, ref generics) |

View File

@ -76,6 +76,7 @@ This API is completely unstable and subject to change.
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(quote)] #![feature(quote)]
#![feature(rustc_diagnostic_macros)] #![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)] #![feature(rustc_private)]
@ -215,7 +216,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
match tcx.map.find(main_id) { match tcx.map.find(main_id) {
Some(hir_map::NodeItem(it)) => { Some(hir_map::NodeItem(it)) => {
match it.node { match it.node {
hir::ItemFn(_, _, _, _, ref generics, _) => { hir::ItemFn(.., ref generics, _) => {
if generics.is_parameterized() { if generics.is_parameterized() {
struct_span_err!(ccx.tcx.sess, generics.span, E0131, struct_span_err!(ccx.tcx.sess, generics.span, E0131,
"main function is not allowed to have type parameters") "main function is not allowed to have type parameters")
@ -267,7 +268,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
match tcx.map.find(start_id) { match tcx.map.find(start_id) {
Some(hir_map::NodeItem(it)) => { Some(hir_map::NodeItem(it)) => {
match it.node { match it.node {
hir::ItemFn(_,_,_,_,ref ps,_) hir::ItemFn(..,ref ps,_)
if ps.is_parameterized() => { if ps.is_parameterized() => {
struct_span_err!(tcx.sess, ps.span, E0132, struct_span_err!(tcx.sess, ps.span, E0132,
"start function is not allowed to have type parameters") "start function is not allowed to have type parameters")

View File

@ -227,6 +227,7 @@
#![feature(const_fn)] #![feature(const_fn)]
#![feature(core_float)] #![feature(core_float)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(dotdot_in_tuple_patterns)]
#![feature(dropck_parametricity)] #![feature(dropck_parametricity)]
#![feature(float_extras)] #![feature(float_extras)]
#![feature(float_from_str_radix)] #![feature(float_from_str_radix)]

View File

@ -200,7 +200,7 @@ impl OpenOptions {
const ERROR_INVALID_PARAMETER: i32 = 87; const ERROR_INVALID_PARAMETER: i32 = 87;
match (self.read, self.write, self.append, self.access_mode) { match (self.read, self.write, self.append, self.access_mode) {
(_, _, _, Some(mode)) => Ok(mode), (.., Some(mode)) => Ok(mode),
(true, false, false, None) => Ok(c::GENERIC_READ), (true, false, false, None) => Ok(c::GENERIC_READ),
(false, true, false, None) => Ok(c::GENERIC_WRITE), (false, true, false, None) => Ok(c::GENERIC_WRITE),
(true, true, false, None) => Ok(c::GENERIC_READ | c::GENERIC_WRITE), (true, true, false, None) => Ok(c::GENERIC_READ | c::GENERIC_WRITE),

View File

@ -562,7 +562,7 @@ impl Pat {
PatKind::Wild | PatKind::Wild |
PatKind::Lit(_) | PatKind::Lit(_) |
PatKind::Range(_, _) | PatKind::Range(_, _) |
PatKind::Ident(_, _, _) | PatKind::Ident(..) |
PatKind::Path(..) | PatKind::Path(..) |
PatKind::Mac(_) => { PatKind::Mac(_) => {
true true

View File

@ -10,6 +10,7 @@
// force-host // force-host
#![feature(dotdot_in_tuple_patterns)]
#![feature(plugin_registrar, quote, rustc_private)] #![feature(plugin_registrar, quote, rustc_private)]
extern crate syntax; extern crate syntax;
@ -75,7 +76,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
Annotatable::ImplItem(_) => { Annotatable::ImplItem(_) => {
quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
match i.node { match i.node {
ItemKind::Impl(_, _, _, _, _, mut items) => { ItemKind::Impl(.., mut items) => {
Annotatable::ImplItem(P(items.pop().expect("impl method not found"))) Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
} }
_ => unreachable!("impl parsed to something other than impl") _ => unreachable!("impl parsed to something other than impl")
@ -85,7 +86,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
Annotatable::TraitItem(_) => { Annotatable::TraitItem(_) => {
quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
match i.node { match i.node {
ItemKind::Trait(_, _, _, mut items) => { ItemKind::Trait(.., mut items) => {
Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
} }
_ => unreachable!("trait parsed to something other than trait") _ => unreachable!("trait parsed to something other than trait")

View File

@ -10,6 +10,7 @@
// force-host // force-host
#![feature(dotdot_in_tuple_patterns)]
#![feature(plugin_registrar, quote, rustc_private)] #![feature(plugin_registrar, quote, rustc_private)]
extern crate syntax; extern crate syntax;
@ -81,7 +82,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
Annotatable::ImplItem(_it) => vec![ Annotatable::ImplItem(_it) => vec![
quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
match i.node { match i.node {
ItemKind::Impl(_, _, _, _, _, mut items) => { ItemKind::Impl(.., mut items) => {
Annotatable::ImplItem(P(items.pop().expect("impl method not found"))) Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
} }
_ => unreachable!("impl parsed to something other than impl") _ => unreachable!("impl parsed to something other than impl")
@ -91,7 +92,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
Annotatable::TraitItem(_it) => vec![ Annotatable::TraitItem(_it) => vec![
quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
match i.node { match i.node {
ItemKind::Trait(_, _, _, mut items) => { ItemKind::Trait(.., mut items) => {
Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
} }
_ => unreachable!("trait parsed to something other than trait") _ => unreachable!("trait parsed to something other than trait")
@ -165,7 +166,7 @@ fn expand_caller(cx: &mut ExtCtxt,
push: &mut FnMut(Annotatable)) { push: &mut FnMut(Annotatable)) {
let (orig_fn_name, ret_type) = match *it { let (orig_fn_name, ret_type) = match *it {
Annotatable::Item(ref item) => match item.node { Annotatable::Item(ref item) => match item.node {
ItemKind::Fn(ref decl, _, _, _, _, _) => { ItemKind::Fn(ref decl, ..) => {
(item.ident, &decl.output) (item.ident, &decl.output)
} }
_ => cx.span_fatal(item.span, "Only functions with return types can be annotated.") _ => cx.span_fatal(item.span, "Only functions with return types can be annotated.")