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

Add doc for impl From for Addr #53522

Merged
merged 1 commit into from
Sep 18, 2018
Merged

Add doc for impl From for Addr #53522

merged 1 commit into from
Sep 18, 2018

Conversation

phungleson
Copy link
Contributor

As part of issue #51430 (cc @skade).

The impl is very simple, let me know if we need to go into any details.

Additionally, I added #[inline] for the conversion method, let me know if it is un-necessary or might break something.

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 20, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:04:31] tidy error: /checkout/src/libstd/net/addr.rs:585: trailing whitespace
[00:04:32] some tidy checks failed
[00:04:32] 
[00:04:32] 
[00:04:32] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:32] 
[00:04:32] 
[00:04:32] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:32] Build completed unsuccessfully in 0:00:49
[00:04:32] Build completed unsuccessfully in 0:00:49
[00:04:32] Makefile:79: recipe for target 'tidy' failed
[00:04:32] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0365e218
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:04276aeb:start=1534745779427593247,finish=1534745779434971366,duration=7378119
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:31e3f072
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0e025a92
travis_time:start:0e025a92
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:240afabc
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

/// Converts a [`SocketAddrV4`] into a [`V4 variant of SocketAddr`].
///
/// [`SocketAddrV4`]: struct.SocketAddrV4.html
/// [`V4 variant of SocketAddr`]: enum.SocketAddr.html#variant.V4
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for my noob question as I haven't touched rust for quite a while.

Is this syntax valid and necessary for the docs?

Copy link
Member

Choose a reason for hiding this comment

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

Based on running cargo doc on the following, yes I believe it is valid as written.

pub enum SocketAddr {
    V4,
}

/// Converts a `SocketAddrV4` into a [`V4 variant of SocketAddr`].
///
/// [`V4 variant of SocketAddr`]: enum.SocketAddr.html#variant.V4
pub fn from() {}

A more modern way to write it as of #43466 would be:

/// [`V4 variant of SocketAddr`]: SocketAddr::V4

@dtolnay
Copy link
Member

dtolnay commented Aug 20, 2018

@bors delegate=skade

@bors
Copy link
Contributor

bors commented Aug 20, 2018

✌️ @skade can now approve this pull request

@Mark-Simulacrum
Copy link
Member

The inline attribute should be removed, or at least discussed in a separate PR. Those should only be added given real-world benchmarks demonstrating need.

@joshtriplett
Copy link
Member

These look good to me.

I do agree about dropping #[inline] though. Ideally rustc should just inline these methods anyway without the directive.

@pietroalbini
Copy link
Member

Ping from triage @skade! This PR needs your review.

@TimNN
Copy link
Contributor

TimNN commented Sep 4, 2018

@bors r+ rollup

(Approving since these look good to me as well, in addition to the LGTM from @joshtriplett).

@bors
Copy link
Contributor

bors commented Sep 4, 2018

📌 Commit 4ced4f3 has been approved by TimNN

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 4, 2018
@bors
Copy link
Contributor

bors commented Sep 4, 2018

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Sep 4, 2018

📌 Commit 4ced4f3 has been approved by TimNN

@kennytm
Copy link
Member

kennytm commented Sep 7, 2018

@bors r-

This has caused several intralink errors in #54021 (comment).

[01:16:20] error: `[SocketAddrV6]` cannot be resolved, ignoring it...
[01:16:20]    --> /checkout/src/libstd/net/addr.rs:565:21
[01:16:20]     |
[01:16:20] 565 |     /// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
[01:16:20]     |                     ^^^^^^^^^^^^^^ cannot be resolved, ignoring
[01:16:20]     |
[01:16:20] error: `[SocketAddr::V6]` cannot be resolved, ignoring it...
[01:16:20]    --> /checkout/src/libstd/net/addr.rs:565:45
[01:16:20]     |
[01:16:20] 565 |     /// Converts a [`SocketAddrV6`] into a [`SocketAddr::V6`].
[01:16:20]     |                                             ^^^^^^^^^^^^^^^^ cannot be resolved, ignoring
[01:16:20]     |
[01:16:20] error: `[IpAddr]` cannot be resolved, ignoring it...
[01:16:20]    --> /checkout/src/libstd/net/addr.rs:573:40
[01:16:20]     |
[01:16:20] 573 |     /// Converts a tuple struct (Into<[`IpAddr`]>, `u16`) into a [`SocketAddr`].
[01:16:20]     |                                        ^^^^^^^^ cannot be resolved, ignoring
[01:16:20]     |
[01:16:20] error: `[SocketAddr]` cannot be resolved, ignoring it...
[01:16:20]    --> /checkout/src/libstd/net/addr.rs:573:67
[01:16:20]     |
[01:16:20] 573 |     /// Converts a tuple struct (Into<[`IpAddr`]>, `u16`) into a [`SocketAddr`].
[01:16:20]     |                                                                   ^^^^^^^^^^^^ cannot be resolved, ignoring
[01:16:20]     |
[01:16:20] failures:
[01:16:20]     [rustdoc] rustdoc/intra-link-extern-crate.rs
[01:16:20]     [rustdoc] rustdoc/intra-link-private.rs

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 7, 2018
@kennytm
Copy link
Member

kennytm commented Sep 17, 2018

@bors r=TimNN

The original cause of the intralink failure maybe caused by #53162 and is solved, so let's retry.

@bors
Copy link
Contributor

bors commented Sep 17, 2018

📌 Commit 4ced4f3 has been approved by TimNN

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 17, 2018
@phungleson
Copy link
Contributor Author

phungleson commented Sep 17, 2018

Hey guys I am still traveling, I will fix this when I am back, soon.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Sep 18, 2018
…r=TimNN

Add doc for impl From for Addr

As part of issue rust-lang#51430 (cc @skade).

The impl is very simple, let me know if we need to go into any details.

Additionally, I added `#[inline]` for the conversion method, let me know if it is un-necessary or might break something.
bors added a commit that referenced this pull request Sep 18, 2018
Rollup of 9 pull requests

Successful merges:

 - #53522 (Add doc for impl From for Addr)
 - #54097 (rustdoc: Remove namespace for keywords)
 - #54205 (Add treat-err-as-bug flag in rustdoc)
 - #54225 (Regression test for #53675.)
 - #54232 (add `-Z dont-buffer-diagnostics`)
 - #54273 (Suggest to change numeric literal instead of casting)
 - #54299 (Issue 54246)
 - #54311 (Remove README with now-out-of-date docs about docs.)
 - #54313 (OsStr: Document that it's not NUL terminated)

Failed merges:

r? @ghost
@bors bors merged commit 4ced4f3 into rust-lang:master Sep 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants