/// Iterates through "auxiliary node IDs", which are node IDs that describe
/// top-level items that are sub-items of the given item. Specifically:
///
-/// * For enums, iterates through the node IDs of the variants.
-///
/// * For newtype structs, iterates through the node ID of the constructor.
fn each_auxiliary_node_id(item: &ast::Item, callback: |NodeId| -> bool) -> bool {
let mut continue_ = true;
match item.node {
- ast::ItemEnum(ref enum_def, _) => {
- for variant in enum_def.variants.iter() {
- continue_ = callback(variant.node.id);
- if !continue_ {
- break
- }
- }
- }
ast::ItemStruct(ref struct_def, _) => {
// If this is a newtype struct, return the constructor.
match struct_def.ctor_id {
pub use self::CallConv::*;
pub use self::Visibility::*;
pub use self::DiagnosticSeverity::*;
+pub use self::Linkage::*;
use std::c_str::ToCStr;
use std::cell::RefCell;
extern crate "issue-13872-1" as foo;
-pub use foo::B;
+pub use foo::A::B;
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct Foo (pub int);
+pub enum MyEnum {
+ Foo(Foo),
+}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:namespaced_enums.rs
+extern crate namespaced_enums;
+
+fn main() {
+ let _ = namespaced_enums::A; //~ ERROR unresolved name
+ let _ = namespaced_enums::B(10); //~ ERROR unresolved name
+ let _ = namespaced_enums::C { a: 10 }; //~ ERROR does not name a structure
+}
extern crate "unreachable-variant" as other;
fn main() {
- let _x = other::super_sekrit::baz; //~ ERROR is private
+ let _x = other::super_sekrit::sooper_sekrit::baz; //~ ERROR is private
}
let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct();
//~^ ERROR method `meth_struct` is private
- let _ = xc_private_method_lib::Variant1(20).meth_enum();
+ let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum();
//~^ ERROR method `meth_enum` is private
}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue_19293.rs
+extern crate issue_19293;
+use issue_19293::{Foo, MyEnum};
+
+fn main() {
+ MyEnum::Foo(Foo(5));
+}
use issue_2316_b::cloth;
pub fn main() {
- let _c: cloth::fabric = cloth::calico;
+ let _c: cloth::fabric = cloth::fabric::calico;
}
// aux-build:issue-8259.rs
extern crate "issue-8259" as other;
-static a: other::Foo<'static> = other::A;
+static a: other::Foo<'static> = other::Foo::A;
pub fn main() {}
// aux-build:struct_variant_xc_aux.rs
extern crate struct_variant_xc_aux;
-use struct_variant_xc_aux::StructVariant;
+use struct_variant_xc_aux::Enum::StructVariant;
pub fn main() {
let _ = StructVariant { arg: 1 };
// aux-build:struct_variant_xc_aux.rs
extern crate struct_variant_xc_aux;
-use struct_variant_xc_aux::{StructVariant, Variant};
+use struct_variant_xc_aux::Enum::{StructVariant, Variant};
pub fn main() {
let arg = match (StructVariant { arg: 42 }) {
extern crate xcrate_unit_struct;
const s1: xcrate_unit_struct::Struct = xcrate_unit_struct::Struct;
-static s2: xcrate_unit_struct::Unit = xcrate_unit_struct::UnitVariant;
+static s2: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::UnitVariant;
static s3: xcrate_unit_struct::Unit =
- xcrate_unit_struct::Argument(xcrate_unit_struct::Struct);
-static s4: xcrate_unit_struct::Unit = xcrate_unit_struct::Argument(s1);
+ xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct);
+static s4: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::Argument(s1);
static s5: xcrate_unit_struct::TupleStruct = xcrate_unit_struct::TupleStruct(20, "foo");
fn f1(_: xcrate_unit_struct::Struct) {}
pub fn main() {
f1(xcrate_unit_struct::Struct);
- f2(xcrate_unit_struct::UnitVariant);
- f2(xcrate_unit_struct::Argument(xcrate_unit_struct::Struct));
+ f2(xcrate_unit_struct::Unit::UnitVariant);
+ f2(xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct));
f3(xcrate_unit_struct::TupleStruct(10, "bar"));
f1(s1);