Skip to content

Code example in std::net::lookup_host is not working #24332

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

Closed
achanda opened this issue Apr 11, 2015 · 4 comments · Fixed by #24597
Closed

Code example in std::net::lookup_host is not working #24332

achanda opened this issue Apr 11, 2015 · 4 comments · Fixed by #24597

Comments

@achanda
Copy link
Contributor

achanda commented Apr 11, 2015

Th example here: https://doc.rust-lang.org/std/net/fn.lookup_host.html shows

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

We need an explicit main here, I think

@achanda
Copy link
Contributor Author

achanda commented Apr 13, 2015

@steveklabnik when I click on the codepen link, I do see an explicit main. However, the function foo was not being called.

@steveklabnik
Copy link
Member

Right, but I think it does the wrong thing, because that main is generated by Rustdoc.

It's only a theory, I could be wrong

@steveklabnik
Copy link
Member

Oh! No, this is #24597

bors added a commit that referenced this issue 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
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 a pull request may close this issue.

2 participants