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

Improve No stdlib and related Documentation #35663

Merged
merged 1 commit into from
Aug 17, 2016
Merged

Conversation

CryZe
Copy link
Contributor

@CryZe CryZe commented Aug 14, 2016

This renames all lang item function names to the ones used in libstd and libpanic_unwind. It also explains the eh_unwind_resume lang item in the libcore documentation, where it was missing. A third function is also needed on certain compilation targets, so this was also added to the No stdlib documentation.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.


// This function may be needed based on the compilation target.
#[lang = "eh_unwind_resume"]
#[no_mangle]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#[no_mangle] seems questionable, as this is not done in libpanic_unwind. The extern "C" might already indicate that those functions are not supposed to be mangled. I'm not quite sure on that though, so I kept it for now.

Copy link
Member

@steveklabnik steveklabnik Aug 15, 2016

Choose a reason for hiding this comment

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

[steve@becoming tmp]$ cat foo.rs
pub extern fn mangle() {}
#[no_mangle]
pub extern fn no_mangle() {}
[steve@becoming tmp]$ rustc foo.rs --crate-type=lib
[steve@becoming tmp]$ nm libfoo.rlib | grep mangle
nm: rust.metadata.bin: File format not recognized
0000000000000000 T no_mangle
0000000000000000 T _ZN3foo6mangle17h47460733e6635b5fE
nm: foo.0.bytecode.deflate: File format not recognized

(extern does not imply no_mangle)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess, it's questionable if you need it for a lang_item however, as there's no actual C code that needs the actual symbol name though. You can even choose your own apparently.

@Manishearth
Copy link
Member

Not so sure if we should be renaming them. AIUI rust_eh_personality means "the eh_personality defined by Rust (well, rustc)". These examples aren't. Perhaps my_eh_personality?

@CryZe
Copy link
Contributor Author

CryZe commented Aug 14, 2016

Well, the documentation also has rust_begin_panic, so I made it consistent with that. I'm fine with any name, but having the individual parts of the documentation disagreeing with each other is bad.

@Manishearth
Copy link
Member

@bors r+ rollup

fair

@bors
Copy link
Contributor

bors commented Aug 15, 2016

📌 Commit e586d21 has been approved by Manishearth

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 15, 2016
Improve `No stdlib` and related Documentation

This renames all lang item function names to the ones used in `libstd` and `libpanic_unwind`. It also explains the `eh_unwind_resume` lang item in the `libcore` documentation, where it was missing. A third function is also needed on certain compilation targets, so this was also added to the `No stdlib` documentation.
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 17, 2016
Improve `No stdlib` and related Documentation

This renames all lang item function names to the ones used in `libstd` and `libpanic_unwind`. It also explains the `eh_unwind_resume` lang item in the `libcore` documentation, where it was missing. A third function is also needed on certain compilation targets, so this was also added to the `No stdlib` documentation.
bors added a commit that referenced this pull request Aug 17, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 17, 2016
Improve `No stdlib` and related Documentation

This renames all lang item function names to the ones used in `libstd` and `libpanic_unwind`. It also explains the `eh_unwind_resume` lang item in the `libcore` documentation, where it was missing. A third function is also needed on certain compilation targets, so this was also added to the `No stdlib` documentation.
bors added a commit that referenced this pull request Aug 17, 2016
@bors bors merged commit e586d21 into rust-lang:master Aug 17, 2016
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.

5 participants