From 3ddf30cda74b64d1e1fe3f57e06cbb5440f630e4 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 26 Sep 2023 00:35:27 +0000 Subject: [PATCH] Allow `Sized` bounds There was no reason to only allow `Sized`, rustc will let us know if something is wrong. --- c-bindings-gen/src/main.rs | 3 +-- c-bindings-gen/src/types.rs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index bca6aa5..9f3727d 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -534,8 +534,7 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty writeln!(w, "\ttype {} = crate::{};", t.ident, $type_resolver.resolve_path(&tr.path, Some(&gen_types))).unwrap(); for bound in bounds_iter { if let syn::TypeParamBound::Trait(t) = bound { - // We only allow for `?Sized` here. - if let syn::TraitBoundModifier::Maybe(_) = t.modifier {} else { panic!(); } + // We only allow for `Sized` here. assert_eq!(t.path.segments.len(), 1); assert_eq!(format!("{}", t.path.segments[0].ident), "Sized"); } diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 0ff81f8..6d97ccc 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -354,7 +354,6 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> { for bound in bounds_iter { if let syn::TypeParamBound::Trait(t) = bound { // We only allow for `?Sized` here. - if let syn::TraitBoundModifier::Maybe(_) = t.modifier {} else { panic!(); } assert_eq!(t.path.segments.len(), 1); assert_eq!(format!("{}", t.path.segments[0].ident), "Sized"); } -- 2.39.5