diff options
| author | Michael Goulet <michael@errs.io> | 2023-04-26 22:37:36 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-05-02 22:36:25 +0000 |
| commit | 8ed5d5de3d4e2cf94ddd00cee922d8533d23c1dd (patch) | |
| tree | 4af4abfa1144a91811da2d99520476ea4a76faa0 /src | |
| parent | 8e330f9d5bb92b24afde750480b5d70d6c892da5 (diff) | |
| download | rust-8ed5d5de3d4e2cf94ddd00cee922d8533d23c1dd.tar.gz rust-8ed5d5de3d4e2cf94ddd00cee922d8533d23c1dd.zip | |
Rustfmt support for negative bounds, test
Diffstat (limited to 'src')
| -rw-r--r-- | src/types.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/types.rs b/src/types.rs index 9ebe38cc25f..f548388ed8b 100644 --- a/src/types.rs +++ b/src/types.rs @@ -552,8 +552,12 @@ impl Rewrite for ast::GenericBound { ast::TraitBoundModifier::MaybeConstMaybe => poly_trait_ref .rewrite(context, shape.offset_left(8)?) .map(|s| format!("~const ?{}", s)), - rustc_ast::TraitBoundModifier::Negative - | rustc_ast::TraitBoundModifier::MaybeConstNegative => None, + ast::TraitBoundModifier::Negative => poly_trait_ref + .rewrite(context, shape.offset_left(1)?) + .map(|s| format!("!{}", s)), + ast::TraitBoundModifier::MaybeConstNegative => poly_trait_ref + .rewrite(context, shape.offset_left(8)?) + .map(|s| format!("~const !{}", s)), }; rewrite.map(|s| if has_paren { format!("({})", s) } else { s }) } |
