Skip to content

Commit

Permalink
Merge pull request #74 from andrewbaxter/fix-static-mut
Browse files Browse the repository at this point in the history
Retain mut in static mut
  • Loading branch information
andrewbaxter authored May 10, 2024
2 parents 46a8ca9 + 33d9979 commit 07b9999
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/sg_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ impl Formattable for Item {
append_vis(out, base_indent, &mut sg, &x.vis);
append_whitespace(out, base_indent, &mut sg, x.static_token.span.start());
sg.seg(out, "static ");
if let Some(x) = x.mutability {
append_whitespace(out, base_indent, &mut sg, x.span.start());
sg.seg(out, "mut ");
}
sg.seg(out, &x.ident.to_string());
sg.seg(out, ": ");
sg.child(x.ty.make_segs(out, base_indent));
Expand Down
6 changes: 6 additions & 0 deletions tests/roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,9 @@ fn rt_extern_c_static1() {
}
"#);
}

#[test]
fn rt_static_mut1() {
rt(r#"static mut X: Y = Y(7);
"#);
}

0 comments on commit 07b9999

Please sign in to comment.