1
Fork 0

Merge pull request #845 from regexident/fix_811

Fix for issue #811
This commit is contained in:
Marcus Klaas de Vries 2016-03-02 14:30:49 +01:00
commit c018a972ae
3 changed files with 40 additions and 1 deletions

View file

@ -53,7 +53,7 @@ pub fn rewrite_path(context: &RewriteContext,
// 3 = ">::".len()
let budget = try_opt!(width.checked_sub(extra_offset + 3));
result = try_opt!(rewrite_path_segments(expr_context,
result = try_opt!(rewrite_path_segments(false,
result,
path.segments.iter().take(skip_count),
span_lo,

19
tests/source/issue-811.rs Normal file
View file

@ -0,0 +1,19 @@
trait FooTrait<T>: Sized {
type Bar: BarTrait<T>;
}
trait BarTrait<T>: Sized {
type Baz;
fn foo();
}
type Foo<T: FooTrait> = <<T as FooTrait<U>>::Bar as BarTrait<U>>::Baz;
type Bar<T: BarTrait> = <T as BarTrait<U>>::Baz;
fn some_func<T: FooTrait<U>, U>() {
<<T as FooTrait<U>>::Bar as BarTrait<U>>::foo();
}
fn some_func<T: BarTrait<U>>() {
<T as BarTrait<U>>::foo();
}

20
tests/target/issue-811.rs Normal file
View file

@ -0,0 +1,20 @@
trait FooTrait<T>: Sized {
type Bar: BarTrait<T>;
}
trait BarTrait<T>: Sized {
type Baz;
fn foo();
}
type Foo<T: FooTrait> =
<<T as FooTrait<U>>::Bar as BarTrait<U>>::Baz;
type Bar<T: BarTrait> = <T as BarTrait<U>>::Baz;
fn some_func<T: FooTrait<U>, U>() {
<<T as FooTrait<U>>::Bar as BarTrait<U>>::foo();
}
fn some_func<T: BarTrait<U>>() {
<T as BarTrait<U>>::foo();
}