Skip to content

Note warning of default features on libc #34132

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

Merged
merged 2 commits into from
Jun 12, 2016
Merged

Conversation

AtheMathmo
Copy link
Contributor

The default features of libc include libstd. This should be noted on this page.

The default features of libc include libstd. This should be noted on this page.
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (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.

@steveklabnik
Copy link
Member

Thanks! Agree 100%. It might be nice to show how not to do this as well?

@AtheMathmo
Copy link
Contributor Author

I'm not sure I understand what you mean by how not to do this? I had considered adding an example of how to do this with cargo but excluded those in the PR.

I'm happy to change it however you see fit. We could make this a slightly larger section with an example of the libc dependency in cargo.toml?

@durka
Copy link
Contributor

durka commented Jun 7, 2016

Including a sample Cargo.toml seems like a good idea. Also why are there so many hidden lines in the example? Is what rustdoc ends up showing really correct?

@steveklabnik
Copy link
Member

The reason they're hidden is that they use the internal libc so that we can run the tests, but not show using the internal libc, because that's not what you're supposed to do.

@steveklabnik
Copy link
Member

@AtheMathmo just a typo. I meant how to do it, sorry :( Yeah, a slightly larger section showing a Cargo.toml would be great.

@AtheMathmo
Copy link
Contributor Author

Before I jump in - should I stick with a quoted note or make a new section? i.e.

Note: Warning about libc default features. Be sure to set default-features=false in your Cargo.toml file.

OR

Warning: Default features in libc

The default features for libc include the standard library that we are trying to exclude. You must explicitly disable these. You can exclude the default features by modifying your Cargo.toml file as follows:

[dependencies.libc]
version = "*"
default-features = false

@steveklabnik
Copy link
Member

I'd make it a new section. We sorta assume you know how to include an external crate in the current version of the text, but it might be worth using this to explain that; just saying that we need libc, here's how you include it, and make sure you turn off default features.

Also, using version = "*" is an antipattern, I'd use libc = "0.2.11"

Have included an example of a Cargo.toml file containing the libc dependency.

The file has been reformatted to use sections. The note on the default features warning is part of the _Using libc_ section but is in bold.
@AtheMathmo
Copy link
Contributor Author

Thanks for the feedback!

Have added a new section with more details on including libc. Let me know if you want anything added/removed/reformatted.

@steveklabnik
Copy link
Member

@bors: r+ rollup

Thanks again!

@bors
Copy link
Collaborator

bors commented Jun 12, 2016

📌 Commit 8844fd4 has been approved by steveklabnik

@bors
Copy link
Collaborator

bors commented Jun 12, 2016

⌛ Testing commit 8844fd4 with merge 4c45d26...

bors added a commit that referenced this pull request Jun 12, 2016
Note warning of default features on libc

The default features of libc include libstd. This should be noted on this page.
@bors bors merged commit 8844fd4 into rust-lang:master Jun 12, 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