-
Notifications
You must be signed in to change notification settings - Fork 304
Announce Rust 1.89.0 #1666
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
base: master
Are you sure you want to change the base?
Announce Rust 1.89.0 #1666
Conversation
Hi relnotes-interest-group, this PR adds a release blog post. Could you review cc @alex-semenyuk @jieyouxu @joshtriplett @Kobzol @lcnr @traviscross |
The `target_feature` attribute now supports the `sha512`, `sm3`, `sm4`, `kl` and `widekl` target features on x86. Additionally a number of `avx512` intrinsics and target features are also supported on x86: | ||
|
||
```rust | ||
#[target_feature(enable = "avx512bw")] | ||
pub fn cool_simd_code(/* .. */) -> /* ... */ { | ||
/* ... */ | ||
} | ||
|
||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also specify that all avx512 intrinsics in std::arch::{x86,x86_64}
are stable now (same for the other target features).
Edit: nvm I didn't see it right
### Explicitly inferred arguments to const generics | ||
|
||
Rust now supports `_` as an argument to const generic parameters, inferring the value from surrounding context: | ||
|
||
```rust | ||
pub fn make_bitset<const LEN: usize>() -> [bool; LEN] { | ||
[false; _] | ||
} | ||
``` | ||
|
||
Similar to the rules for when `_` is permitted as a type, `_` is not permitted as an argument to const generics when in a signature: | ||
|
||
```rust | ||
// This is not allowed | ||
pub fn make_bitset<const LEN: usize>() -> [bool; _] { | ||
[false; LEN] | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @rust-lang/project-const-generics
} | ||
|
||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're playing a little fast and loose with the timing of this announcement, but the "worst" case is that we extend support one more release, which people are unlikely to be unhappy about.
### Demoting `x86_64-apple-darwin` to Tier 2 with host tools | |
GitHub will soon [discontinue][gha-sunset] providing free macOS x86\_64 runners for public repositories. Apple has also announced their [plans][apple] for discontinuing support for the x86\_86 architecture. | |
In accordance with these changes, the Rust project is in the [process of demoting the `x86_64-apple-darwin` target][rfc] from Tier 1 to Tier 2 with host tools. This means that the target, including tools like `rustc` and `cargo`, will be guaranteed to build but is not guaranteed to pass our automated test suite. | |
We expect that the RFC for the demotion to Tier 2 with host tools will be accepted between the releases of Rust 1.89 and 1.90, which means that Rust 1.89 will be the last release of Rust where x86\_64 macOS is a Tier 1 target. | |
For users, nothing will change. Builds of both the standard library and the compiler will still be distributed by the Rust Project for use via `rustup` or alternative installation methods. | |
[apple]: https://en.wikipedia.org/wiki/Mac_transition_to_Apple_silicon#Timeline | |
[gha-sunset]: https://github.blog/changelog/2025-07-11-upcoming-changes-to-macos-hosted-runners-macos-latest-migration-and-xcode-support-policy-updates/#macos-13-is-closing-down | |
[rfc]: https://github.com/rust-lang/rfcs/pull/3841 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe s/x86_64 macOS/x86_64-apple-darwin
/.
### Mismatched lifetimes syntax lint | ||
|
||
TC/LANG to write this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mismatched lifetime syntaxes lint
Lifetime elision in function signatures is an ergonomic aspect of the Rust language, but it can also be a stumbling point for newcomers and experts alike. This is especially true when lifetimes are inferred in types where it isn't syntactically obvious that a lifetime is even present:
// The returned type `std::slice::Iter` has a lifetime,
// but there's no visual indication of that.
//
// Lifetime elision infers the lifetime of the return
// value to be the same as the argument `scores`.
fn items(scores: &[u8]) -> std::slice::Iter<u8> {
scores.iter()
}
Code like this will now produce a warning by default:
warning: hiding a lifetime that's elided elsewhere is confusing
--> src/lib.rs:2:18
|
2 | fn items(scores: &[u8]) -> std::slice::Iter<u8> {
| ^^^^^ -------------------- the same lifetime is hidden here
| |
| the lifetime is elided here
|
= help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
|
2 | fn items(scores: &[u8]) -> std::slice::Iter<'_, u8> {
| +++
We first attempted to improve this situation back in 2018 as part of the rust_2018_idioms
lint group, but strong feedback about the elided_lifetimes_in_paths
lint showed that it was too blunt of a hammer as it warns about lifetimes which don't matter to understand the function:
use std::fmt;
struct Greeting;
impl fmt::Display for Greeting {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// -----^^^^^^^^^ expected lifetime parameter
// Knowing that `Formatter` has a lifetime does not help the programmer
"howdy".fmt(f)
}
}
We then realized that the confusion we want to eliminate occurs when both
- lifetime elision inference rules connect an input lifetime to an output lifetime
- it's not syntactically obvious that a lifetime exists
There are two pieces of Rust syntax that indicate that a lifetime exists: &
and '
, with '
being subdivided into the inferred lifetime '_
and named lifetimes 'a
. When a type uses a named lifetime, lifetime elision will not infer a lifetime for that type. Using these criteria, we can construct three groups:
Self-evident it has a lifetime | Allow lifetime elision to infer a lifetime | Examples |
---|---|---|
No | Yes | ContainsLifetime |
Yes | Yes | &T , &'_ T , ContainsLifetime<'_> |
Yes | No | &'a T , ContainsLifetime<'a> |
The mismatched_lifetime_syntaxes
lint checks that the inputs and outputs of a function belong to the same group. For the initial motivating example above, &[u8]
falls into the second group while std::slice::Iter<u8>
falls into the first group. We say that the lifetimes in the first group are hidden.
Because the input and output lifetimes belong to different groups, the lint will warn about this function, reducing confusion about when a value has a meaningful lifetime that isn't visually obvious.
The mismatched_lifetime_syntaxes
lint supersedes the elided_named_lifetimes
lint, which did something similar for named lifetimes specifically.
Future work on the elided_lifetimes_in_paths
lint intends to split it into more focused sub-lints with an eye to warning about a subset of them eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great. Thanks for writing that up.
One thing that I would like us to get in there somewhere is that we consider the lifetime in ContainsLifetime
to be hidden. We don't need to get into whether that's a subtype of elided or a separate category or whatnot -- that's not important. But that when it's not self-evident (as you so well put it) that a type path has a lifetime, that the lifetime is "hidden" is nomenclature we adopted deliberately and should introduce in the narrative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we consider the lifetime in
ContainsLifetime
to be hidden
I took a stab at that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the compiler output above seems to have lost = note:
#[warn(mismatched_lifetime_syntaxes)] on by default
-- I think we should keep that, to make it very clear this is a lint that can be disabled if the user wants to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I took that out because it comes and goes (is it the first warning, is it set on the command line, etc.) I can add it back if you think it’s useful.
Something that may be of note is that 1.89 finally fixes the C abi for wasm32-unknown-unknown: rust-lang/rust#133952 |
Still need to write something up for this
cc @rust-lang/release
@rustbot ping relnotes-interest-group
Rendered