mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Replace _, _, _
with ..
This commit is contained in:
parent
1ca1de6b26
commit
6f7e51e49b
@ -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
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
@ -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, _, _) => {
|
||||
|
@ -62,7 +62,7 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
PatKind::Vec(_, _, _) => true,
|
||||
PatKind::Vec(..) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
},
|
||||
@ -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);
|
||||
}
|
||||
_ => ()
|
||||
|
@ -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",
|
||||
|
@ -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)]
|
||||
|
@ -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(_)) |
|
||||
@ -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) {
|
||||
|
@ -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),
|
||||
@ -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 {:?}",
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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)
|
||||
}
|
||||
@ -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(..) |
|
||||
@ -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);
|
||||
|
@ -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 {
|
||||
@ -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)
|
||||
})
|
||||
@ -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);
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
_ => {}
|
||||
|
@ -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, _) => {
|
||||
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
@ -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)) {
|
||||
@ -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)) {
|
||||
@ -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)) {
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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(_) => {
|
||||
|
@ -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)"),
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(quote)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(rustc_private)]
|
||||
|
@ -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, _, _) => {
|
||||
|
@ -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)]
|
||||
|
@ -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))
|
||||
},
|
||||
@ -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(_) => (),
|
||||
|
@ -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,
|
||||
@ -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, _, _) => {
|
||||
@ -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);
|
||||
@ -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();
|
||||
@ -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",
|
||||
|
@ -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)]
|
||||
|
@ -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();
|
||||
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
|
||||
// have inherited, so we drive self based on the impl structure.
|
||||
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_deprecation(self.rbml_w, depr);
|
||||
}
|
||||
hir::ItemTrait(_, _, _, _) => {
|
||||
hir::ItemTrait(..) => {
|
||||
encode_def_id_and_key(ecx, self.rbml_w, def_id);
|
||||
encode_family(self.rbml_w, 'I');
|
||||
encode_item_variances(self.rbml_w, ecx, item.id);
|
||||
@ -1209,10 +1209,10 @@ impl<'a, 'tcx, 'encoder> IndexBuilder<'a, 'tcx, 'encoder> {
|
||||
hir::ItemUnion(..) => {
|
||||
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);
|
||||
}
|
||||
hir::ItemTrait(_, _, _, ref trait_items) => {
|
||||
hir::ItemTrait(.., ref trait_items) => {
|
||||
self.encode_addl_trait_info(def_id, trait_items);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#![cfg_attr(not(stage0), deny(warnings))]
|
||||
|
||||
#![feature(box_patterns)]
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(enumset)]
|
||||
#![feature(question_mark)]
|
||||
#![feature(quote)]
|
||||
|
@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
|
||||
MirSource::Fn(id) => {
|
||||
let fn_like = FnLikeNode::from_node(infcx.tcx.map.get(id));
|
||||
match fn_like.map(|f| f.kind()) {
|
||||
Some(FnKind::ItemFn(_, _, _, c, _, _, _)) => c,
|
||||
Some(FnKind::ItemFn(_, _, _, c, ..)) => c,
|
||||
Some(FnKind::Method(_, m, _, _)) => m.constness,
|
||||
_ => hir::Constness::NotConst
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
||||
|
||||
#![feature(associated_consts)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(staged_api)]
|
||||
|
@ -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) {
|
||||
let fn_like = FnLikeNode::from_node(tcx.map.get(node_id));
|
||||
match fn_like.map(|f| f.kind()) {
|
||||
Some(FnKind::ItemFn(_, _, _, c, _, _, _)) => {
|
||||
Some(FnKind::ItemFn(_, _, _, c, ..)) => {
|
||||
c == hir::Constness::Const
|
||||
}
|
||||
Some(FnKind::Method(_, m, _, _)) => {
|
||||
|
@ -100,8 +100,8 @@ impl<'a> Visitor for AstValidator<'a> {
|
||||
match expr.node {
|
||||
ExprKind::While(_, _, Some(ident)) |
|
||||
ExprKind::Loop(_, Some(ident)) |
|
||||
ExprKind::WhileLet(_, _, _, Some(ident)) |
|
||||
ExprKind::ForLoop(_, _, _, Some(ident)) |
|
||||
ExprKind::WhileLet(.., Some(ident)) |
|
||||
ExprKind::ForLoop(.., Some(ident)) |
|
||||
ExprKind::Break(Some(ident)) |
|
||||
ExprKind::Continue(Some(ident)) => {
|
||||
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");
|
||||
}
|
||||
}
|
||||
ItemKind::Impl(_, _, _, Some(..), _, ref impl_items) => {
|
||||
ItemKind::Impl(.., Some(..), _, ref impl_items) => {
|
||||
self.invalid_visibility(&item.vis, item.span, None);
|
||||
for impl_item in impl_items {
|
||||
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,
|
||||
item.span,
|
||||
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 {
|
||||
if let TraitItemKind::Method(ref sig, _) = trait_item.node {
|
||||
self.check_trait_fn_not_const(sig.constness);
|
||||
|
@ -147,7 +147,7 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> {
|
||||
}
|
||||
|
||||
let mode = match fk {
|
||||
FnKind::ItemFn(_, _, _, hir::Constness::Const, _, _, _)
|
||||
FnKind::ItemFn(_, _, _, hir::Constness::Const, ..)
|
||||
=> Mode::ConstFn,
|
||||
FnKind::Method(_, m, _, _) => {
|
||||
if m.constness == hir::Constness::Const {
|
||||
|
@ -23,6 +23,7 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
#![cfg_attr(not(stage0), deny(warnings))]
|
||||
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(staged_api)]
|
||||
#![feature(rustc_private)]
|
||||
|
@ -17,6 +17,7 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/")]
|
||||
#![cfg_attr(not(stage0), deny(warnings))]
|
||||
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(rustc_private)]
|
||||
#![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) {
|
||||
let inherited_item_level = match item.node {
|
||||
// Impls inherit level from their types and traits
|
||||
hir::ItemImpl(_, _, _, None, ref ty, _) => {
|
||||
hir::ItemImpl(.., None, ref 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))
|
||||
}
|
||||
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 {
|
||||
if impl_item.vis == hir::Public {
|
||||
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 {
|
||||
self.update(impl_item.id, item_level);
|
||||
}
|
||||
}
|
||||
hir::ItemTrait(_, _, _, ref trait_items) => {
|
||||
hir::ItemTrait(.., ref trait_items) => {
|
||||
for trait_item in trait_items {
|
||||
self.update(trait_item.id, item_level);
|
||||
}
|
||||
@ -204,7 +205,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
|
||||
hir::ItemUse(..) => {}
|
||||
// Visit everything
|
||||
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() {
|
||||
self.reach().visit_item(item);
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ impl<'b> Resolver<'b> {
|
||||
let def = Def::Const(self.definitions.local_def_id(item.id));
|
||||
self.define(parent, name, ValueNS, (def, sp, vis));
|
||||
}
|
||||
ItemKind::Fn(_, _, _, _, _, _) => {
|
||||
ItemKind::Fn(..) => {
|
||||
let def = Def::Fn(self.definitions.local_def_id(item.id));
|
||||
self.define(parent, name, ValueNS, (def, sp, vis));
|
||||
}
|
||||
@ -294,7 +294,7 @@ impl<'b> Resolver<'b> {
|
||||
|
||||
ItemKind::DefaultImpl(_, _) | ItemKind::Impl(..) => {}
|
||||
|
||||
ItemKind::Trait(_, _, _, ref items) => {
|
||||
ItemKind::Trait(.., ref items) => {
|
||||
let def_id = self.definitions.local_def_id(item.id);
|
||||
|
||||
// Add all the items within to a new module.
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#![feature(associated_consts)]
|
||||
#![feature(borrow_state)]
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(staged_api)]
|
||||
@ -599,7 +600,7 @@ impl<'a> Visitor for Resolver<'a> {
|
||||
_: Span,
|
||||
node_id: NodeId) {
|
||||
let rib_kind = match function_kind {
|
||||
FnKind::ItemFn(_, generics, _, _, _, _) => {
|
||||
FnKind::ItemFn(_, generics, ..) => {
|
||||
self.visit_generics(generics);
|
||||
ItemRibKind
|
||||
}
|
||||
@ -1634,7 +1635,7 @@ impl<'a> Resolver<'a> {
|
||||
ItemKind::Ty(_, ref generics) |
|
||||
ItemKind::Struct(_, ref generics) |
|
||||
ItemKind::Union(_, ref generics) |
|
||||
ItemKind::Fn(_, _, _, _, ref generics, _) => {
|
||||
ItemKind::Fn(.., ref generics, _) => {
|
||||
self.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind),
|
||||
|this| visit::walk_item(this, item));
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
|
||||
}.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),
|
||||
Static(ref typ, _, ref expr) =>
|
||||
self.process_static_or_const_item(item, typ, expr),
|
||||
|
@ -18,6 +18,7 @@
|
||||
#![cfg_attr(not(stage0), deny(warnings))]
|
||||
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![allow(unused_attributes)]
|
||||
#![feature(rustc_private)]
|
||||
#![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> {
|
||||
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 sub_span = self.span_utils.sub_span_after_keyword(item.span, keywords::Fn);
|
||||
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(),
|
||||
}))
|
||||
}
|
||||
ast::ItemKind::Impl(_, _, _, ref trait_ref, ref typ, _) => {
|
||||
ast::ItemKind::Impl(.., ref trait_ref, ref typ, _) => {
|
||||
let mut type_data = None;
|
||||
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(NodeItem(item)) => {
|
||||
match item.node {
|
||||
hir::ItemImpl(_, _, _, _, ref ty, _) => {
|
||||
hir::ItemImpl(.., ref ty, _) => {
|
||||
let mut result = String::from("<");
|
||||
result.push_str(&rustc::hir::print::ty_to_string(&ty));
|
||||
|
||||
|
@ -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
|
||||
// actually used somewhere. Just declaring them is insufficient.
|
||||
}
|
||||
hir::ItemFn(_, _, _, _, ref generics, _) => {
|
||||
hir::ItemFn(.., ref generics, _) => {
|
||||
if !generics.is_type_parameterized() {
|
||||
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 is_impl_generic = match hir_map.expect_item(parent_node_id) {
|
||||
&hir::Item {
|
||||
node: hir::ItemImpl(_, _, ref generics, _, _, _),
|
||||
node: hir::ItemImpl(_, _, ref generics, ..),
|
||||
..
|
||||
} => {
|
||||
generics.is_type_parameterized()
|
||||
|
@ -27,6 +27,7 @@
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(custom_attribute)]
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![allow(unused_attributes)]
|
||||
#![feature(libc)]
|
||||
#![feature(quote)]
|
||||
|
@ -1358,7 +1358,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
|
||||
// `ty::trait_items` used below requires information generated
|
||||
// by type collection, which may be in progress at this point.
|
||||
match tcx.map.expect_item(trait_id).node {
|
||||
hir::ItemTrait(_, _, _, ref trait_items) => {
|
||||
hir::ItemTrait(.., ref trait_items) => {
|
||||
let item = trait_items.iter()
|
||||
.find(|i| i.name == assoc_name)
|
||||
.expect("missing associated type");
|
||||
|
@ -741,7 +741,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
|
||||
it.id);
|
||||
}
|
||||
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);
|
||||
let impl_def_id = ccx.tcx.map.local_def_id(it.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)));
|
||||
let _indenter = indenter();
|
||||
match it.node {
|
||||
hir::ItemFn(ref decl, _, _, _, _, ref body) => {
|
||||
hir::ItemFn(ref decl, .., ref body) => {
|
||||
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);
|
||||
|
||||
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 {
|
||||
match trait_item.node {
|
||||
hir::ConstTraitItem(_, Some(ref expr)) => {
|
||||
|
@ -126,7 +126,7 @@ impl<'ccx, 'gcx> CheckTypeWellFormedVisitor<'ccx, 'gcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
hir::ItemFn(_, _, _, _, _, ref body) => {
|
||||
hir::ItemFn(.., ref body) => {
|
||||
self.check_item_fn(item, body);
|
||||
}
|
||||
hir::ItemStatic(..) => {
|
||||
@ -156,7 +156,7 @@ impl<'ccx, 'gcx> CheckTypeWellFormedVisitor<'ccx, 'gcx> {
|
||||
|
||||
self.check_variances_for_type_defn(item, ast_generics);
|
||||
}
|
||||
hir::ItemTrait(_, _, _, ref items) => {
|
||||
hir::ItemTrait(.., ref items) => {
|
||||
self.check_trait(item, items);
|
||||
}
|
||||
_ => {}
|
||||
|
@ -195,7 +195,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
|
||||
// Converts an implementation in the AST to a vector of items.
|
||||
fn create_impl_from_item(&self, item: &Item) -> Vec<ImplOrTraitItemId> {
|
||||
match item.node {
|
||||
ItemImpl(_, _, _, _, _, ref impl_items) => {
|
||||
ItemImpl(.., ref impl_items) => {
|
||||
impl_items.iter().map(|impl_item| {
|
||||
let impl_def_id = self.crate_context.tcx.map.local_def_id(impl_item.id);
|
||||
match impl_item.node {
|
||||
@ -252,7 +252,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
|
||||
match tcx.map.find(impl_node_id) {
|
||||
Some(hir_map::NodeItem(item)) => {
|
||||
let span = match item.node {
|
||||
ItemImpl(_, _, _, _, ref ty, _) => {
|
||||
ItemImpl(.., ref ty, _) => {
|
||||
ty.span
|
||||
},
|
||||
_ => item.span
|
||||
@ -324,7 +324,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
Err(CopyImplementationError::InfrigingVariant(name)) => {
|
||||
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
|
||||
} else {
|
||||
span
|
||||
@ -338,7 +338,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
|
||||
}
|
||||
Err(CopyImplementationError::NotAnAdt) => {
|
||||
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
|
||||
} else {
|
||||
span
|
||||
@ -463,7 +463,7 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> {
|
||||
return;
|
||||
} else if diff_fields.len() > 1 {
|
||||
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
|
||||
} else {
|
||||
tcx.map.span(impl_node_id)
|
||||
|
@ -68,7 +68,7 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
|
||||
fn check_item(&self, item: &hir::Item) {
|
||||
let def_id = self.tcx.map.local_def_id(item.id);
|
||||
match item.node {
|
||||
hir::ItemImpl(_, _, _, None, ref ty, _) => {
|
||||
hir::ItemImpl(.., None, ref ty, _) => {
|
||||
// For inherent impls, self type must be a nominal type
|
||||
// defined in this crate.
|
||||
debug!("coherence2::orphan check: inherent impl {}",
|
||||
@ -222,7 +222,7 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
hir::ItemImpl(_, _, _, Some(_), _, _) => {
|
||||
hir::ItemImpl(.., Some(_), _, _) => {
|
||||
// "Trait" impl
|
||||
debug!("coherence2::orphan check: trait impl {}",
|
||||
self.tcx.map.node_to_string(item.id));
|
||||
|
@ -122,7 +122,7 @@ impl<'cx, 'tcx,'v> intravisit::Visitor<'v> for OverlapChecker<'cx, 'tcx> {
|
||||
err.emit();
|
||||
}
|
||||
}
|
||||
hir::ItemImpl(_, _, _, Some(_), _, _) => {
|
||||
hir::ItemImpl(.., Some(_), _, _) => {
|
||||
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_def_id = trait_ref.def_id;
|
||||
|
@ -81,7 +81,7 @@ impl<'cx, 'tcx,'v> intravisit::Visitor<'v> for UnsafetyChecker<'cx, 'tcx> {
|
||||
hir::ItemDefaultImpl(unsafety, _) => {
|
||||
self.check_unsafety_coherence(item, unsafety, hir::ImplPolarity::Positive);
|
||||
}
|
||||
hir::ItemImpl(unsafety, polarity, _, _, _, _) => {
|
||||
hir::ItemImpl(unsafety, polarity, ..) => {
|
||||
self.check_unsafety_coherence(item, unsafety, polarity);
|
||||
}
|
||||
_ => { }
|
||||
|
@ -850,7 +850,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
|
||||
|
||||
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 def_id = trait_def.trait_ref.def_id;
|
||||
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 {
|
||||
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)
|
||||
};
|
||||
|
||||
@ -1445,8 +1445,8 @@ fn generics_of_def_id<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||
|
||||
NodeItem(item) => {
|
||||
match item.node {
|
||||
ItemFn(_, _, _, _, ref generics, _) |
|
||||
ItemImpl(_, _, ref generics, _, _, _) => generics,
|
||||
ItemFn(.., ref generics, _) |
|
||||
ItemImpl(_, _, ref generics, ..) => generics,
|
||||
|
||||
ItemTy(_, 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 generics = match it.node {
|
||||
hir::ItemFn(_, _, _, _, ref generics, _) |
|
||||
hir::ItemFn(.., ref generics, _) |
|
||||
hir::ItemTy(_, ref generics) |
|
||||
hir::ItemEnum(_, ref generics) |
|
||||
hir::ItemStruct(_, ref generics) |
|
||||
|
@ -76,6 +76,7 @@ This API is completely unstable and subject to change.
|
||||
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(quote)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
#![feature(rustc_private)]
|
||||
@ -215,7 +216,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
|
||||
match tcx.map.find(main_id) {
|
||||
Some(hir_map::NodeItem(it)) => {
|
||||
match it.node {
|
||||
hir::ItemFn(_, _, _, _, ref generics, _) => {
|
||||
hir::ItemFn(.., ref generics, _) => {
|
||||
if generics.is_parameterized() {
|
||||
struct_span_err!(ccx.tcx.sess, generics.span, E0131,
|
||||
"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) {
|
||||
Some(hir_map::NodeItem(it)) => {
|
||||
match it.node {
|
||||
hir::ItemFn(_,_,_,_,ref ps,_)
|
||||
hir::ItemFn(..,ref ps,_)
|
||||
if ps.is_parameterized() => {
|
||||
struct_span_err!(tcx.sess, ps.span, E0132,
|
||||
"start function is not allowed to have type parameters")
|
||||
|
@ -227,6 +227,7 @@
|
||||
#![feature(const_fn)]
|
||||
#![feature(core_float)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(dropck_parametricity)]
|
||||
#![feature(float_extras)]
|
||||
#![feature(float_from_str_radix)]
|
||||
|
@ -200,7 +200,7 @@ impl OpenOptions {
|
||||
const ERROR_INVALID_PARAMETER: i32 = 87;
|
||||
|
||||
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),
|
||||
(false, true, false, None) => Ok(c::GENERIC_WRITE),
|
||||
(true, true, false, None) => Ok(c::GENERIC_READ | c::GENERIC_WRITE),
|
||||
|
@ -562,7 +562,7 @@ impl Pat {
|
||||
PatKind::Wild |
|
||||
PatKind::Lit(_) |
|
||||
PatKind::Range(_, _) |
|
||||
PatKind::Ident(_, _, _) |
|
||||
PatKind::Ident(..) |
|
||||
PatKind::Path(..) |
|
||||
PatKind::Mac(_) => {
|
||||
true
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
// force-host
|
||||
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(plugin_registrar, quote, rustc_private)]
|
||||
|
||||
extern crate syntax;
|
||||
@ -75,7 +76,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
|
||||
Annotatable::ImplItem(_) => {
|
||||
quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
|
||||
match i.node {
|
||||
ItemKind::Impl(_, _, _, _, _, mut items) => {
|
||||
ItemKind::Impl(.., mut items) => {
|
||||
Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
|
||||
}
|
||||
_ => unreachable!("impl parsed to something other than impl")
|
||||
@ -85,7 +86,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
|
||||
Annotatable::TraitItem(_) => {
|
||||
quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
|
||||
match i.node {
|
||||
ItemKind::Trait(_, _, _, mut items) => {
|
||||
ItemKind::Trait(.., mut items) => {
|
||||
Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
|
||||
}
|
||||
_ => unreachable!("trait parsed to something other than trait")
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
// force-host
|
||||
|
||||
#![feature(dotdot_in_tuple_patterns)]
|
||||
#![feature(plugin_registrar, quote, rustc_private)]
|
||||
|
||||
extern crate syntax;
|
||||
@ -81,7 +82,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
|
||||
Annotatable::ImplItem(_it) => vec![
|
||||
quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
|
||||
match i.node {
|
||||
ItemKind::Impl(_, _, _, _, _, mut items) => {
|
||||
ItemKind::Impl(.., mut items) => {
|
||||
Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
|
||||
}
|
||||
_ => unreachable!("impl parsed to something other than impl")
|
||||
@ -91,7 +92,7 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
|
||||
Annotatable::TraitItem(_it) => vec![
|
||||
quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
|
||||
match i.node {
|
||||
ItemKind::Trait(_, _, _, mut items) => {
|
||||
ItemKind::Trait(.., mut items) => {
|
||||
Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
|
||||
}
|
||||
_ => unreachable!("trait parsed to something other than trait")
|
||||
@ -165,7 +166,7 @@ fn expand_caller(cx: &mut ExtCtxt,
|
||||
push: &mut FnMut(Annotatable)) {
|
||||
let (orig_fn_name, ret_type) = match *it {
|
||||
Annotatable::Item(ref item) => match item.node {
|
||||
ItemKind::Fn(ref decl, _, _, _, _, _) => {
|
||||
ItemKind::Fn(ref decl, ..) => {
|
||||
(item.ident, &decl.output)
|
||||
}
|
||||
_ => cx.span_fatal(item.span, "Only functions with return types can be annotated.")
|
||||
|
Loading…
Reference in New Issue
Block a user