-
Notifications
You must be signed in to change notification settings - Fork 58
Add a macro to make initialization easier #103
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
base: master
Are you sure you want to change the base?
Conversation
6bca433
to
6335bb8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, thanks! Just a bit of nitpicks and it should be mergable.
9951db6
to
080581e
Compare
@zeenix I have made improvements based on the suggestions, and I added a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@JalonWong I'll merge soon but I want to first give others a chance to have a look. CC @adamgreig @sgued |
My only thought is that people are likely to want to configure where the backing store for the heap is located in memory using
|
How about a combination of these two: we add the optional argument for the linker section and if people need to add other attributes, they just don't use the macro? |
6d4171b
to
1e17f59
Compare
@zeenix @adamgreig If someone want to use |
f447854
to
d47bd8a
Compare
src/llff.rs
Outdated
/// - This function must be called exactly ONCE. | ||
/// - `size > 0` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the assertions in place now, these are no longer a safety issue but rather just panic scenarios, so I'd change the heading here from Safety
to Panics
and update the wording of the section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how to express it. Could you provide some content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give it a try first? I can help if/when needed. Just try to keep the changes to minimum and focus on adapting the wording.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cllipy requires a Safety
section, so I added the content under it.
Maybe we have to make this function safe to change it to Panics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right. I had assumed that @JalonWong did his homework but I guess not. :) So @JalonWong we need both Safety and Panics sections then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zeenix Yes, I noticed that the arguments need unsafe
. I wonder if we should continue to modify it? Or what content should be written in the Safety section if we keep both Safety and Panics sections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or what content should be written in the Safety section if we keep both Safety and Panics sections?
Well, Safety should list the assumptions that keep this method safe and Panics should list the panic scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have the panic scenarios. Did you mean we should add more safety contents? Like "make sure the memory start_addr
pointed to is available"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made an inline comment so there is no ambiguity anymore.
f5ba156
to
b3afee2
Compare
/// | ||
/// - This function must be called exactly ONCE. | ||
/// - `size > 0` | ||
/// - this function is called more than ONCE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JalonWong Here, the heading is still Safety
but we're listing panics. As I have previous said, you need to rename the section to Panics
. For Safety you need to add another section where you describe the safety invariants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have done it. Please verify if the content under Safety
is appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have done it. Please verify if the content under
Safety
is appropriate.
Yes, but see my other comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but still some things to do. Thank you for your patience and hard work on this so far. 👍
CHANGELOG.md
Outdated
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
### Added | |||
|
|||
- Added a `init` macro to make initialization easier. | |||
- Added a flag to prevent duplicate initialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a completely internal change and should not be communicated to the users. Instead, you should document the changed behaviour of the init methods (under Changed
heading) here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/// | ||
/// - This function must be called exactly ONCE. | ||
/// - `size > 0` | ||
/// - this function is called more than ONCE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have done it. Please verify if the content under
Safety
is appropriate.
Yes, but see my other comment.
No description provided.