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

Fix intersperse_fold #81152

Merged
merged 2 commits into from
Jan 22, 2021
Merged

Fix intersperse_fold #81152

merged 2 commits into from
Jan 22, 2021

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Jan 18, 2021

Here is a standalone playground link in case anybody wants to modify code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=626b4d044fb74f044a36098ad907e40f

Fixes #81145

cc #79479 @jonas-schievink

@rust-highfive
Copy link
Collaborator

r? @shepmaster

(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 Jan 18, 2021
@tesuji

This comment has been minimized.

@rust-highfive rust-highfive assigned m-ou-se and unassigned shepmaster Jan 18, 2021
@tesuji tesuji marked this pull request as ready for review January 18, 2021 03:13
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
Checking which error codes lack tests...
Found 435 error codes
Found 0 error codes with no tests
Done!
tidy error: `/checkout/library/core/src/iter/adapters/intersperse/tests.rs:3` contains `#[test]`; core unit tests and benchmarks must be placed into `core/tests` or `core/benches`
some tidy checks failed

command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "/checkout/obj/build"
expected success, got: exit code: 1

@tesuji
Copy link
Contributor Author

tesuji commented Jan 18, 2021

The second commit 72dd5a445a3c6663399c86cd33235b5f9e6bd099 is the result of
./x.py fmt run locally. I expected CI catches fmt error. Does something go wrong ? cc @Mark-Simulacrum

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
    Checking rand v0.7.3
    Checking alloc v0.0.0 (/checkout/library/alloc)
    Checking std v0.0.0 (/checkout/library/std)
    Checking core v0.0.0 (/checkout/library/core)
error[E0624]: associated function `new` is private
     |
     |
3567 |     let v = Intersperse::new(1..4, 9).fold(Vec::new(), |mut acc, x| {
     |                          ^^^ private associated function

error[E0624]: associated function `new` is private
     |
     |
3573 |     let mut iter = Intersperse::new(1..4, 9);
     |                                 ^^^ private associated function
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0624`.
error: could not compile `core`
error: could not compile `core`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "i686-pc-windows-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/library/test/Cargo.toml" "--all-targets" "-p" "test" "-p" "term" "-p" "std" "-p" "alloc" "-p" "unwind" "-p" "core" "-p" "panic_unwind" "-p" "proc_macro" "-p" "panic_abort" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu --all-targets
Build completed unsuccessfully in 0:00:44

@Mark-Simulacrum
Copy link
Member

It looks like your local branch is using the wrong rustfmt for some reason, not sure why that would be though. Please file an issue if you can't successfully drop it from this PR so that I can investigate.

@nagisa
Copy link
Member

nagisa commented Jan 18, 2021

Can you add a test with a string, such as reported in the original issue? They said that collecting into a vector did work regardless, but not when it was collected into a string.

@m-ou-se m-ou-se added A-iterators Area: Iterators T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 18, 2021
@tesuji
Copy link
Contributor Author

tesuji commented Jan 18, 2021

Here is the playground link of such test: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=26f37fc7f7fa317f3d458623d047952b

Will add that test soon though I feel the test redundant.

@tesuji tesuji force-pushed the intersperse_fold branch 2 times, most recently from 47d9c92 to 4f8bfad Compare January 18, 2021 13:53
@lukaslueg
Copy link
Contributor

cc @camelid
I'm unsure if the fix is correct with respect to the comment which this PR also removes.

@m-ou-se
Copy link
Member

m-ou-se commented Jan 19, 2021

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Jan 19, 2021

📌 Commit 9272d53 has been approved by m-ou-se

@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 Jan 19, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 20, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 20, 2021
@bors
Copy link
Contributor

bors commented Jan 21, 2021

⌛ Testing commit 9272d53 with merge 202720b...

@bors
Copy link
Contributor

bors commented Jan 22, 2021

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 202720b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 22, 2021
@bors bors merged commit 202720b into rust-lang:master Jan 22, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 22, 2021
@tesuji tesuji deleted the intersperse_fold branch January 22, 2021 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-iterators Area: Iterators 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Iterator::intersperse doesn't seem to work correctly when collecting into a String