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

Implement padding for IpAddr without heap alloc #67035

Merged
merged 1 commit into from
Dec 27, 2019

Conversation

Goirad
Copy link
Contributor

@Goirad Goirad commented Dec 4, 2019

Implements padding for IpAddrs without heap allocations.
This fixes issue #66810 .

cc @jethrogb @mzohreva

@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 @shepmaster (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 Dec 4, 2019
src/libstd/net/ip.rs Outdated Show resolved Hide resolved
src/libstd/net/ip.rs Outdated Show resolved Hide resolved
@rust-highfive
Copy link
Collaborator

The job mingw-check of your PR failed (pretty log, 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.
2019-12-05T16:49:03.7639200Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-05T16:49:03.7653274Z ##[command]git config gc.auto 0
2019-12-05T16:49:03.7657650Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-05T16:49:03.7662685Z ##[command]git config --get-all http.proxy
2019-12-05T16:49:03.7668095Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/67035/merge:refs/remotes/pull/67035/merge
---
2019-12-05T16:54:21.1379284Z     Checking panic_unwind v0.0.0 (/checkout/src/libpanic_unwind)
2019-12-05T16:54:22.0022176Z error: expected identifier, found keyword `const`
2019-12-05T16:54:22.0022589Z    --> src/libstd/net/ip.rs:841:13
2019-12-05T16:54:22.0022906Z     |
2019-12-05T16:54:22.0023295Z 841 |         let const IPV4_BUF_LEN = 16; // Long enough for the longest possible IPv4 address
2019-12-05T16:54:22.0023964Z     |
2019-12-05T16:54:22.0024271Z help: you can escape reserved keywords to use them as identifiers
2019-12-05T16:54:22.0024544Z     |
2019-12-05T16:54:22.0024544Z     |
2019-12-05T16:54:22.0025267Z 841 |         let r#const IPV4_BUF_LEN = 16; // Long enough for the longest possible IPv4 address
2019-12-05T16:54:22.0025905Z 
2019-12-05T16:54:22.0025905Z 
2019-12-05T16:54:22.0026247Z error: expected one of `:`, `;`, `=`, `@`, or `|`, found `IPV4_BUF_LEN`
2019-12-05T16:54:22.0026771Z     |
2019-12-05T16:54:22.0026771Z     |
2019-12-05T16:54:22.0027165Z 841 |         let const IPV4_BUF_LEN = 16; // Long enough for the longest possible IPv4 address
2019-12-05T16:54:22.0027576Z     |                   ^^^^^^^^^^^^ expected one of `:`, `;`, `=`, `@`, or `|` here
2019-12-05T16:54:22.0045143Z error: expected identifier, found keyword `const`
2019-12-05T16:54:22.0045501Z     --> src/libstd/net/ip.rs:1500:13
2019-12-05T16:54:22.0045755Z      |
2019-12-05T16:54:22.0045755Z      |
2019-12-05T16:54:22.0046107Z 1500 |         let const IPV6_BUF_LEN = 48;
2019-12-05T16:54:22.0046725Z      |
2019-12-05T16:54:22.0047054Z help: you can escape reserved keywords to use them as identifiers
2019-12-05T16:54:22.0047296Z      |
2019-12-05T16:54:22.0047296Z      |
2019-12-05T16:54:22.0047624Z 1500 |         let r#const IPV6_BUF_LEN = 48;
2019-12-05T16:54:22.0052307Z 
2019-12-05T16:54:22.0052307Z 
2019-12-05T16:54:22.0057107Z error: expected one of `:`, `;`, `=`, `@`, or `|`, found `IPV6_BUF_LEN`
2019-12-05T16:54:22.0057714Z      |
2019-12-05T16:54:22.0057714Z      |
2019-12-05T16:54:22.0058031Z 1500 |         let const IPV6_BUF_LEN = 48;
2019-12-05T16:54:22.0058451Z      |                   ^^^^^^^^^^^^ expected one of `:`, `;`, `=`, `@`, or `|` here
2019-12-05T16:54:22.9267733Z error: unused import: `crate::io::Write`
2019-12-05T16:54:22.9269074Z   --> src/libstd/net/ip.rs:11:5
2019-12-05T16:54:22.9269665Z    |
2019-12-05T16:54:22.9270210Z 11 | use crate::io::Write;
---
2019-12-05T16:54:25.1944196Z   local time: Thu Dec  5 16:54:25 UTC 2019
2019-12-05T16:54:25.4620394Z   network time: Thu, 05 Dec 2019 16:54:25 GMT
2019-12-05T16:54:25.4623664Z == end clock drift check ==
2019-12-05T16:54:32.0217703Z 
2019-12-05T16:54:32.0324723Z ##[error]Bash exited with code '1'.
2019-12-05T16:54:32.0354310Z ##[section]Starting: Checkout
2019-12-05T16:54:32.0356071Z ==============================================================================
2019-12-05T16:54:32.0356133Z Task         : Get sources
2019-12-05T16:54:32.0356205Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

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

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, 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.
2019-12-06T18:51:46.7039288Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-06T18:51:46.7179595Z ##[command]git config gc.auto 0
2019-12-06T18:51:46.7262575Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-06T18:51:46.7315303Z ##[command]git config --get-all http.proxy
2019-12-06T18:51:46.7456295Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/67035/merge:refs/remotes/pull/67035/merge
---
2019-12-06T18:57:35.5858739Z    Compiling serde_json v1.0.40
2019-12-06T18:57:37.2387426Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-06T18:57:47.7351169Z     Finished release [optimized] target(s) in 1m 23s
2019-12-06T18:57:47.7448552Z tidy check
2019-12-06T18:57:48.8490592Z tidy error: /checkout/src/libstd/net/ip.rs:1923: line longer than 100 chars
2019-12-06T18:57:50.4417648Z some tidy checks failed
2019-12-06T18:57:50.4427586Z Found 486 error codes
2019-12-06T18:57:50.4430084Z Found 0 error codes with no tests
2019-12-06T18:57:50.4430413Z Done!
2019-12-06T18:57:50.4430413Z Done!
2019-12-06T18:57:50.4430736Z 
2019-12-06T18:57:50.4430932Z 
2019-12-06T18:57:50.4433307Z 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"
2019-12-06T18:57:50.4433459Z 
2019-12-06T18:57:50.4433504Z 
2019-12-06T18:57:50.4445286Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-06T18:57:50.4445371Z Build completed unsuccessfully in 0:01:27
2019-12-06T18:57:50.4445371Z Build completed unsuccessfully in 0:01:27
2019-12-06T18:57:50.4493628Z == clock drift check ==
2019-12-06T18:57:50.4504571Z   local time: Fri Dec  6 18:57:50 UTC 2019
2019-12-06T18:57:50.4677549Z   network time: Fri, 06 Dec 2019 18:57:50 GMT
2019-12-06T18:57:50.4681787Z == end clock drift check ==
2019-12-06T18:57:51.8729037Z 
2019-12-06T18:57:51.8857354Z ##[error]Bash exited with code '1'.
2019-12-06T18:57:51.8885090Z ##[section]Starting: Checkout
2019-12-06T18:57:51.8886676Z ==============================================================================
2019-12-06T18:57:51.8886749Z Task         : Get sources
2019-12-06T18:57:51.8886795Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Goirad
Copy link
Contributor Author

Goirad commented Dec 11, 2019

@shepmaster Any thoughts on this?

@llogiq
Copy link
Contributor

llogiq commented Dec 13, 2019

shepmaster appears to be busy, I'd suggest someone else @rust-lang/libs review this. To me personally, the implementation looks good, but I don't know if I can r+ this (I've only recently been added to the org and no one explained to me how this works yet).

@shepmaster
Copy link
Member

Let's pick someone else from libs, indeed... RNG says:

r? @SimonSapin

@dtolnay
Copy link
Member

dtolnay commented Dec 13, 2019

FYI please don't ping @SimonSapin unless they are specifically the best person to review. #66341 (comment)

r? @dtolnay

@rust-highfive rust-highfive assigned dtolnay and unassigned SimonSapin Dec 13, 2019
src/libstd/net/ip.rs Outdated Show resolved Hide resolved
src/libstd/net/ip.rs Outdated Show resolved Hide resolved
@dtolnay
Copy link
Member

dtolnay commented Dec 13, 2019

LGTM once there is a test.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@dtolnay
Copy link
Member

dtolnay commented Dec 13, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Dec 13, 2019

📌 Commit 58524262c2258d821a5f3b48ce6b5a9e5813e08f has been approved by dtolnay

@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 Dec 13, 2019
@dtolnay
Copy link
Member

dtolnay commented Dec 13, 2019

Make sure your work email is listed in https://github.com/settings/emails if you want this commit attributed to your GitHub account.

@Goirad
Copy link
Contributor Author

Goirad commented Dec 13, 2019

@dtolnay Thanks for the heads up, I didn't even realize this was a thing

@SimonSapin
Copy link
Contributor

Thanks @dtolnay.

@shepmaster for finding reviewers, may I suggest drawing from https://github.com/rust-lang/highfive/blob/master/highfive/configs/rust-lang/rust.json ?

@shepmaster
Copy link
Member

for finding reviewers

Thanks. I tend to just look at the teams page; perhaps it's silly of me to assume they are identical, but the web page is way easier to find.

@bors
Copy link
Contributor

bors commented Dec 23, 2019

☔ The latest upstream changes (presumably #67540) made this pull request unmergeable. Please resolve the merge conflicts.

@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 Dec 23, 2019
@SimonSapin
Copy link
Contributor

@shepmaster I’ve opened rust-lang/highfive#241 for a potential way to make that easier.

@Goirad
Copy link
Contributor Author

Goirad commented Dec 27, 2019

@dtolnay I'm not sure if it actually makes a difference for bors, but I think this should be waiting-on-bors instead of waiting-on-author

@dtolnay
Copy link
Member

dtolnay commented Dec 27, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Dec 27, 2019

📌 Commit 915686d has been approved by dtolnay

@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 Dec 27, 2019
@bors
Copy link
Contributor

bors commented Dec 27, 2019

⌛ Testing commit 915686d with merge 74c4e6a...

bors added a commit that referenced this pull request Dec 27, 2019
Implement padding for IpAddr without heap alloc

Implements padding for `IpAddr`s without heap allocations.
This fixes issue #66810 .

cc @jethrogb @mzohreva
@bors
Copy link
Contributor

bors commented Dec 27, 2019

☀️ Test successful - checks-azure
Approved by: dtolnay
Pushing 74c4e6a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 27, 2019
@bors bors merged commit 915686d into rust-lang:master Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

10 participants