auto merge of #6880 : thomaslee/rust/issue-6745, r=catamorphism

This fixes #6745, which itself relates to #4202. Slightly ham-fisted -- feel particularly funny about using the typeck phase to gather the base -> impl mapping, and the separate code paths for traits vs. "real" bases feels like it could be avoided -- but it seems to work.

As always, open to suggestions if there's a better way to accomplish what I'm trying to do.

@catamorphism r?
This commit is contained in:
bors 2013-06-01 15:46:40 -07:00
commit 24e85ac82d
5 changed files with 122 additions and 34 deletions

View file

@ -10,6 +10,8 @@
pub use sub_foo::Foo;
pub use Baz = self::Bar;
pub use sub_foo::Boz;
pub use sub_foo::Bort;
pub trait Bar {
pub fn bar() -> Self;
@ -28,4 +30,24 @@ pub mod sub_foo {
pub fn foo() -> int { 42 }
}
pub struct Boz {
unused_str: ~str
}
pub impl Boz {
pub fn boz(i: int) -> bool {
i > 0
}
}
pub enum Bort {
Bort1,
Bort2
}
pub impl Bort {
pub fn bort() -> ~str {
~"bort()"
}
}
}

View file

@ -9,13 +9,17 @@
// except according to those terms.
// xfail-fast
// aux-build:mod_trait_with_static_methods_lib.rs
extern mod mod_trait_with_static_methods_lib;
// aux-build:reexported_static_methods.rs
extern mod reexported_static_methods;
use mod_trait_with_static_methods_lib::Foo;
use mod_trait_with_static_methods_lib::Baz;
use reexported_static_methods::Foo;
use reexported_static_methods::Baz;
use reexported_static_methods::Boz;
use reexported_static_methods::Bort;
pub fn main() {
assert_eq!(42, Foo::foo());
assert_eq!(84, Baz::bar());
assert!(Boz::boz(1));
assert_eq!(~"bort()", Bort::bort());
}