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

Ensure symbols reach the linker with `#[used]` #1026

Merged
merged 1 commit into from Jun 27, 2018

Conversation

Projects
None yet
2 participants
@bradjc
Copy link
Contributor

bradjc commented Jun 25, 2018

We had been using #[no_mangle] which is a workaround to ensure that the compiler doesn't drop important symbols. #[used] is designed explicitly for this purpose.

It is also on the path to be stabilized: rust-lang/rust#51363

Testing Strategy

This pull request was tested by compiling.

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make formatall.

@bradjc bradjc requested a review from ppannuto Jun 25, 2018

@ppannuto
Copy link
Member

ppannuto left a comment

This is an exciting bit of progress. used was just a dreamt-of feature last I looked into this

asm, concat_idents, const_fn, const_cell_new, try_from, core_intrinsics, iterator_step_by
)]
#![feature(asm, concat_idents, const_fn, const_cell_new, try_from)]
#![feature(core_intrinsics, iterator_step_by, used)]

This comment has been minimized.

@ppannuto

ppannuto Jun 25, 2018

Member

Did you split this, or rustfmt? What determined what made the top list vs the bottom one?

This comment has been minimized.

@bradjc

bradjc Jun 25, 2018

Contributor

I did.

@@ -7,6 +7,7 @@
#![feature(attr_literals, const_cell_new)]
#![feature(const_atomic_usize_new, const_ptr_null_mut, integer_atomics, try_from)]
#![feature(asm, core_intrinsics, concat_idents, const_fn)]
#![feature(used)]

This comment has been minimized.

@ppannuto

ppannuto Jun 25, 2018

Member

The others above appended to the existing feature list, better to be consistent?

This comment has been minimized.

@bradjc

bradjc Jun 25, 2018

Contributor

I mean, it has been pretty arbitrary where these go. Do you really care?

This comment has been minimized.

@ppannuto

ppannuto Jun 25, 2018

Member

No, I approved the changes. Just was pointing it out.

Realistically, it's something I imagine rustfmt will do something with someday.

Ensure symbols reach the linker with `#[used]`
We had been using `#[no_mangle]` which is a workaround to ensure that
the compiler doesn't drop important symbols. `#[used]` is designed
explicitly for this purpose.

rust-lang/rust#51363
@ppannuto
Copy link
Member

ppannuto left a comment

Just a rebase

@ppannuto ppannuto merged commit b80c9d7 into master Jun 27, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details

@ppannuto ppannuto deleted the use-used branch Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment