Skip to content

Commit 8ed5d5d

Browse files
Rustfmt support for negative bounds, test
1 parent 8e330f9 commit 8ed5d5d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/types.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,12 @@ impl Rewrite for ast::GenericBound {
552552
ast::TraitBoundModifier::MaybeConstMaybe => poly_trait_ref
553553
.rewrite(context, shape.offset_left(8)?)
554554
.map(|s| format!("~const ?{}", s)),
555-
rustc_ast::TraitBoundModifier::Negative
556-
| rustc_ast::TraitBoundModifier::MaybeConstNegative => None,
555+
ast::TraitBoundModifier::Negative => poly_trait_ref
556+
.rewrite(context, shape.offset_left(1)?)
557+
.map(|s| format!("!{}", s)),
558+
ast::TraitBoundModifier::MaybeConstNegative => poly_trait_ref
559+
.rewrite(context, shape.offset_left(8)?)
560+
.map(|s| format!("~const !{}", s)),
557561
};
558562
rewrite.map(|s| if has_paren { format!("({})", s) } else { s })
559563
}

tests/target/negative-bounds.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn negative()
2+
where
3+
i32: !Copy,
4+
{
5+
}
6+
7+
fn maybe_const_negative()
8+
where
9+
i32: ~const !Copy,
10+
{
11+
}

0 commit comments

Comments
 (0)