1
Fork 0

Add ~const bounds trait bounds when using derive_const

This commit is contained in:
Michael Goulet 2023-02-07 20:59:48 +00:00
parent 56bf28d4f4
commit 7a4505900d
5 changed files with 46 additions and 12 deletions

View file

@ -131,10 +131,14 @@ impl<'a> ExtCtxt<'a> {
}
}
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
},
)
}