1
/// Triggers a panic with a detailed bug report message, while ensuring the panic is ignored in coverage reports.
2
///
3
/// This macro is useful in situations where an unreachable code path is hit or when a bug occurs.
4
///
5
/// # Parameters
6
///
7
/// - `msg`: A string expression describing the cause of the panic or bug.
8
///
9
1
/// ```
10
1
#[macro_export]
11
1
macro_rules! bug {
12
    ($msg:expr $(, $arg:tt)*) => {{
13
        let formatted_msg = format!($msg, $($arg)*);
14
        let full_message = format!(
15
            r#"
16
This should never happen, sorry!
17

            
18
However, it did happen, so it must be a bug. Please report it to us!
19

            
20
Conjure Oxide is actively developed and maintained. We will get back to you as soon as possible.
21

            
22
You can help us by providing a minimal failing example.
23

            
24
Issue tracker: http://github.com/conjure-cp/conjure-oxide/issues
25

            
26
{}
27
"#, &formatted_msg);
28

            
29
        panic!("{}", full_message);
30
    }};
31
}