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

rustdoc: don't inject "extern crate std;" #24597

Merged
merged 1 commit into from
Apr 20, 2015
Merged

Conversation

bombless
Copy link
Contributor

This patch will make links like http://doc.rust-lang.org/std/collections/struct.BTreeMap.html#examples actually playable without modifying the code.

It seems that this patch cannot be tested on test/rustdoc.

And I suggest adding a &run=1 to those links.

Thank @jorisgio for noticing me this!

r? @steveklabnik

Closes #24332

@steveklabnik
Copy link
Member

This should fix #24332 as well

@bombless
Copy link
Contributor Author

Yes.

@steveklabnik
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Apr 20, 2015

📌 Commit adc93ce has been approved by steveklabnik

@bors
Copy link
Contributor

bors commented Apr 20, 2015

⌛ Testing commit adc93ce with merge e959fab...

bors added a commit that referenced this pull request Apr 20, 2015
This patch will make links like http://doc.rust-lang.org/std/collections/struct.BTreeMap.html#examples actually playable without modifying the code.

It seems that this patch cannot be tested on test/rustdoc.

And I suggest adding a `&run=1` to those links.

Thank @jorisgio for noticing me this!

r? @steveklabnik 

Closes #24332
@bors bors merged commit adc93ce into rust-lang:master Apr 20, 2015
@achanda
Copy link
Contributor

achanda commented Apr 20, 2015

When I click on the playpen link in the example, I land up here: https://play.rust-lang.org/?code=extern%20crate%20std%3B%0Afn%20main()%20%7B%0A%20%20%20%20use%20std%3A%3Acollections%3A%3ABTreeMap%3B%0A%20%20%20%20%0A%20%20%20%20let%20mut%20a%20%3D%20BTreeMap%3A%3Anew()%3B%0A%20%20%20%20a.insert(1%2C%20%22a%22)%3B%0A%20%20%20%20a.clear()%3B%0A%20%20%20%20assert!(a.is_empty())%3B%0A%20%20%20%20%0A%7D

And this fails with this error:

<anon>:1:1: 1:18 error: an external crate named `std` has already been imported into this module [E0259]
<anon>:1 extern crate std;
         ^~~~~~~~~~~~~~~~~
error: aborting due to previous error
playpen: application terminated with error code 101

@steveklabnik
Copy link
Member

@achanda this was just merged four hours ago, you won't be able to see the changes till tomorrow :)

@achanda
Copy link
Contributor

achanda commented Apr 20, 2015

oh :) thanks @steveklabnik

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.

Code example in std::net::lookup_host is not working
4 participants