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

Document drop scopes #514

Merged
merged 5 commits into from
Apr 19, 2020
Merged

Conversation

matthewjasper
Copy link
Contributor

Closes #452

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

This is amazing! Sorry I can't provide a more useful review.

All of the links to expressions.html#temporary-lifetimes throughout the reference need to be updated to the new location (#temporaries I think).

src/expressions.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
src/destructors.md Outdated Show resolved Hide resolved
@pnkfelix
Copy link
Member

@matthewjasper sorry I had not noticed this until now. I'll try to provide my review soon

src/destructors.md Outdated Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Nov 7, 2019

ping @pnkfelix :)
cc also @nikomatsakis

@Centril Centril self-assigned this Apr 8, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 10, 2020

I rebased this on the latest master and resolved the conflicts.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

I gave a quick read and this seemed quite good. I also scheduled myself some more time to read the temporary lifetime rules, in particular, more closely. Thanks @matthewjasper!

* The elements of an [array] or owned [slice][array] are dropped from the
first element to the last. \*
* The captured values of a [closure] are dropped in an unspecified order.
* The fields of a [struct] or [tuple] are dropped in declaration order.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: tuples are not declared, right? I think I would say "The fields of a tuple are dropped in order." or something

partially_initialized.0 = ShowOnDrop("Partial tuple first");
```

## Drop scopes
Copy link
Contributor

Choose a reason for hiding this comment

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

The documentation is "in the code", as they predate RFCs. Thanks @matthewjasper for writing it up, I too had an "in progress" write-up somewhere (part of a larger amendment to RFC 66...) but I'm happy to have someone else take a crack at it.

Some relevant links:

@matthewjasper matthewjasper merged commit 22ac838 into rust-lang:master Apr 19, 2020
@matthewjasper matthewjasper deleted the drop-scopes branch April 19, 2020 12:21
[expressions chapter]: expressions.md
[lifetime of temporaries]: expressions.md#temporary-lifetimes
[linkage]: linkage.md
[expressions chapter]: expressions.html
Copy link
Contributor

Choose a reason for hiding this comment

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

These md -> html changes may not really useful as mdbook handles that. cc @ehuss

Copy link
Contributor

Choose a reason for hiding this comment

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

@lzutao can you send a PR to fix it?

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Apr 28, 2020
Update books

## nomicon

5 commits in 6eb24d6e9c0773d4aee68ed5fca121ce3cdf676a..4d2d275997746d35eabfc4d992dfbdcce2f626ed
2020-04-06 02:21:15 +0200 to 2020-04-27 10:24:52 -0400
- Fix example in FFI, section NPO
- Update implementation code of `split_at_mut`
- Use rust-lang/rust linkchecker on CI.
- Use just `std::_` instead of `::std::_`
- Remove illegal space.

## reference

2 commits in 3ce94ca..ed22e6fbfcb6ce436e9ea3b4bb4a55b2fb50a57e
2020-04-11 17:00:27 +0200 to 2020-04-24 12:46:22 -0700
- Fix grammer for tuple patterns and tuple struct patterns (rust-lang/reference#794)
- Document drop scopes (rust-lang/reference#514)

## book

2 commits in f5db319e0b19c22964398d56bc63103d669e1bba..e37c0e84e2ef73d3a4ebffda8011db6814a3b02d
2020-04-13 08:06:03 -0500 to 2020-04-26 09:31:36 -0500
- Mention short-circuiting in Appendix 02 (rust-lang/book#2318)
- Increase HTTP buffer size and add 'Content-Length' header (rust-lang/book#2246)

## rust-by-example

8 commits in c106d1683c3a2b0960f0f0fb01728cbb19807332..ffc99581689fe2455908aaef5f5cf50dd03bb8f5
2020-04-09 09:14:39 -0300 to 2020-04-24 15:05:04 -0300
- Fix Example -> Examples (rust-lang/rust-by-example#1340)
- Make unsuffixed literal plural (rust-lang/rust-by-example#1335)
- Ensure example error matches the comment (rust-lang/rust-by-example#1336)
- Add missing triple backticks (rust-lang/rust-by-example#1339)
- Clarify conditional compilation (rust-lang/rust-by-example#1338)
- Clarifies how to customize lib crate name (rust-lang/rust-by-example#1337)
- Fix bytes of youkoso in shiftjis (rust-lang/rust-by-example#1333)
- Fix possible typo (rust-lang/rust-by-example#1334)

## embedded-book

4 commits in 668fb07b6160b9c468f598e839c1e044db65de30..40beccdf1bb8eb9184a2e3b42db8b8c6e394247f
2020-04-13 12:38:16 +0000 to 2020-04-26 17:44:14 +0000
- Add hint on memory config to GDB debugging section  (rust-embedded/book#215)
- Adds cargo-generate to installation instructions  (rust-embedded/book#213)
- collections: Fix example allocator  (rust-embedded/book#206)
- Flip111/patch 8  (rust-embedded/book#233)
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.

Explicitly describe temporary drop order difference between return expr; and final block expression
7 participants