]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_expand/src/build.rs
Add ~const bounds trait bounds when using derive_const
[rust.git] / compiler / rustc_expand / src / build.rs
index 6cd56852f9d686942633ce3b258358c310d56469..b4c12651e7a2d36e7011fac4664f36d63f695c05 100644 (file)
@@ -131,10 +131,14 @@ pub fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef {
         }
     }
 
-    pub fn trait_bound(&self, path: ast::Path) -> ast::GenericBound {
+    pub fn trait_bound(&self, path: ast::Path, is_const: bool) -> ast::GenericBound {
         ast::GenericBound::Trait(
             self.poly_trait_ref(path.span, path),
-            ast::TraitBoundModifier::None,
+            if is_const {
+                ast::TraitBoundModifier::MaybeConst
+            } else {
+                ast::TraitBoundModifier::None
+            },
         )
     }