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

libc: re-export libc properly #288

Merged
merged 1 commit into from
Mar 11, 2016
Merged

Conversation

posborne
Copy link
Member

@posborne posborne commented Mar 4, 2016

With rust 1.7, the following warning was being emitted by the compiler:

warning: `pub extern crate` does not work as expected and should
not be used. Likely to become an error. Prefer `extern crate` and
`pub use`.

Based on rust-lang/rust#26775 it appears that
this change is the current best approach for properly exporting the
libc dependency so it may be used outside of nix.

Signed-off-by: Paul Osborne osbpau@gmail.com

@posborne
Copy link
Member Author

posborne commented Mar 4, 2016

Relates to #284.

r? @fiveop

@fiveop
Copy link
Contributor

fiveop commented Mar 4, 2016

That is confusing. We just added the pub to extern crate because of an error in nightly, with a message stating that we cannot pub use a crate, that is private. The CI for this PR fails for exactly this reason in beta and nightly, now.

We need to figure out how to properly reexport a library in bea/nightly.

@posborne
Copy link
Member Author

posborne commented Mar 4, 2016

Agreed.

// Re-exports
pub use exports::libc;
Copy link
Member

Choose a reason for hiding this comment

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

can you not do

extern crate libc;
pub use libc;

? I think I've done that before...

@posborne
Copy link
Member Author

posborne commented Mar 5, 2016

Ok, I believe what is present now should result in the correct behavior prior to the recent changes coming out of rust-lang/rust#26775 and should also have the same behavior for beta/nightly.

@kamalmarhubi
Copy link
Member

Looks good here, assuming it works. I'll let @fiveop take another look though.

@homu
Copy link
Contributor

homu commented Mar 6, 2016

☔ The latest upstream changes (presumably #294) made this pull request unmergeable. Please resolve the merge conflicts.

With rust 1.7, the following warning was being emitted by the compiler:

    warning: `pub extern crate` does not work as expected and should
    not be used. Likely to become an error. Prefer `extern crate` and
    `pub use`.

Based on rust-lang/rust#26775 it appears that
the warning in 1.7 which was to be escalated to an error is going away
but in older versions of rust it is still the case that `pub extern crate`
will not work as expected.  Instead, we use a somewhat creative hack to
export the libc root as a module in nix.  Down the line, it may make
sense to either eliminate the need to export libc (by chaning the ioctl
macros) or to move toward deprecated older versions of rustc.

Signed-off-by: Paul Osborne <osbpau@gmail.com>
@fiveop
Copy link
Contributor

fiveop commented Mar 11, 2016

@homu r+

@homu
Copy link
Contributor

homu commented Mar 11, 2016

📌 Commit f590b35 has been approved by fiveop

@homu
Copy link
Contributor

homu commented Mar 11, 2016

⌛ Testing commit f590b35 with merge 29aaccb...

homu added a commit that referenced this pull request Mar 11, 2016
libc: re-export libc properly

With rust 1.7, the following warning was being emitted by the compiler:

    warning: `pub extern crate` does not work as expected and should
    not be used. Likely to become an error. Prefer `extern crate` and
    `pub use`.

Based on rust-lang/rust#26775 it appears that
this change is the current best approach for properly exporting the
libc dependency so it may be used outside of nix.

Signed-off-by: Paul Osborne <osbpau@gmail.com>
@homu
Copy link
Contributor

homu commented Mar 11, 2016

☀️ Test successful - status

@homu homu merged commit f590b35 into nix-rust:master Mar 11, 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.

4 participants