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

Backfill contents since 1.0 #75

Merged
merged 38 commits into from
Aug 10, 2018
Merged

Backfill contents since 1.0 #75

merged 38 commits into from
Aug 10, 2018

Conversation

steveklabnik
Copy link
Member

@steveklabnik steveklabnik commented Aug 6, 2018

This PR effectively re-writes the entire edition guide.

  1. We now talk about every feature since rust 1.0; each is tagged with a minimum version. They're roughly ordered from oldest to newest.
  2. The current contents are imported where it makes sense
    • Some changes (crate visibility modifier, in-band lifetimes) have been dropped since they're also dropping from the edition probably

Most of this was taken from the various blog posts for various releases. It's not in as clean of a format as the new stuff is, but I'd like to land this first, and then look to doing that.

I'm pretty sure these tests will fail as I didn't really pay attention to code samples, but let's see!

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

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

Generally speaking I quite like this. Some thoughts:

  • A diff of the standard library, probably just a snapshot of all release notes concatenated would be of interest to me, at least so we can see what it looks like.
  • I think a status page (ideally auto-generated, but I understand that's quite hard) with the minimum rust versions would I think be good, especially for things not yet stable. This might be removed with the release.

same size as `*mut T`. It is allowed to dangle if it isn't dereferenced.

If you’re building a data structure with unsafe code, `NonNull<T>` is often
the right type for you!
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps worth mentioning NonZero types here as well? Seem similar in concept

Copy link
Member Author

Choose a reason for hiding this comment

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

I felt like this type is more significant. They're similar, but I feel like this will get way more use.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would mention it even if NonNull will get way more use.


```

Both `since` and `note` are optional.
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps make a small note that since can be in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

i did this

This has enabled tools like
[`cargo-vendor`](https://github.com/alexcrichton/cargo-vendor) and
[`cargo-local-registry`](https://github.com/alexcrichton/cargo-local-registry),
which are often useful for "offline builds." They preparing the list of all
Copy link
Member

Choose a reason for hiding this comment

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

nit: They prepare


![Minimum Rust version: 1.16](https://img.shields.io/badge/Minimum%20Rust%20Version-1.16-brightgreen.svg) for being built-in

![Minimum Rust version: various](https://img.shields.io/badge/Minimum%20Rust%20Version-various-brightgreen.svg) using [this package](https://github.com/rsolomo/cargo-check) for older versions
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I'd maybe omit this. I'm not sure how I feel about it, but generally seems like sticking to 'core language' here would streamline things. We can maybe include a general note that some features were pulled into core from others libraries.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm willing to do that, sure


![Minimum Rust version: various](https://img.shields.io/badge/Minimum%20Rust%20Version-various-brightgreen.svg) using [this package](https://github.com/rsolomo/cargo-check) for older versions

`cargo check`is a new subcommand should speed up the development
Copy link
Member

Choose a reason for hiding this comment

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

nit: space after cargo check

@@ -0,0 +1,35 @@
# Gobal allocators
Copy link
Member

Choose a reason for hiding this comment

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

nit: Global

@@ -0,0 +1 @@
# Incremental Compilation for faster compiles
Copy link
Member

Choose a reason for hiding this comment

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

Looks like an accidental page? This is included in incremental-compilation.md

Copy link
Member Author

Choose a reason for hiding this comment

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

other way around; that one is accidental but yes

![Minimum Rust version: 1.28](https://img.shields.io/badge/Minimum%20Rust%20Version-1.28-red.svg) for drafts of the 2018 edition

We've distributed a copy of "The Rust Programming Language," affectionatly
nicknamed "the book", whith every version of Rust since Rust 1.0.
Copy link
Member

Choose a reason for hiding this comment

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

nit: with

Press](https://nostarch.com/Rust). Now that the print version has shipped,
the second edition is frozen.

The names are a bit confusing though, becuase the "second edition" of the
Copy link
Member

Choose a reason for hiding this comment

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

nit: because

uses it by default.

As of Rust 1.23, we still defaulted to `hoedown`, but you could enable
Commonmark via a flag, `--enable-commonmark`.
Copy link
Member

Choose a reason for hiding this comment

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

"But we now only support the CommonMark markdown specification"

@steveklabnik
Copy link
Member Author

A diff of the standard library, probably just a snapshot of all release notes concatenated would be of interest to me, at least so we can see what it looks like.

This is a ton of work, due to the way release notes are written. I'm not opposed to having this, but I really, really don't want to do it ;)

@Mark-Simulacrum
Copy link
Member

Yeah, I think I might find some time to get a loose sketch going -- I agree the release notes don't lend themselves well to that today :)

@steveklabnik
Copy link
Member Author

Tests are now passing; what do I need to do to get this merged? :)

@Centril
Copy link
Contributor

Centril commented Aug 7, 2018

I'd like to give this a review before merging :)

I'll give it some time today.

@Centril Centril self-requested a review August 7, 2018 19:51
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

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

Here goes :)


Since we can interpret the data held in the union using the wrong variant and
Rust can’t check this for us, that means reading or writing a union’s field
is unsafe:
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

In general with docs, we focus on stable Rust; I don't want to speculate on things until they're actually tied down.

@@ -0,0 +1,119 @@
# The 'try' operator, ? for easier error handling
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably avoid calling this the "try operator" because of try { .. } blocks and rust-lang/rfcs#2388 (comment).

As a temporary alternative, I think "question mark operator" or "re-throw operator" works.

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't the reason to call this the try operator try blocks?

We do call it "the question mark operator" in the book, so I'm open to change it; I thought it was changing to try

Copy link
Contributor

Choose a reason for hiding this comment

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

That is what I argued on the try { .. } RFC; rust-lang/rfcs#2388 (comment), rust-lang/rfcs#2388 (comment). However, people, rust-lang/rfcs#2388 (comment), did not seem to agree :)

@@ -0,0 +1,33 @@
# The Rust Bookshelf
Copy link
Contributor

Choose a reason for hiding this comment

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

And it will get a new member too! This guide! 😆

@@ -1,4 +1,6 @@
# `'_`, the anonymous lifetime
# '_, the anonymous lifetime
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm; having this in backticks highlights that this is code which is useful.

Copy link
Member Author

Choose a reason for hiding this comment

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

an oversight! will fix

@@ -0,0 +1,11 @@
# std::os has documentation for all platforms
Copy link
Contributor

Choose a reason for hiding this comment

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

backticks around std::os I'd say.


These are twice the size of `u64`, and so can hold more values. More specifically,

* `u128`: `0` - `340,282,366,920,938,463,463,374,607,431,768,211,455`
Copy link
Contributor

Choose a reason for hiding this comment

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

This kinda looks like an array; I'd use underscore instead as a separator.

Copy link
Member Author

Choose a reason for hiding this comment

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

we used this text in the release blog post and people were not generally confused

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose; however, 340_282_366_920_938_463_463_374_607_431_768_211_455 has the benefit of being legal Rust code :)

These are twice the size of `u64`, and so can hold more values. More specifically,

* `u128`: `0` - `340,282,366,920,938,463,463,374,607,431,768,211,455`
* `i128`: `−170,141,183,460,469,231,731,687,303,715,884,105,728` - `170,141,183,460,469,231,731,687,303,715,884,105,727`
Copy link
Contributor

Choose a reason for hiding this comment

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

Here too.

Note that the standard library grows with each Rust release; there are *many*
additions to the standard library that are not called out in this guide. Only
the most absolutely major ones are, but there's tons of medium and small
Copy link
Contributor

Choose a reason for hiding this comment

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

most absolutely major ones? wow, they must be real special! 😜
I think "major ones" suffices :)


## Rust 2018

- [Rust 2018](rust-2018/index.md)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably organize this a bit into categories after this PR; The flat list is a bit chaotic.

Copy link
Member Author

Choose a reason for hiding this comment

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

I found the categories far more confusing, personally

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it doesn't work well with ordering also... let's not do it for now then :)

book.toml Outdated
@@ -1,5 +1,5 @@
[book]
authors = ["The Rust Project Developers"]
authors = ["steveklabnik"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Haha :P I guess you've earned this but I think it would be nice to keep this as is ;)

@Centril
Copy link
Contributor

Centril commented Aug 8, 2018

This is a ton of work, due to the way release notes are written. I'm not opposed to having this, but I really, really don't want to do it ;)

I can take one for the team :)


![Minimum Rust version: 1.12](https://img.shields.io/badge/Minimum%20Rust%20Version-1.12-brightgreen.svg)

We're always working on erorr improvements, and there are little improvements

Choose a reason for hiding this comment

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

typo: error

@steveklabnik steveklabnik merged commit b98d273 into master Aug 10, 2018
@steveklabnik
Copy link
Member Author

Thanks for the reviews everyone! I'm merging this in; if we want to tweak it further, please open issues/send PRs! :D <3

@steveklabnik steveklabnik deleted the backfill-contents branch August 10, 2018 18:14
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.

4 participants