mitigate additional debuginfo expansions

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-04-04 23:04:13 +00:00 committed by Jade Ellis
parent 576a783a6f
commit 8e7373c027
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2
8 changed files with 13 additions and 6 deletions

View file

@ -12,6 +12,7 @@ pub use crate::{result::DebugInspect, utils::debug::*};
/// Log event at given level in debug-mode (when debug-assertions are enabled).
/// In release-mode it becomes DEBUG level, and possibly subject to elision.
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! debug_event {
( $level:expr_2021, $($x:tt)+ ) => {
if $crate::debug::logging() {

View file

@ -33,6 +33,7 @@
//! option of replacing `error!` with `debug_error!`.
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! Err {
($($args:tt)*) => {
Err($crate::err!($($args)*))
@ -40,6 +41,7 @@ macro_rules! Err {
}
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! err {
(Request(Forbidden($level:ident!($($args:tt)+)))) => {{
let mut buf = String::new();
@ -109,6 +111,7 @@ macro_rules! err {
/// can share the same callsite metadata for the source of our Error and the
/// associated logging and tracing event dispatches.
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! err_log {
($out:ident, $level:ident, $($fields:tt)+) => {{
use $crate::tracing::{

View file

@ -33,6 +33,7 @@ pub struct Log {
// the crate namespace like these.
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! event {
( $level:expr_2021, $($x:tt)+ ) => { ::tracing::event!( $level, $($x)+ ) }
}

View file

@ -10,6 +10,7 @@ use crate::{Err, Error, Result, debug::type_name, err};
/// Checked arithmetic expression. Returns a Result<R, Error::Arithmetic>
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! checked {
($($input:tt)+) => {
$crate::utils::math::checked_ops!($($input)+)
@ -22,6 +23,7 @@ macro_rules! checked {
/// has no realistic expectation for error and no interest in cluttering the
/// callsite with result handling from checked!.
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! expected {
($msg:literal, $($input:tt)+) => {
$crate::checked!($($input)+).expect($msg)
@ -37,6 +39,7 @@ macro_rules! expected {
/// regression analysis.
#[cfg(not(debug_assertions))]
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! validated {
($($input:tt)+) => {
//#[allow(clippy::arithmetic_side_effects)] {
@ -53,6 +56,7 @@ macro_rules! validated {
/// the expression is obviously safe. The check is elided in release-mode.
#[cfg(debug_assertions)]
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! validated {
($($input:tt)+) => { $crate::expected!($($input)+) }
}

View file

@ -173,7 +173,6 @@ macro_rules! is_equal {
/// Functor for |x| *x.$i
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! deref_at {
($idx:tt) => {
|t| *t.$idx
@ -182,7 +181,6 @@ macro_rules! deref_at {
/// Functor for |ref x| x.$i
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! ref_at {
($idx:tt) => {
|ref t| &t.$idx
@ -191,7 +189,6 @@ macro_rules! ref_at {
/// Functor for |&x| x.$i
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! val_at {
($idx:tt) => {
|&t| t.$idx
@ -200,7 +197,6 @@ macro_rules! val_at {
/// Functor for |x| x.$i
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! at {
($idx:tt) => {
|t| t.$idx

View file

@ -14,6 +14,7 @@ pub const EMPTY: &str = "";
/// returned otherwise the input (i.e. &'static str) is returned. If multiple
/// arguments are provided the first is assumed to be a format string.
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! format_maybe {
($s:literal $(,)?) => {
if $crate::is_format!($s) { std::format!($s).into() } else { $s.into() }
@ -27,6 +28,7 @@ macro_rules! format_maybe {
/// Constant expression to decide if a literal is a format string. Note: could
/// use some improvement.
#[macro_export]
#[collapse_debuginfo(yes)]
macro_rules! is_format {
($s:literal) => {
::const_str::contains!($s, "{") && ::const_str::contains!($s, "}")

View file

@ -117,7 +117,7 @@ pub fn name_from_path(path: &Path) -> Result<String> {
/// Get the (major, minor) of the block device on which Path is mounted.
#[allow(clippy::useless_conversion, clippy::unnecessary_fallible_conversions)]
pub fn dev_from_path(path: &Path) -> Result<(dev_t, dev_t)> {
fn dev_from_path(path: &Path) -> Result<(dev_t, dev_t)> {
#[cfg(target_family = "unix")]
use std::os::unix::fs::MetadataExt;

View file

@ -1,4 +1,4 @@
#![type_length_limit = "2048"]
#![type_length_limit = "8192"]
#![allow(refining_impl_trait)]
mod manager;