rustc: Resolve bounds of trait type parameters
This commit is contained in:
parent
18da7fef88
commit
dac4916cec
@ -2920,6 +2920,8 @@ class Resolver {
|
||||
NormalRibKind))
|
||||
|| {
|
||||
|
||||
self.resolve_type_parameters(type_parameters, visitor);
|
||||
|
||||
for methods.each |method| {
|
||||
// Create a new rib for the method-specific type
|
||||
// parameters.
|
||||
|
25
src/test/run-pass/trait-bounds.rs
Normal file
25
src/test/run-pass/trait-bounds.rs
Normal file
@ -0,0 +1,25 @@
|
||||
trait connection {
|
||||
fn read() -> int;
|
||||
}
|
||||
|
||||
trait connection_factory<C: connection> {
|
||||
fn create() -> C;
|
||||
}
|
||||
|
||||
type my_connection = ();
|
||||
type my_connection_factory = ();
|
||||
|
||||
impl of connection for () {
|
||||
fn read() -> int { 43 }
|
||||
}
|
||||
|
||||
impl of connection_factory<my_connection> for my_connection_factory {
|
||||
fn create() -> my_connection { () }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let factory = ();
|
||||
let connection = factory.create();
|
||||
let result = connection.read();
|
||||
assert result == 43;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user