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 peer_addr function to UdpSocket #59106

Merged
merged 7 commits into from
Mar 23, 2019
Merged

Conversation

LinusU
Copy link
Contributor

@LinusU LinusU commented Mar 11, 2019

Fixes #59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!

@rust-highfive
Copy link
Collaborator

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 11, 2019
@jonas-schievink jonas-schievink added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. relnotes Marks issues that should be documented in the release notes of the next release. labels Mar 11, 2019
src/libstd/net/udp.rs Outdated Show resolved Hide resolved
src/libstd/net/udp.rs Show resolved Hide resolved
@kennytm kennytm removed the relnotes Marks issues that should be documented in the release notes of the next release. label Mar 12, 2019
Copy link
Member

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

r=me after docs change.

src/libstd/net/udp.rs Outdated Show resolved Hide resolved
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.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.
travis_time:end:01aba4ae:start=1552389707315671630,finish=1552389783287767364,duration=75972095734
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:25:43] 
[01:25:43] running 120 tests
[01:26:11] .iiiii...i.....i..i...i..i.i...i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i.i 100/120
[01:26:16] .i......iii.i.....ii
[01:26:16] 
[01:26:16]  finished in 33.806
[01:26:16] travis_fold:end:test_debuginfo

---
[01:46:43] ..........iii......i......i...i......i.............................................................. 300/996
[01:46:48] .................................................................................................... 400/996
[01:46:57] ........................i.i.....................................iiii........ii...................... 500/996
[01:47:04] .................................................................................................... 600/996
[01:47:12] ..FF................................................................................................ 700/996
[01:47:36] .................................................................................................... 900/996
[01:47:43] ..........................................iiii..................................................
[01:47:43] failures:
[01:47:43] 
[01:47:43] 
[01:47:43] ---- net/udp.rs - net::udp::UdpSocket::peer_addr (line 198) stdout ----
[01:47:43] error: unused imports: `Ipv4Addr`, `SocketAddrV4`, `SocketAddr`
[01:47:43]  --> net/udp.rs:199:16
[01:47:43]   |
[01:47:43] 4 | use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, UdpSocket};
[01:47:43]   |
[01:47:43] note: lint level defined here
[01:47:43]  --> net/udp.rs:196:9
[01:47:43]   |
[01:47:43]   |
[01:47:43] 1 | #![deny(warnings)]
[01:47:43]   |         ^^^^^^^^
[01:47:43]   = note: #[deny(unused_imports)] implied by #[deny(warnings)]
[01:47:43] 
[01:47:43] error[E0658]: use of unstable library feature 'udp_peer_addr' (see issue #59127)
[01:47:43]  --> net/udp.rs:202:19
[01:47:43]   |
[01:47:43] 7 | assert_eq!(socket.peer_addr().unwrap_err().kind(),
[01:47:43]   |
[01:47:43]   |
[01:47:43]   = help: add #![feature(udp_peer_addr)] to the crate attributes to enable
[01:47:43] error: aborting due to 2 previous errors
[01:47:43] 
[01:47:43] For more information about this error, try `rustc --explain E0658`.
[01:47:43] thread 'net/udp.rs - net::udp::UdpSocket::peer_addr (line 198)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:310:13
[01:47:43] thread 'net/udp.rs - net::udp::UdpSocket::peer_addr (line 198)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:310:13
[01:47:43] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:47:43] 
[01:47:43] ---- net/udp.rs - net::udp::UdpSocket::peer_addr (line 189) stdout ----
[01:47:43] error[E0658]: use of unstable library feature 'udp_peer_addr' (see issue #59127)
[01:47:43]  --> net/udp.rs:194:19
[01:47:43]   |
[01:47:43] 8 | assert_eq!(socket.peer_addr().unwrap(),
[01:47:43]   |
[01:47:43]   |
[01:47:43]   = help: add #![feature(udp_peer_addr)] to the crate attributes to enable
[01:47:43] error: aborting due to previous error
[01:47:43] 
[01:47:43] For more information about this error, try `rustc --explain E0658`.
[01:47:43] thread 'net/udp.rs - net::udp::UdpSocket::peer_addr (line 189)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:310:13
---
[01:47:43] 
[01:47:43] error: test failed, to rerun pass '--doc'
[01:47:43] 
[01:47:43] 
[01:47:43] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:47:43] 
[01:47:43] 
[01:47:43] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:47:43] Build completed unsuccessfully in 0:35:34
[01:47:43] Build completed unsuccessfully in 0:35:34
[01:47:43] make: *** [check] Error 1
[01:47:43] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:01f13820
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue Mar 12 13:10:57 UTC 2019
---
travis_time:end:0029d224:start=1552396259325954327,finish=1552396259331071461,duration=5117134
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:00e3cebc
$ 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 --batch -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:18e4b66c
travis_time:start:18e4b66c
$ 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:2cb01576
$ 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)

@jethrogb
Copy link
Contributor

where do I add tests?

At the bottom of src/libstd/net/udp.rs. Use the each_ip function to get IPs you can use for bind/connect.

@LinusU
Copy link
Contributor Author

LinusU commented Mar 12, 2019

Great, thanks!

@LinusU
Copy link
Contributor Author

LinusU commented Mar 12, 2019

Just pushed with added tests, passes locally 🐎

src/libstd/net/udp.rs Outdated Show resolved Hide resolved
@LinusU
Copy link
Contributor Author

LinusU commented Mar 12, 2019

@kennytm, @jethrogb I think that everything should be good to go now 👍 🚀

Thanks a ton for the help ❤️

@kennytm
Copy link
Member

kennytm commented Mar 13, 2019

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Mar 13, 2019

📌 Commit ca32fe4 has been approved by kennytm

@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 Mar 13, 2019
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Mar 13, 2019
Add peer_addr function to UdpSocket

Fixes rust-lang#59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!
kennytm added a commit to kennytm/rust that referenced this pull request Mar 15, 2019
Add peer_addr function to UdpSocket

Fixes rust-lang#59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!
@kennytm
Copy link
Member

kennytm commented Mar 15, 2019

@bors r-

Failed in #59207, please implement the new function on wasm as well (and probably SGX too)

@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 Mar 15, 2019
@LinusU
Copy link
Contributor Author

LinusU commented Mar 16, 2019

@kennytm should I rebase on the latest master as well? ☺️

@LinusU
Copy link
Contributor Author

LinusU commented Mar 16, 2019

@kennytm Rebased on master, and added the missing implementations. I've searched thru and every impl UdpSocket should now have a corresponding peer_addr implementation ✅

@kennytm
Copy link
Member

kennytm commented Mar 16, 2019

Thanks again!

@bors r+

@bors
Copy link
Contributor

bors commented Mar 16, 2019

📌 Commit 81d5fb5 has been approved by kennytm

@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 Mar 16, 2019
Centril added a commit to Centril/rust that referenced this pull request Mar 16, 2019
Add peer_addr function to UdpSocket

Fixes rust-lang#59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!
sanxiyn added a commit to sanxiyn/rust that referenced this pull request Mar 18, 2019
Add peer_addr function to UdpSocket

Fixes rust-lang#59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!
Centril added a commit to Centril/rust that referenced this pull request Mar 19, 2019
Add peer_addr function to UdpSocket

Fixes rust-lang#59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!
Centril added a commit to Centril/rust that referenced this pull request Mar 22, 2019
Add peer_addr function to UdpSocket

Fixes rust-lang#59104

This is my first pull request to Rust, so opening early for some feedback.

My biggest question is: where do I add tests?

Any comments very much appreciated!
bors added a commit that referenced this pull request Mar 22, 2019
Rollup of 18 pull requests

Successful merges:

 - #59106 (Add peer_addr function to UdpSocket)
 - #59170 (Add const generics to rustdoc)
 - #59172 (Update and clean up several parts of CONTRIBUTING.md)
 - #59190 (consistent naming for Rhs type parameter in libcore/ops)
 - #59236 (Rename miri component to miri-preview)
 - #59266 (Do not complain about non-existing fields after parse recovery)
 - #59273 (some small HIR doc improvements)
 - #59291 (Make Option<ThreadId> no larger than ThreadId, with NonZeroU64)
 - #59297 (convert field/method confusion help to suggestions)
 - #59304 (Move some bench tests back from libtest)
 - #59309 (Add messages for different verbosity levels. Output copy actions.)
 - #59321 (Unify E0109, E0110 and E0111)
 - #59322 (Tweak incorrect escaped char diagnostic)
 - #59323 (use suggestions for "enum instead of variant" error)
 - #59327 (Add NAN test to docs)
 - #59329 (cleanup: Remove compile-fail-fulldeps directory again)
 - #59347 (Move one test from run-make-fulldeps to ui)
 - #59360 (Add tracking issue number for `seek_convenience`)

Failed merges:

r? @ghost
@bors bors merged commit 81d5fb5 into rust-lang:master Mar 23, 2019
@LinusU LinusU deleted the udp-peer-addr branch March 24, 2019 15:39
@LinusU
Copy link
Contributor Author

LinusU commented Mar 24, 2019

Hooray 🎉

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. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants