From 150c333e6cb9b86ed307c3e1ceb8b71abf6de298 Mon Sep 17 00:00:00 2001 From: Marcus Klaas Date: Fri, 21 Aug 2015 16:28:32 +0200 Subject: [PATCH] Fix bug in path formatting --- src/types.rs | 4 ++-- tests/source/structs.rs | 6 ++++++ tests/target/structs.rs | 12 ++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/types.rs b/src/types.rs index 3bdb08cc0d2..6df5a788b1e 100644 --- a/src/types.rs +++ b/src/types.rs @@ -240,7 +240,7 @@ fn rewrite_segment(segment: &ast::PathSegment, None => String::new(), }; - let list_lo = span_after(codemap::mk_sp(*span_lo, span_hi), "(", context.codemap); + let list_lo = span_after(data.span, "(", context.codemap); let items = itemize_list(context.codemap, data.inputs.iter(), ")", @@ -265,7 +265,7 @@ fn rewrite_segment(segment: &ast::PathSegment, }; // update pos - *span_lo = data.inputs.last().unwrap().span.hi + BytePos(1); + *span_lo = data.span.hi + BytePos(1); format!("({}){}", write_list(&items.collect::>(), &fmt), output) } diff --git a/tests/source/structs.rs b/tests/source/structs.rs index ace13fe2889..68c7ff0df3c 100644 --- a/tests/source/structs.rs +++ b/tests/source/structs.rs @@ -68,3 +68,9 @@ struct Tuple( A, //Comment B ); + +pub struct State time::Timespec> { now: F } + +pub struct State ()> { now: F } + +pub struct State { now: F } diff --git a/tests/target/structs.rs b/tests/target/structs.rs index 84b7334008d..1f48c66b6a4 100644 --- a/tests/target/structs.rs +++ b/tests/target/structs.rs @@ -65,3 +65,15 @@ struct Baz { // Will this be a one-liner? struct Tuple(A /* Comment */, B); + +pub struct State time::Timespec> { + now: F, +} + +pub struct State ()> { + now: F, +} + +pub struct State { + now: F, +}