Skip to content

Commit c6376e6

Browse files
brkkkysen
authored andcommitted
Add test exposing buggy behavior (only visible via token stream)
1 parent 39907f6 commit c6376e6

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

c2rust-ast-builder/src/builder.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,7 @@ impl<S: Make<PathSegment>> Make<Path> for Vec<S> {
315315
fn make(self, mk: &Builder) -> Path {
316316
let mut segments = Punctuated::new();
317317
for s in self {
318-
let segment = s.make(mk);
319-
let has_params = !segment.arguments.is_empty();
320-
segments.push(segment);
321-
// separate params from their segment with ::
322-
if has_params {
323-
segments.push_punct(Default::default());
324-
}
318+
segments.push(s.make(mk));
325319
}
326320
Path {
327321
leading_colon: None,

c2rust-transpile/tests/tokens.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use c2rust_ast_builder::mk;
2+
use syn::__private::ToTokens;
3+
4+
#[test]
5+
fn test_tokenize() {
6+
let tys = vec![mk().path_ty(vec!["t"])];
7+
let args = mk().angle_bracketed_args(tys);
8+
let path_segment = mk().path_segment_with_args("x", args);
9+
assert_eq!(path_segment.to_token_stream().to_string(), "x :: < t >");
10+
11+
let path = mk().path(vec![path_segment]);
12+
assert_eq!(path.to_token_stream().to_string(), "x :: < t >");
13+
}

0 commit comments

Comments
 (0)