Skip to content
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

Hide call to unsafe method inside of an unsafe block in rooting macro. #519

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

jdm
Copy link
Member

@jdm jdm commented Oct 31, 2024

This usage of initial() is safe because we're storing the result directly inside of a rooted location.

Copy link
Member

@sagudev sagudev left a comment

Choose a reason for hiding this comment

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

this could cause warnings for rooted! inside unsafe blocks (due to unsafe inside unsafe). see rust-lang/rust#74838

@jdm
Copy link
Member Author

jdm commented Oct 31, 2024

this could cause warnings for rooted! inside unsafe blocks (due to unsafe inside unsafe). see rust-lang/rust#74838

We can allow that when it happens. It's better than requiring unsafe blocks in code that does not require them, which is a problem I hit when trying to use this version of the macro.

@sagudev
Copy link
Member

sagudev commented Oct 31, 2024

this could cause warnings for rooted! inside unsafe blocks (due to unsafe inside unsafe). see rust-lang/rust#74838

We can allow that when it happens. It's better than requiring unsafe blocks in code that does not require them, which is a problem I hit when trying to use this version of the macro.

I have a feeling this happens a lot in servo (if before unsafe was required). So we could simply put #[allow(unused_unsafe)] in macro: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=80541d5b4fbe5645e4f9e47d4d496d1b

@jdm
Copy link
Member Author

jdm commented Oct 31, 2024

The isn't a version of the macro that we use very often in Servo right now. I did not need to modify any existing code with these changes.

@jdm jdm enabled auto-merge October 31, 2024 17:47
@jdm jdm added this pull request to the merge queue Oct 31, 2024
Merged via the queue into servo:main with commit 1179f5b Oct 31, 2024
25 checks passed
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