Skip to content
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

fix warnings #1948

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cargo-pgrx/src/command/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ fn compute_codegen(
out
};
Ok(quote::quote! {
fn main() {
pub fn main() {
#inputs
#build
#outputs
Expand Down
6 changes: 3 additions & 3 deletions pgrx-pg-sys/src/submodules/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::cell::Cell;
use std::fmt::{Display, Formatter};
use std::hint::unreachable_unchecked;
use std::panic::{
catch_unwind, panic_any, resume_unwind, AssertUnwindSafe, Location, PanicInfo, UnwindSafe,
catch_unwind, panic_any, resume_unwind, AssertUnwindSafe, Location, PanicHookInfo, UnwindSafe,
};

use crate::elog::PgLogLevel;
Expand Down Expand Up @@ -112,8 +112,8 @@ impl From<&Location<'_>> for ErrorReportLocation {
}
}

impl From<&PanicInfo<'_>> for ErrorReportLocation {
fn from(pi: &PanicInfo<'_>) -> Self {
impl From<&PanicHookInfo<'_>> for ErrorReportLocation {
fn from(pi: &PanicHookInfo<'_>) -> Self {
pi.location().map(|l| l.into()).unwrap_or_default()
}
}
Expand Down
1 change: 1 addition & 0 deletions pgrx/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//LICENSE
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
//! Provides safe wrappers around Postgres' "Transaction" and "Sub Transaction" hook system
#![allow(static_mut_refs)]

use crate as pgrx; // for #[pg_guard] support from within ourself
use crate::pg_sys;
Expand Down
1 change: 1 addition & 0 deletions pgrx/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
//! A trait and registration system for hooking Postgres internal operations such as its planner and executor
#![allow(clippy::unit_arg)]
#![allow(static_mut_refs)]
#![deprecated(
since = "0.12.1",
note = "currently always UB, use FFI + pointers to `static UnsafeCell`"
Expand Down
17 changes: 11 additions & 6 deletions pgrx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ macro_rules! pg_module_magic {
macro_rules! pg_magic_func {
() => {
#[no_mangle]
#[allow(non_snake_case)]
#[allow(non_snake_case, unexpected_cfgs)]
#[doc(hidden)]
pub extern "C" fn Pg_magic_func() -> &'static ::pgrx::pg_sys::Pg_magic_struct {
static MY_MAGIC: ::pgrx::pg_sys::Pg_magic_struct = ::pgrx::pg_sys::Pg_magic_struct {
Expand Down Expand Up @@ -306,11 +306,16 @@ pub(crate) enum Utf8Compat {
#[macro_export]
macro_rules! pgrx_embed {
() => {
#[cfg(not(pgrx_embed))]
fn main() {
panic!("PGRX_EMBED was not set.");
mod pgrx_embed {
#![allow(unexpected_cfgs)]

#[cfg(not(pgrx_embed))]
pub fn main() {
panic!("PGRX_EMBED was not set.");
}
#[cfg(pgrx_embed)]
include!(env!("PGRX_EMBED"));
}
#[cfg(pgrx_embed)]
include!(env!("PGRX_EMBED"));
pub use pgrx_embed::main;
};
}
Loading