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

Explained the difference between ownership iteration and reference iteration #32002

Merged
merged 4 commits into from
Mar 5, 2016
Merged

Explained the difference between ownership iteration and reference iteration #32002

merged 4 commits into from
Mar 5, 2016

Conversation

srinivasreddy
Copy link
Contributor

Issue here : #31991

@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 @Manishearth (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.

@srinivasreddy srinivasreddy changed the title Explained the difference between ownership iteration and reference it… Explained the difference between ownership iteration and reference iteration Mar 2, 2016
@@ -114,7 +114,30 @@ for i in v {
println!("Take ownership of the vector and its element {}", i);
}
```
Note: You cannot use the vector again once you have iterated with ownership of the vector.
Copy link
Member

Choose a reason for hiding this comment

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

iterated by taking ownership of the vector

Copy link
Member

Choose a reason for hiding this comment

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

(Also, please put a newline above this line as well)

@steveklabnik
Copy link
Member

Thanks so much @srinivasreddy ! I like @Manishearth 's grammar suggestions, and I have some whitespace ones as well. We're good to go after that's fixed up!

@srinivasreddy
Copy link
Contributor Author

@steveklabnik Welcome!! @Manishearth Please review and merge

}

for i in &v {
println!("This is a reference {}", i);
Copy link
Member

Choose a reason for hiding this comment

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

make this text match the previous

@srinivasreddy
Copy link
Contributor Author

@Manishearth Done

@Manishearth
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 2, 2016

📌 Commit 2dc723d has been approved by Manishearth

@Manishearth
Copy link
Member

Thanks!

@srinivasreddy
Copy link
Contributor Author

@Manishearth I am new to travis. Do you see any reason for build failure? Could you please help me ?

You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
For example, the following code does not compile.

```rust
Copy link
Member

Choose a reason for hiding this comment

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

you need to have rust,ignore here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Manishearth Done. Please issue auto merge

@Manishearth
Copy link
Member

Ah, in this case the doctest failed. Rust code in documentation is compiled and run as a test, so your example of failing code should be annotated as mentioned above to skip this.

@bors
Copy link
Contributor

bors commented Mar 3, 2016

⌛ Testing commit 2dc723d with merge 02c4cb5...

@bors
Copy link
Contributor

bors commented Mar 3, 2016

💔 Test failed - auto-linux-64-opt

@Manishearth
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 3, 2016

📌 Commit d2df551 has been approved by Manishearth

@srinivasreddy
Copy link
Contributor Author

@Manishearth Please merge. Or could @bors automatically merge this?

@Manishearth
Copy link
Member

Yes. Bors will run tests on the CI and automatically merge if they pass, like last time.

@Manishearth
Copy link
Member

There's a queue (http://buildbot.rust-lang.org/homu/queue/rust), so it might take some time for your PR to get merged.

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 4, 2016
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Mar 4, 2016
bors added a commit that referenced this pull request Mar 4, 2016
@alexcrichton alexcrichton merged commit d2df551 into rust-lang:master Mar 5, 2016
@srinivasreddy srinivasreddy deleted the vector_doc branch March 5, 2016 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants