conjure_core/
bug.rs

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

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

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

You can help us by providing a minimal failing example.

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

{}
"#, &formatted_msg);

        panic!("{}", full_message);
    }};
}