Skip to content
Draft
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 src/__private_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod sealed {

// Types for the `kv` argument.

impl<'a> KVs<'a> for &'a [(&'a str, Value<'a>)] {
impl<'a, const N: usize> KVs<'a> for &'a [(&'a str, Value<'a>); N] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the change. I do wonder if this changes the binary size as now create code per N/size, but I don't know if this will impact anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't actually trigger the same build failure reported in #706 yet, so this one is purely speculative right now.

The change in code size is a good point, I'll measure it and see what impact it has. I wouldn't be surprised if it made no difference, but is definitely worth checking.

#[inline]
fn into_kvs(self) -> Option<&'a [(&'a str, Value<'a>)]> {
Some(self)
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,8 @@ where
pub unsafe fn set_logger_racy(logger: &'static dyn Log) -> Result<(), SetLoggerError> {
match STATE.load(Ordering::Acquire) {
UNINITIALIZED => {
LOGGER = logger;
// SAFETY: Access to `LOGGER` is synchronized through `STATE`
unsafe { LOGGER = logger };
STATE.store(INITIALIZED, Ordering::Release);
Ok(())
}
Expand Down
6 changes: 2 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ macro_rules! __log {
$crate::__private_api::format_args!($($arg)+),
lvl,
&($target, $crate::__private_api::module_path!(), $crate::__private_api::loc()),
&[$(($crate::__log_key!($key), $crate::__log_value!($key $(:$capture)* = $($value)*))),+] as &[_],
&[$(($crate::__log_key!($key), $crate::__log_value!($key $(:$capture)* = $($value)*))),+],
);
}
});
Expand Down Expand Up @@ -431,9 +431,7 @@ macro_rules! __log_logger {
$crate::__private_api::GlobalLogger
}};

($logger:expr) => {{
&($logger)
}};
($logger:expr) => {&($logger)};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code block shouldn't matter right? (fine with the code change though)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd think not, but this is one of the edition-based lifetime changes. In the 2024 edition, this borrow is for a lifetime that doesn't outlive the block.

}

// These macros use a pattern of #[cfg]s to produce nicer error
Expand Down
Loading