Skip to content

Commit b2b3358

Browse files
committed
[trace] Add check for empty message to trace macro
Signed-off-by: Doru Blânzeanu <[email protected]>
1 parent 5c719a8 commit b2b3358

File tree

1 file changed

+5
-0
lines changed
  • src/hyperlight_guest_tracing_macro/src

1 file changed

+5
-0
lines changed

src/hyperlight_guest_tracing_macro/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ impl syn::parse::Parse for TraceMacroInput {
104104
if !matches!(message, syn::Lit::Str(_)) {
105105
return Err(input.error("first argument to trace! must be a string literal"));
106106
}
107+
if let syn::Lit::Str(ref lit_str) = message {
108+
if lit_str.value().is_empty() {
109+
return Err(input.error("trace message must not be empty"));
110+
}
111+
}
107112

108113
let statement = if input.peek(syn::Token![,]) {
109114
let _: syn::Token![,] = input.parse()?;

0 commit comments

Comments
 (0)