-
-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
register_hook(&mut HOOKS) : mutable reference to mutable static #1749
Comments
We are going to move away from using Lines 601 to 608 in 2c1d388
So I don't think
is quite correct. Fixing this requires a redesign of the API. |
let h = &mut *std::ptr::addr_of_mut!(HOOKS) as &mut dyn PgHooks;
pgrx::hooks::register_hook(h); And you are correct that this is exactly 0% better, by the way. |
I believe the initial "reborrow" of It would probably be useful if someone created a "small-scale model" of the "triggering a hook" sequence of events, with a much-pared-back version of our hooks API, and ran it through Miri. I think it might be possible to fix the biggest hooks API UB with mostly-internal changes. |
Thanks for the explanations |
I’d be up to try and do that. As of 0.12, we are stuck with using an unsound and deprecated API with no alternative, as we need to intercept utility commands in our extension. |
Not a actually bug, but a strange warning....
I registered my hooks with the following line
which I copy-pasted blindly from the hook_tests here:
https://github.com/pgcentralfoundation/pgrx/blob/2c1d3887d16744e5230efe506d98a51836cf8228/pgrx-tests/src/tests/hooks_tests.rs#L126C1-L127C46
Cargo 1.77 issues the following warning
Trying to rewrite that register_hook line to remove the warning, I ended up with the syntax below that seems to please cargo but looks fishy
I tried to understand the issue 114447, but it is way out of my league....
It seems obvious that we won't create another reference to the HOOKS variable, but is that enough to simply ignore this warning ?
The text was updated successfully, but these errors were encountered: