Skip to content

program-entrypoint: Add no_std attribute #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sonicfromnewyoke
Copy link

Problem

Currently the program-entrypoint crate is no_std "friendly" but does not have the crate attribute and used reexports from core and alloc in std

Solution

  • Add the #![no_std] attribute to the crate.
  • use direct import from core and alloc instead of reexports from std

@joncinque joncinque requested a review from febo April 7, 2025 19:37
Copy link
Contributor

@febo febo left a comment

Choose a reason for hiding this comment

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

Looks good – just one nit.

@sonicfromnewyoke sonicfromnewyoke requested a review from febo April 8, 2025 17:59
febo
febo previously approved these changes Apr 10, 2025
Copy link
Contributor

@febo febo left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@LucasSte
Copy link
Contributor

Adding no_std to entry point means that a #[panic_handler] must be implemented for the crate, since panics won't be processed in the STD;

@febo febo self-requested a review April 22, 2025 10:47
@febo
Copy link
Contributor

febo commented Apr 22, 2025

Adding no_std to entry point means that a #[panic_handler] must be implemented for the crate, since panics won't be processed in the STD;

Good point! When the custom_panic_default is used, it is not a problem since that macro brings the std – e.g., it uses msg!. But we should consider the case for when it is not used. We could either add a nostd_panic_default macro, or we need to document this case so when the program using the macro is no_std, it will need to set one up.

cc: @joncinque

@febo febo dismissed their stale review April 22, 2025 10:56

Need to consider the potential issue with the panic handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants