hecatia-elegua / bilge

Use bitsized types as if they were a feature of rust.
Apache License 2.0
171 stars 17 forks source link

Reject generic arguments in struct fields #64

Open pickx opened 1 year ago

pickx commented 1 year ago

as discussed outside github.

hecatia-elegua commented 1 year ago

Thank you. Had another thought: Where does it start breaking? If it's just about the field type not being Bitsized, I would not reject them, because you can implement Bitsized yourself. Same with From and so on. Only getters/setters probably break somewhere, which we should fix or open an issue for.

kitlith commented 1 year ago

Just noticed this PR after opening #76, which also comes with a workaround. I do not think that rejecting generic structs is the way to go here.

hecatia-elegua commented 1 year ago

@kitlith explicitly rejecting generics would have been more of a temporary fix, e.g. you would have gotten the correct error that we currently don't handle them at all.

If you want, you could implement this. I've not thought about this at all, but if adding the turbofish works, it might be easy enough to change all Type<()> -> Type::<()>?