Skip to content

Rust 1.13 announcement #136

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

Closed

Conversation

steveklabnik
Copy link
Member

Based on a bunch of stuff @brson wrote

/cc @rust-lang/core

I have "allow edits from maintainers" on so you can just push changes to this branch if you'd like to make them.

Based on a bunch of stuff @brson wrote
@rust-highfive
Copy link

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

!4 = !{i32 2, !"Debug Info Version", i32 3}
```

You're eyes don't deceive you. This crate contains no code at all, and it's not
Copy link

Choose a reason for hiding this comment

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

Your


In some cases this results in dramatic improvements. Build times for the ndarray
crate [improved by 50%][ev2], and in the (unreleased) [winapi 0.3] crate, which
is nothing but inline functions, rustc now generates the following LLVM IR:
Copy link
Member

Choose a reason for hiding this comment

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

To clarify, it has plenty of things other than inline functions, its just that all the functions are inline.

the crate they are defined _unless_ they are called directly. This saves the
cost of rustc converting the function to LLVM IR and LLVM optimizing and
converting the function to machine code (TODO is this right about converting to
machine code - were these functions public before?).
Copy link
Member

Choose a reason for hiding this comment

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

Yes, that's correct.

GitHub. 1448 patches were landed in this release.

[install]: https://www.rust-lang.org/install.html
[notes]:
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: add notes link

### What's in 1.13.0 stable

The two big things in Rust 1.13 stable are compiler performance and a new
operator, `?`. As usual, there's also a number of library stabilizations and
Copy link
Contributor

Choose a reason for hiding this comment

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

Wording a little awk. Maybe "Rust 1.13 comes with two big improvements: a new ? operator that makes error handling easier and fixes to compiler performance improvements of XX%"

diagnostic](https://github.com/rust-lang/rust/issues/35946), we now have
the ability to do so.

#### Performance improvements
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs a graph or two in the release announcement, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a graph linked, but yeah it would be better to be inline.

let mut f = match f {
Ok(file) => file,
Err(e) => return Err(e),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

People would write this with try! today, right? Feels like we might as well just write the idiomatic Rust and then show how it got better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried doing so, but this particular example is too simple, and doesn't look like a compelling justification of ? over try!. I have a more complex example here in comparison.

I do like that this current explains what ? does, not just that it's the same as try!.

unwraps it and gives the inner value. If it was an `Err`, it returns from
the function you're currently in.

Seasoned Rustaceans may recongize that this is the same as the `try!` macro
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do a quick search of crates.io to see how much try! is used? I'd assume people are using it, but if it's not often used, perhaps it needs this introduction.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can do that.

poor error messages, and is very ugly when chained together. Consider:

```rust
try!(try!(try!(foo()).bar()).baz())
Copy link
Contributor

Choose a reason for hiding this comment

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

Do people write patterns like this? I'd assume this would be a bit more of an expanded form with unnecessary steps, like:

let f = try!(foo());
let g = try!(f.bar());
let h = try!(g.baz());

Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't write that because it's so ugly. Now you can though because it's not ugly!

!1 = !DIFile(filename: ".\5Csrc\5Clib.rs", directory: "C:\5Cmsys64\5Chome\5CPeter\5Cwinapi-rs")
!2 = !{}
!3 = !{i32 2, !"CodeView", i32 1}
!4 = !{i32 2, !"Debug Info Version", i32 3}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this llvm? I don't think most people will be able to read this (I know it took me a while looking at it to figure out what was possibly going on). Is there another way we can show this, maybe?

Copy link
Contributor

Choose a reason for hiding this comment

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

I picked this because it's one of the interesting examples we had on hand, and I think a little technical peek under the hood is not too risky. Maybe it could be explained better, replaced with something else visually interesting, like an inline graph, or just removed.

@brson
Copy link
Contributor

brson commented Nov 9, 2016

Since @steveklabnik is out today I opened another PR with edits: #137.

I have not yet addressed all @jonathandturner's comments.

@brson
Copy link
Contributor

brson commented Nov 9, 2016

try! appears 99757 times on crates.io

@brson
Copy link
Contributor

brson commented Nov 9, 2016

Do we want to talk about diagnostics? There are a few PRs with pretty pictures we could steal.

@sophiajt
Copy link
Contributor

sophiajt commented Nov 9, 2016

@brson - true, I could try to dig around and see which new one landed in the beta

@sophiajt
Copy link
Contributor

sophiajt commented Nov 9, 2016

@brson - here's an example that improved between stable and the beta:

Before:

screen shot 2016-11-09 at 3 26 28 pm

After:

screen shot 2016-11-09 at 3 26 38 pm

@brson
Copy link
Contributor

brson commented Nov 9, 2016

All the diagnostics PRs.

@brson
Copy link
Contributor

brson commented Nov 9, 2016

I think the giant lists of library and cargo features are overwhelming, already produced in this form in the release notes themselves. Maybe we can just have a short section listing other notable stuff.

#### Performance improvements


There has bee a lot of focus on compiler performance lately. There's good news
Copy link

Choose a reason for hiding this comment

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

Typo: bee

@aturon
Copy link
Member

aturon commented Nov 9, 2016

This has been moved to a fresh PR: #137

@aturon aturon closed this Nov 9, 2016
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.

9 participants