Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Expand docs on Iterator::intersperse #81173

Merged
merged 2 commits into from
Jan 22, 2021
Merged

Conversation

lukaslueg
Copy link
Contributor

Unstable feature in #79524. This expands on the docs to bring them more in line with how other methods of Iterator are demonstrated.

@rust-highfive
Copy link
Contributor

r? @withoutboats

(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
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 29 tests
iiiiiiiiiiiiiiiiiiiiiiiiiiiii

Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
 finished in 0.064 seconds
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
Suite("src/test/debuginfo") not skipped for "bootstrap::test::Debuginfo" -- not in ["src/tools/tidy"]
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 116 tests
iiiiiiiiii.i.i..i..i..ii....i.i.....ii.........iiii.........i.....i...i.......ii.i.ii.....iiii.....i 100/116
test result: ok. 78 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 2.01s

 finished in 2.075 seconds
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
---
..................i.....................i........................................................... 2800/2822
......................
failures:

---- src/iter/traits/iterator.rs - iter::traits::iterator::Iterator::intersperse_with (line 629) stdout ----
error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
12 | assert_eq!(it.next(), Some(NotClone(0)));  // The first element from `v`.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
12 | assert_eq!(it.next(), Some(NotClone(0)));  // The first element from `v`.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
13 | assert_eq!(it.next(), Some(NotClone(99))); // The separator.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
13 | assert_eq!(it.next(), Some(NotClone(99))); // The separator.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
14 | assert_eq!(it.next(), Some(NotClone(1)));  // The next element from `v`.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
14 | assert_eq!(it.next(), Some(NotClone(1)));  // The next element from `v`.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
15 | assert_eq!(it.next(), Some(NotClone(99))); // The separator.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
15 | assert_eq!(it.next(), Some(NotClone(99))); // The separator.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
16 | assert_eq!(it.next(), Some(NotClone(2)));  // The last element from from `v`.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
16 | assert_eq!(it.next(), Some(NotClone(2)));  // The last element from from `v`.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
17 | assert_eq!(it.next(), None);               // The iterator is finished.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `NotClone` doesn't implement `Debug`
   |
   |
17 | assert_eq!(it.next(), None);               // The iterator is finished.
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NotClone` cannot be formatted using `{:?}`
   |
   = help: the trait `Debug` is not implemented for `NotClone`
   = note: add `#[derive(Debug)]` or manually implement `Debug`
   = note: required because of the requirements on the impl of `Debug` for `Option<NotClone>`
   = note: 1 redundant requirements hidden
   = note: required because of the requirements on the impl of `Debug` for `&Option<NotClone>`
   = note: required by `std::fmt::Debug::fmt`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 12 previous errors

For more information about this error, try `rustc --explain E0277`.
Couldn't compile the test.
---

error: test failed, to rerun pass '--doc'


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/library/test/Cargo.toml" "-p" "core" "--" "--quiet"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:19:10

@lukaslueg
Copy link
Contributor Author

r? @m-ou-se
as she reviewed the whole feature. Excuse my ignorance if this is unwanted.

@jyn514 jyn514 added A-iterators Area: Iterators A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Jan 19, 2021
Copy link
Contributor

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @lukaslueg! I just had one nitpicky thought, but adding examples is great.

Copy link
Member

@m-ou-se m-ou-se left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks!

r=me with the typo fixed:

@m-ou-se
Copy link
Member

m-ou-se commented Jan 21, 2021

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jan 21, 2021

📌 Commit c61785e 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 21, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 22, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#80573 (Deny rustc::internal lints for rustdoc and clippy)
 - rust-lang#81173 (Expand docs on Iterator::intersperse)
 - rust-lang#81194 (Stabilize std::panic::panic_any.)
 - rust-lang#81202 (Don't prefix 0x for each segments in `dbg!(Ipv6)`)
 - rust-lang#81225 (Make 'docs' nullable in rustdoc-json output)
 - rust-lang#81227 (Remove doctree::StructType)
 - rust-lang#81233 (Document why not use concat! in dbg! macro)
 - rust-lang#81236 (Gracefully handle loop labels missing leading `'` in different positions)
 - rust-lang#81241 (Turn alloc's force_expr macro into a regular macro_rules.)
 - rust-lang#81242 (Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 226fe55 into rust-lang:master Jan 22, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 22, 2021
@lukaslueg lukaslueg deleted the intersperse_docs branch January 22, 2021 19:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-iterators Area: Iterators 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