First stage of enum namespacing changes
This commit is contained in:
parent
88b6e93d35
commit
d7ff7da65a
17 changed files with 584 additions and 94 deletions
|
|
@ -13,7 +13,7 @@ mod Foo {
|
|||
}
|
||||
|
||||
enum Foo { //~ ERROR duplicate definition of type or module `Foo`
|
||||
X
|
||||
X //~ ERROR duplicate definition of value `X`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
// 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
|
||||
#![feature(struct_variant, globs)]
|
||||
|
||||
extern crate namespaced_enums;
|
||||
|
||||
mod m {
|
||||
pub use namespaced_enums::Foo::*;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
use namespaced_enums::Foo::*;
|
||||
|
||||
foo(); //~ ERROR unresolved name `foo`
|
||||
m::foo(); //~ ERROR unresolved name `m::foo`
|
||||
bar(); //~ ERROR unresolved name `bar`
|
||||
m::bar(); //~ ERROR unresolved name `m::bar`
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
// 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.
|
||||
#![feature(struct_variant, globs)]
|
||||
|
||||
mod m2 {
|
||||
pub enum Foo {
|
||||
A,
|
||||
B(int),
|
||||
C { a: int },
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
pub fn foo() {}
|
||||
pub fn bar(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
mod m {
|
||||
pub use m2::Foo::*;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
use m2::Foo::*;
|
||||
|
||||
foo(); //~ ERROR unresolved name `foo`
|
||||
m::foo(); //~ ERROR unresolved name `m::foo`
|
||||
bar(); //~ ERROR unresolved name `bar`
|
||||
m::bar(); //~ ERROR unresolved name `m::bar`
|
||||
}
|
||||
|
|
@ -13,12 +13,15 @@
|
|||
extern crate use_from_trait_xc;
|
||||
|
||||
use use_from_trait_xc::Trait::foo;
|
||||
//~^ ERROR unresolved import `use_from_trait_xc::Trait::foo`. Cannot import from a trait or type imp
|
||||
//~^ ERROR `foo` is not directly importable
|
||||
|
||||
use use_from_trait_xc::Foo::new;
|
||||
//~^ ERROR unresolved import `use_from_trait_xc::Foo::new`. Cannot import from a trait or type imple
|
||||
//~^ ERROR `new` is not directly importable
|
||||
|
||||
use use_from_trait_xc::Bar::new;
|
||||
//~^ ERROR unresolved import `use_from_trait_xc::Bar::new`. Cannot import from a trait or type
|
||||
use use_from_trait_xc::Bar::new as bnew;
|
||||
//~^ ERROR `bnew` is not directly importable
|
||||
|
||||
use use_from_trait_xc::Baz::new as baznew;
|
||||
//~^ ERROR `baznew` is not directly importable
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
// except according to those terms.
|
||||
|
||||
use Trait::foo;
|
||||
//~^ ERROR unresolved import `Trait::foo`. Cannot import from a trait or type implementation
|
||||
//~^ ERROR `foo` is not directly importable
|
||||
use Foo::new;
|
||||
//~^ ERROR unresolved import `Foo::new`. Cannot import from a trait or type implementation
|
||||
//~^ ERROR `new` is not directly importable
|
||||
|
||||
pub trait Trait {
|
||||
fn foo();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue