diff --git a/src/types.rs b/src/types.rs index 0c0d9e54424..dfb7f255a98 100644 --- a/src/types.rs +++ b/src/types.rs @@ -42,19 +42,22 @@ pub fn rewrite_path(context: &RewriteContext, if let Some(ref qself) = qself { result.push('<'); result.push_str(&pprust::ty_to_string(&qself.ty)); - result.push_str(" as "); - let extra_offset = extra_offset(&result, offset); - // 3 = ">::".len() - let budget = try_opt!(width.checked_sub(extra_offset)) - 3; + if skip_count > 0 { + result.push_str(" as "); - result = try_opt!(rewrite_path_segments(result, - path.segments.iter().take(skip_count), - span_lo, - path.span.hi, - context, - budget, - offset + extra_offset)); + let extra_offset = extra_offset(&result, offset); + // 3 = ">::".len() + let budget = try_opt!(width.checked_sub(extra_offset)) - 3; + + result = try_opt!(rewrite_path_segments(result, + path.segments.iter().take(skip_count), + span_lo, + path.span.hi, + context, + budget, + offset + extra_offset)); + } result.push_str(">::"); span_lo = qself.ty.span.hi + BytePos(1); diff --git a/tests/source/paths.rs b/tests/source/paths.rs index 51edf707645..d2b4a66622a 100644 --- a/tests/source/paths.rs +++ b/tests/source/paths.rs @@ -15,6 +15,8 @@ fn main() { Quux::::some_func(); + + < *mut JSObject >:: relocate(entry); } fn op(foo: Bar, key : &[u8], upd : Fn(Option<&memcache::Item> , Baz ) -> Result) -> MapResult {} diff --git a/tests/target/paths.rs b/tests/target/paths.rs index c69275c7ff9..4fa3a52fe6c 100644 --- a/tests/target/paths.rs +++ b/tests/target/paths.rs @@ -13,6 +13,8 @@ fn main() { supports_clipboard); Quux::::some_func(); + + <*mut JSObject>::relocate(entry); } fn op(foo: Bar, key: &[u8], upd: Fn(Option<&memcache::Item>, Baz) -> Result) -> MapResult {