]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_ast_pretty/src/pprust/state.rs
Expand const-if-const trait bounds correctly
[rust.git] / compiler / rustc_ast_pretty / src / pprust / state.rs
index d7767efa9841bc65383b76767c821ddae74379d0..cd621bc67a1de9328e4fec0d2ebc27fa721df944 100644 (file)
@@ -1567,8 +1567,18 @@ pub fn print_type_bounds(&mut self, bounds: &[ast::GenericBound]) {
 
             match bound {
                 GenericBound::Trait(tref, modifier) => {
-                    if modifier == &TraitBoundModifier::Maybe {
-                        self.word("?");
+                    match modifier {
+                        TraitBoundModifier::None => {}
+                        TraitBoundModifier::Maybe => {
+                            self.word("?");
+                        }
+                        TraitBoundModifier::MaybeConst => {
+                            self.word_space("~const");
+                        }
+                        TraitBoundModifier::MaybeConstMaybe => {
+                            self.word_space("~const");
+                            self.word("?");
+                        }
                     }
                     self.print_poly_trait_ref(tref);
                 }