Skip to content

fix edition 2024 unsafe link section #1055

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 11 commits into
base: master
Choose a base branch
from

Conversation

Ddystopia
Copy link
Contributor

In edition 2024, we must use #[unsafe(link_section = ...)] instead of #[link_section = ...]. But rtic_macros is only checking for #[link_section = ...].

  • fix: in edition 2024 link_section is used as unsafe(link_section = ...)
  • chore: changelog entry

@AfoHT
Copy link
Contributor

AfoHT commented Apr 16, 2025

Really nice you spotted it and got it sorted! Thank you 🚀

Would be amazing if this could be caught in the future with some UI test or similar, something you could look into perhaps?

@Ddystopia
Copy link
Contributor Author

Oh, I am really now sure how to use existing framework to do this kind of test. When developing this, I used objdump and cargo expand to see there the symbols were put. unsafe(link_section) was ignored by rtic and my symbols ended up in the wrong section

@Ddystopia
Copy link
Contributor Author

Oh, I probably found a way. Rust gives warning if rtic is not using it

@Ddystopia Ddystopia force-pushed the fix_edition_2024_unsafe_link_section branch from d311dc8 to 1e809d9 Compare May 15, 2025 13:03
@Ddystopia
Copy link
Contributor Author

Is this possible to make a ui test in 2024 edition while not changing the edition of rtic itself? Because it seems to me, that to have a ui test in a new edition, I must migrate rtic to the new edition.

@Ddystopia Ddystopia force-pushed the fix_edition_2024_unsafe_link_section branch from 5c59e72 to 0db5840 Compare May 15, 2025 14:49
@Ddystopia Ddystopia force-pushed the fix_edition_2024_unsafe_link_section branch from 0db5840 to 8390759 Compare May 15, 2025 15:02
@Ddystopia
Copy link
Contributor Author

I honestly didn't find a better way to tests this. Rust would issue additional warning if attribute would get ignored, and that will cause the test to fail.

@Ddystopia
Copy link
Contributor Author

@AfoHT I think this is some flaky test, that test failes and fixes randomly

@Ddystopia Ddystopia requested a review from AfoHT May 23, 2025 17:03
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.

2 participants