diff --git a/src/types.rs b/src/types.rs index 32ae4689414..4f930f22cad 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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, diff --git a/tests/source/issue-811.rs b/tests/source/issue-811.rs new file mode 100644 index 00000000000..b7a89b5d0f9 --- /dev/null +++ b/tests/source/issue-811.rs @@ -0,0 +1,19 @@ +trait FooTrait: Sized { + type Bar: BarTrait; +} + +trait BarTrait: Sized { + type Baz; + fn foo(); +} + +type Foo = <>::Bar as BarTrait>::Baz; +type Bar = >::Baz; + +fn some_func, U>() { + <>::Bar as BarTrait>::foo(); +} + +fn some_func>() { + >::foo(); +} diff --git a/tests/target/issue-811.rs b/tests/target/issue-811.rs new file mode 100644 index 00000000000..2b58c06941d --- /dev/null +++ b/tests/target/issue-811.rs @@ -0,0 +1,20 @@ +trait FooTrait: Sized { + type Bar: BarTrait; +} + +trait BarTrait: Sized { + type Baz; + fn foo(); +} + +type Foo = + <>::Bar as BarTrait>::Baz; +type Bar = >::Baz; + +fn some_func, U>() { + <>::Bar as BarTrait>::foo(); +} + +fn some_func>() { + >::foo(); +}