TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.38k stars 229 forks source link

Implement `Clone + Copy` for `ContextRef` #472

Closed gavrilikhin-d closed 9 months ago

gavrilikhin-d commented 9 months ago

Is your feature request related to a problem? Please describe. create_debug_location accepts the following argument: context: impl AsContextRef<'ctx>.

I store context: ContextRef<'ctx> from module, when creating debug info builder, but it's not clonnable

Describe the solution you'd like Copyable ContextRef

Describe possible drawbacks to your solution Safety issues possibly?

TheDan64 commented 9 months ago

Will have to think about any possible safety concerns some more... That said, I think it'd be ok to make it clone or maybe even copy.

TheDan64 commented 9 months ago

The 'ctx lifetime effectively makes it a reference to the original Context, so I think Copy would be safe