librustc: Disallow use from reaching into impls or traits.

This can perhaps be restored in the future. For now this is a precursor to
making typedefs work as expected.
This commit is contained in:
Patrick Walton 2013-05-13 16:13:20 -07:00
parent 291518712f
commit ca9bb2d9ac
5 changed files with 187 additions and 65 deletions

View file

@ -0,0 +1,10 @@
pub trait Trait {
fn foo();
}
struct Foo;
impl Foo {
pub fn new() {}
}

View file

@ -0,0 +1,12 @@
// aux-build:use_from_trait_xc.rs
extern mod use_from_trait_xc;
use use_from_trait_xc::Trait::foo; //~ ERROR cannot import from a trait or type implementation
//~^ ERROR failed to resolve import
use use_from_trait_xc::Foo::new; //~ ERROR cannot import from a trait or type implementation
//~^ ERROR failed to resolve import
fn main() {
}

View file

@ -0,0 +1,17 @@
use Trait::foo; //~ ERROR cannot import from a trait or type implementation
//~^ ERROR failed to resolve import
use Foo::new; //~ ERROR cannot import from a trait or type implementation
//~^ ERROR failed to resolve import
pub trait Trait {
fn foo();
}
struct Foo;
impl Foo {
fn new() {}
}
fn main() {}