Skip to content

fix: validation for main function signature#387

Closed
0xbryer wants to merge 1 commit intonexus-xyz:mainfrom
0xbryer:patch-1
Closed

fix: validation for main function signature#387
0xbryer wants to merge 1 commit intonexus-xyz:mainfrom
0xbryer:patch-1

Conversation

@0xbryer
Copy link

@0xbryer 0xbryer commented Apr 5, 2025

Describe your changes.

i made a few fixes to the validation logic for the main function.

specifically:

  • The check for the return type was corrected to properly handle ReturnType::Default instead of incorrectly checking for ReturnType::Type.
  • I fixed the handling of function arguments by using the correct func.sig.inputs instead of fn_sig.inputs.
  • I also updated the quote! macro to properly reference ::std::main, ensuring the correct function path.

@github-actions
Copy link

github-actions bot commented Apr 5, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@0xbryer
Copy link
Author

0xbryer commented Apr 5, 2025

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@slumber slumber left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. Feel free to elaborate on your changes and reopen it.

if !func.sig.inputs.is_empty() {
return Err(Error::new_spanned(
&fn_sig.inputs,
&func.sig.inputs,
Copy link
Contributor

Choose a reason for hiding this comment

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

fn_sig equals func.sig


Ok(quote! {
const _: fn() = main;
const _: fn() = ::std::main;
Copy link
Contributor

Choose a reason for hiding this comment

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

This constant is supposed to check the type of the main function, e.g. against extern and presence of return value.

Therefore I don't follow this change

@slumber slumber closed this Apr 7, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2025
chuckyLeeVIII pushed a commit to chuckyLeeVIII/nexus-zkvm that referenced this pull request Apr 18, 2025
Summary:

Fix nexus-xyz#387

Test Plan:

Co-authored-by: duc-nx <>
sjudson pushed a commit that referenced this pull request May 14, 2025
Summary:

Fix #387

Test Plan:

Co-authored-by: duc-nx <>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants