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

Use implicit (not explicit) rules for promotability by default in const fn #75502

Merged

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented Aug 13, 2020

For crater run. See rust-lang/const-eval#54 (comment).

cc #75586

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 13, 2020
@rust-lang rust-lang deleted a comment from rust-highfive Aug 13, 2020
@ecstatic-morse
Copy link
Contributor Author

@bors try

@bors
Copy link
Contributor

bors commented Aug 13, 2020

⌛ Trying commit 860d599d5b11db275a829a3f898560405fa84bbe with merge f6e2f78768c57172b99c3e85892f867894dc7e30...

@bors
Copy link
Contributor

bors commented Aug 13, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: f6e2f78768c57172b99c3e85892f867894dc7e30 (f6e2f78768c57172b99c3e85892f867894dc7e30)

@ecstatic-morse
Copy link
Contributor Author

@craterbot check

cc @RalfJung. Unfortunately the queue is long.

@craterbot
Copy link
Collaborator

👌 Experiment pr-75502 created and queued.
🤖 Automatically detected try build f6e2f78768c57172b99c3e85892f867894dc7e30
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 13, 2020
Some(hir::ConstContext::Static(_) | hir::ConstContext::Const)
);

if !self.explicit && !context_uses_explicit_promotion_rules {
Copy link
Member

Choose a reason for hiding this comment

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

self.explicit is already encoding whether we use explicit promotion, and that's what we check everywhere else in this file. Why does this one check need special treatment?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see, it's the self.const_kind.is_none() here that introduced the exception. IMO that should just be if !self.explicit... but that doesn't seem how we currently organize things.

Copy link
Member

Choose a reason for hiding this comment

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

However, this means that all const_kind.is_none() are wrong. Promotion should behave the same for const_kind == Some(ConstFn) and const_kind == None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of these checks are for things that are not allowed in a const context (without feature gates). Presumably this logic is left over from when promotion and const-checking happened in the same module.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that's a good point.

Still, it wouldn't hurt to adjust them all to call something like is_const_only or so (meaning "this code will only ever be executed during CTFE), just to make sure we haven't missed any of them.

@RalfJung
Copy link
Member

RalfJung commented Aug 14, 2020

Let's also cc @oli-obk.


I must still be missing something. This line sets implicit promotion rules for lifetime extension:

https://github.com/rust-lang/rust/blob/860d599d5b11db275a829a3f898560405fa84bbe/src/librustc_mir/transform/promote_consts.rs#L801

Where is the code that overwrites this to use explicit promotion rules for lifetime extension in const/static items and const fn bodies?

EDIT: Found the answer.

@RalfJung
Copy link
Member

RalfJung commented Aug 14, 2020

Give the length of the queue, I wonder if it's not worth to crater all the cases where const fn are treated differently from fn at once. Basically, no more const_kind.is_{some,none}. Those are the most critical points, I think.

Btw the PR title needs adjusting -- this is not about explicit vs implicit promotion (as witnessed by the code), it's about promotion depending on const_kind.

@craterbot
Copy link
Collaborator

🚧 Experiment pr-75502 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-75502 is completed!
📊 13 regressed and 8 fixed (117373 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Aug 31, 2020
@ecstatic-morse
Copy link
Contributor Author

ecstatic-morse commented Aug 31, 2020

There appears to be a single, legit root regression in the x86_64 crate when the const_fn feature is enabled.

https://github.com/rust-osdev/x86_64/blob/fe8d09c7edeaa399d6390da31de8aa7c4819731a/src/structures/paging/page_table.rs#L190-L194

This could be patched relatively easily, or we could revive the attempts to treat non-Copy array initializers as explicit promotion contexts.

It seems that we could change these semantics without too severe of an impact on the ecosystem. @RalfJung what's the next step here?

@RalfJung RalfJung added I-nominated T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Sep 1, 2020
@RalfJung
Copy link
Member

RalfJung commented Sep 1, 2020

There appears to be a single, legit root regression in the x86_64 crate when the const_fn feature is enabled.

That's great news!
I do not even see the use of promotion there? ENTRY_COUNT is a const.

EDIT: D'oh, it's for the initializer, not the length. Can you submit a PR to work around this?

It seems that we could change these semantics without too severe of an impact on the ecosystem. @RalfJung what's the next step here?

We nominate this for lang-team discussion and try to get the FCP process started.

Also please rebase and resolve the conflicts.

@RalfJung
Copy link
Member

RalfJung commented Sep 1, 2020

@rust-lang/lang the summary for the FCP is that this does most of what it takes to fix #75586. I view this as an instance of "we accidentally stabilized too much". For further information, see that issue; for the big picture, see rust-lang/const-eval#53.

@jyn514 jyn514 added the A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. label Sep 1, 2020
@ecstatic-morse ecstatic-morse changed the title Use implicit (not explicit) rules for promotability in const fn Use implicit (not explicit) rules for promotability by default in const fn Sep 1, 2020
ecstatic-morse added a commit to ecstatic-morse/x86_64 that referenced this pull request Sep 1, 2020
Hi! Rust compiler team member here. When the `const_fn` feature is enabled, the implementation of `PageTable::new` relies on a compiler bug to work. Specifically, `PageTableEntry::new` should not be eligible for promotion as part of an array initializer. See rust-lang/rust#75502 for more information. This bug may be fixed in the future, which will cause this crate to stop compiling.
@RalfJung
Copy link
Member

@ecstatic-morse you can find a rebased version of this patch at f7e1b1bd63fa21a465d73e000c74564eb68d1e0e. It just needs pushing to this branch then I can r+. :)

@RalfJung
Copy link
Member

Sorry, I meant 65ee8a787d33dd5a0f0695d81508acdd9e4c8f3c.

@ecstatic-morse
Copy link
Contributor Author

@bors r+

@bors
Copy link
Contributor

bors commented Sep 18, 2020

📌 Commit e03f416 has been approved by ecstatic-morse

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 18, 2020
@RalfJung
Copy link
Member

Let's reflect the reviewer.
@bors r- r=RalfJung

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 18, 2020
@bors
Copy link
Contributor

bors commented Sep 18, 2020

📌 Commit e03f416 has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 18, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 19, 2020
Rollup of 14 pull requests

Successful merges:

 - rust-lang#73963 (deny(unsafe_op_in_unsafe_fn) in libstd/path.rs)
 - rust-lang#75099 (lint/ty: move fns to avoid abstraction violation)
 - rust-lang#75502 (Use implicit (not explicit) rules for promotability by default in `const fn`)
 - rust-lang#75580 (Add test for checking duplicated branch or-patterns)
 - rust-lang#76310 (Add `[T; N]: TryFrom<Vec<T>>` (insta-stable))
 - rust-lang#76400 (Clean up vec benches bench_in_place style)
 - rust-lang#76434 (do not inline black_box when building for Miri)
 - rust-lang#76492 (Add associated constant `BITS` to all integer types)
 - rust-lang#76525 (Add as_str() to string::Drain.)
 - rust-lang#76636 (assert ScalarMaybeUninit size)
 - rust-lang#76749 (give *even better* suggestion when matching a const range)
 - rust-lang#76757 (don't convert types to the same type with try_into (clippy::useless_conversion))
 - rust-lang#76796 (Give a better error message when x.py uses the wrong stage for CI)
 - rust-lang#76798 (Build fixes for RISC-V 32-bit Linux support)

Failed merges:

r? `@ghost`
@bors bors merged commit f62ba52 into rust-lang:master Sep 19, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 19, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 19, 2020
…tatic-morse

Some promotion cleanup

Based on top of both rust-lang#75502 and rust-lang#75585, this does some cleanup of the promotion code. The last 2 commits are new.

* Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes rust-lang#75586.
* ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~
* Promote `&mut []` everywhere, not just in non-`const` functions, for consistency.
* Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~

This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from @rust-lang/wg-const-eval .
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 19, 2020
…tatic-morse

Some promotion cleanup

Based on top of both rust-lang#75502 and rust-lang#75585, this does some cleanup of the promotion code. The last 2 commits are new.

* Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes rust-lang#75586.
* ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~
* Promote `&mut []` everywhere, not just in non-`const` functions, for consistency.
* Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~

This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from @rust-lang/wg-const-eval .
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 19, 2020
…tatic-morse

Some promotion cleanup

Based on top of both rust-lang#75502 and rust-lang#75585, this does some cleanup of the promotion code. The last 2 commits are new.

* Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes rust-lang#75586.
* ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~
* Promote `&mut []` everywhere, not just in non-`const` functions, for consistency.
* Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~

This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from @rust-lang/wg-const-eval .
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 20, 2020
…tatic-morse

Some promotion cleanup

Based on top of both rust-lang#75502 and rust-lang#75585, this does some cleanup of the promotion code. The last 2 commits are new.

* Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes rust-lang#75586.
* ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~
* Promote `&mut []` everywhere, not just in non-`const` functions, for consistency.
* Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~

This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from @rust-lang/wg-const-eval .
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 20, 2020
…tic-morse

Some promotion cleanup

Based on top of both rust-lang#75502 and rust-lang#75585, this does some cleanup of the promotion code. The last 2 commits are new.

* Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes rust-lang#75586.
* ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~
* Promote `&mut []` everywhere, not just in non-`const` functions, for consistency.
* Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~

This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from `@rust-lang/wg-const-eval` .
@lcnr lcnr added the relnotes Marks issues that should be documented in the release notes of the next release. label Oct 5, 2020
@lcnr
Copy link
Contributor

lcnr commented Oct 5, 2020

This is an expected breaking change so it probably makes sense to quickly mention this in the release notes

@ecstatic-morse ecstatic-morse deleted the implicit-promotion-in-const-fn branch October 6, 2020 01:42
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Nov 24, 2020
Clean up some of the pkgsrc Makefile, there's still lots in here that
should just be deleted though.  Switch SunOS to the illumos bootstrap
by default.

Version 1.48.0 (2020-11-19)
==========================

Language
--------

- [The `unsafe` keyword is now syntactically permitted on modules.][75857] This
  is still rejected *semantically*, but can now be parsed by procedural macros.

Compiler
--------
- [Stabilised the `-C link-self-contained=<yes|no>` compiler flag.][76158] This tells
  `rustc` whether to link its own C runtime and libraries or to rely on a external
  linker to find them. (Supported only on `windows-gnu`, `linux-musl`, and `wasi` platforms.)
- [You can now use `-C target-feature=+crt-static` on `linux-gnu` targets.][77386]
  Note: If you're using cargo you must explicitly pass the `--target` flag.
- [Added tier 2\* support for `aarch64-unknown-linux-musl`.][76420]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`io::Write` is now implemented for `&ChildStdin` `&Sink`, `&Stdout`,
  and `&Stderr`.][76275]
- [All arrays of any length now implement `TryFrom<Vec<T>>`.][76310]
- [The `matches!` macro now supports having a trailing comma.][74880]
- [`Vec<A>` now implements `PartialEq<[B]>` where `A: PartialEq<B>`.][74194]
- [The `RefCell::{replace, replace_with, clone}` methods now all use `#[track_caller]`.][77055]

Stabilized APIs
---------------
- [`slice::as_ptr_range`]
- [`slice::as_mut_ptr_range`]
- [`VecDeque::make_contiguous`]
- [`future::pending`]
- [`future::ready`]

The following previously stable methods are now `const fn`'s:

- [`Option::is_some`]
- [`Option::is_none`]
- [`Option::as_ref`]
- [`Result::is_ok`]
- [`Result::is_err`]
- [`Result::as_ref`]
- [`Ordering::reverse`]
- [`Ordering::then`]

Cargo
-----

Rustdoc
-------
- [You can now link to items in `rustdoc` using the intra-doc link
  syntax.][74430] E.g. ``/// Uses [`std::future`]`` will automatically generate
  a link to `std::future`'s documentation. See ["Linking to items by
  name"][intradoc-links] for more information.
- [You can now specify `#[doc(alias = "<alias>")]` on items to add search aliases
  when searching through `rustdoc`'s UI.][75740]

Compatibility Notes
-------------------
- [Promotion of references to `'static` lifetime inside `const fn` now follows the
  same rules as inside a `fn` body.][75502] In particular, `&foo()` will not be
  promoted to `'static` lifetime any more inside `const fn`s.
- [Associated type bindings on trait objects are now verified to meet the bounds
  declared on the trait when checking that they implement the trait.][27675]
- [When trait bounds on associated types or opaque types are ambiguous, the
  compiler no longer makes an arbitrary choice on which bound to use.][54121]
- [Fixed recursive nonterminals not being expanded in macros during
  pretty-print/reparse check.][77153] This may cause errors if your macro wasn't
  correctly handling recursive nonterminal tokens.
- [`&mut` references to non zero-sized types are no longer promoted.][75585]
- [`rustc` will now warn if you use attributes like `#[link_name]` or `#[cold]`
  in places where they have no effect.][73461]
- [Updated `_mm256_extract_epi8` and `_mm256_extract_epi16` signatures in
  `arch::{x86, x86_64}` to return `i32` to match the vendor signatures.][73166]
- [`mem::uninitialized` will now panic if any inner types inside a struct or enum
  disallow zero-initialization.][71274]
- [`#[target_feature]` will now error if used in a place where it has no effect.][78143]
- [Foreign exceptions are now caught by `catch_unwind` and will cause an abort.][70212]
  Note: This behaviour is not guaranteed and is still considered undefined behaviour,
  see the [`catch_unwind`] documentation for further information.

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.
- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
  You can continue building with `make` by setting `ninja=false` in
  your `config.toml`.
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
- [Made `ensure_sufficient_stack()` non-generic][76680]

[78143]: rust-lang/rust#78143
[76680]: rust-lang/rust#76680
[76030]: rust-lang/rust#76030
[70212]: rust-lang/rust#70212
[27675]: rust-lang/rust#27675
[54121]: rust-lang/rust#54121
[71274]: rust-lang/rust#71274
[77386]: rust-lang/rust#77386
[77153]: rust-lang/rust#77153
[77055]: rust-lang/rust#77055
[76275]: rust-lang/rust#76275
[76310]: rust-lang/rust#76310
[76420]: rust-lang/rust#76420
[76158]: rust-lang/rust#76158
[75857]: rust-lang/rust#75857
[75585]: rust-lang/rust#75585
[75740]: rust-lang/rust#75740
[75502]: rust-lang/rust#75502
[74880]: rust-lang/rust#74880
[74922]: rust-lang/rust#74922
[74430]: rust-lang/rust#74430
[74194]: rust-lang/rust#74194
[73461]: rust-lang/rust#73461
[73166]: rust-lang/rust#73166
[intradoc-links]: https://doc.rust-lang.org/rustdoc/linking-to-items-by-name.html
[`catch_unwind`]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
[`Option::is_some`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some
[`Option::is_none`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_none
[`Option::as_ref`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.as_ref
[`Result::is_ok`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_ok
[`Result::is_err`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_err
[`Result::as_ref`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.as_ref
[`Ordering::reverse`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.reverse
[`Ordering::then`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.then
[`slice::as_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr_range
[`slice::as_mut_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr_range
[`VecDeque::make_contiguous`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.make_contiguous
[`future::pending`]: https://doc.rust-lang.org/std/future/fn.pending.html
[`future::ready`]: https://doc.rust-lang.org/std/future/fn.ready.html
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 1, 2021
Pkgsrc changes:
 * Compensate for files being moved around upstream.
 * Introduce optional, on-by-default semi-static building of cargo,
   using the internal curl and openssl sources.  This reduces the dynamic
   dependencies of cargo and therefore the rust package itself.
   Ref. options.mk.
 * The 1.47.0 bootstrap kits have been re-built with the above option
   turned on, so no longer depends on curl or openssl from pkgsrc and/or
   from earlier OS or pkgsrc versions.  This should hopefully fix
   installation of rust with non-default PREFIX, ref. PR#54453.


Upstream changes:

Version 1.48.0 (2020-11-19)
==========================

Language
--------
- [The `unsafe` keyword is now syntactically permitted on modules.][75857] This
  is still rejected *semantically*, but can now be parsed by procedural macros.

Compiler
--------
- [Stabilised the `-C link-self-contained=<yes|no>` compiler flag.][76158]
  This tells `rustc` whether to link its own C runtime and libraries
  or to rely on a external linker to find them. (Supported only on
  `windows-gnu`, `linux-musl`, and `wasi` platforms.)
- [You can now use `-C target-feature=+crt-static` on `linux-gnu` targets.]
  [77386]
  Note: If you're using cargo you must explicitly pass the `--target` flag.
- [Added tier 2\* support for `aarch64-unknown-linux-musl`.][76420]

\* Refer to Rust's [platform support page][forge-platform-support] for more
information on Rust's tiered platform support.

Libraries
---------
- [`io::Write` is now implemented for `&ChildStdin` `&Sink`, `&Stdout`,
  and `&Stderr`.][76275]
- [All arrays of any length now implement `TryFrom<Vec<T>>`.][76310]
- [The `matches!` macro now supports having a trailing comma.][74880]
- [`Vec<A>` now implements `PartialEq<[B]>` where `A: PartialEq<B>`.][74194]
- [The `RefCell::{replace, replace_with, clone}` methods now all use
  `#[track_caller]`.][77055]

Stabilized APIs
---------------
- [`slice::as_ptr_range`]
- [`slice::as_mut_ptr_range`]
- [`VecDeque::make_contiguous`]
- [`future::pending`]
- [`future::ready`]

The following previously stable methods are now `const fn`'s:

- [`Option::is_some`]
- [`Option::is_none`]
- [`Option::as_ref`]
- [`Result::is_ok`]
- [`Result::is_err`]
- [`Result::as_ref`]
- [`Ordering::reverse`]
- [`Ordering::then`]

Cargo
-----

Rustdoc
-------
- [You can now link to items in `rustdoc` using the intra-doc link
  syntax.][74430] E.g. ``/// Uses [`std::future`]`` will automatically generate
  a link to `std::future`'s documentation. See ["Linking to items by
  name"][intradoc-links] for more information.
- [You can now specify `#[doc(alias = "<alias>")]` on items to add
  search aliases when searching through `rustdoc`'s UI.][75740]

Compatibility Notes
-------------------
- [Promotion of references to `'static` lifetime inside `const fn`
  now follows the same rules as inside a `fn` body.][75502] In
  particular, `&foo()` will not be promoted to `'static` lifetime
  any more inside `const fn`s.
- [Associated type bindings on trait objects are now verified to meet the bounds
  declared on the trait when checking that they implement the trait.][27675]
- [When trait bounds on associated types or opaque types are ambiguous, the
  compiler no longer makes an arbitrary choice on which bound to use.][54121]
- [Fixed recursive nonterminals not being expanded in macros during
  pretty-print/reparse check.][77153] This may cause errors if your macro wasn't
  correctly handling recursive nonterminal tokens.
- [`&mut` references to non zero-sized types are no longer promoted.][75585]
- [`rustc` will now warn if you use attributes like `#[link_name]` or `#[cold]`
  in places where they have no effect.][73461]
- [Updated `_mm256_extract_epi8` and `_mm256_extract_epi16` signatures in
  `arch::{x86, x86_64}` to return `i32` to match the vendor signatures.][73166]
- [`mem::uninitialized` will now panic if any inner types inside
  a struct or enum disallow zero-initialization.][71274]
- [`#[target_feature]` will now error if used in a place where it
  has no effect.][78143]
- [Foreign exceptions are now caught by `catch_unwind` and will
  cause an abort.][70212] Note: This behaviour is not guaranteed
  and is still considered undefined behaviour, see the [`catch_unwind`]
  documentation for further information.

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.

- [Building `rustc` from source now uses `ninja` by default over `make`.][74922]
  You can continue building with `make` by setting `ninja=false` in
  your `config.toml`.
- [cg_llvm: `fewer_names` in `uncached_llvm_type`][76030]
- [Made `ensure_sufficient_stack()` non-generic][76680]

[78143]: rust-lang/rust#78143
[76680]: rust-lang/rust#76680
[76030]: rust-lang/rust#76030
[70212]: rust-lang/rust#70212
[27675]: rust-lang/rust#27675
[54121]: rust-lang/rust#54121
[71274]: rust-lang/rust#71274
[77386]: rust-lang/rust#77386
[77153]: rust-lang/rust#77153
[77055]: rust-lang/rust#77055
[76275]: rust-lang/rust#76275
[76310]: rust-lang/rust#76310
[76420]: rust-lang/rust#76420
[76158]: rust-lang/rust#76158
[75857]: rust-lang/rust#75857
[75585]: rust-lang/rust#75585
[75740]: rust-lang/rust#75740
[75502]: rust-lang/rust#75502
[74880]: rust-lang/rust#74880
[74922]: rust-lang/rust#74922
[74430]: rust-lang/rust#74430
[74194]: rust-lang/rust#74194
[73461]: rust-lang/rust#73461
[73166]: rust-lang/rust#73166
[intradoc-links]: https://doc.rust-lang.org/rustdoc/linking-to-items-by-name.html
[`catch_unwind`]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
[`Option::is_some`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some
[`Option::is_none`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.is_none
[`Option::as_ref`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.as_ref
[`Result::is_ok`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_ok
[`Result::is_err`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.is_err
[`Result::as_ref`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.as_ref
[`Ordering::reverse`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.reverse
[`Ordering::then`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.then
[`slice::as_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr_range
[`slice::as_mut_ptr_range`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_mut_ptr_range
[`VecDeque::make_contiguous`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.make_contiguous
[`future::pending`]: https://doc.rust-lang.org/std/future/fn.pending.html
[`future::ready`]: https://doc.rust-lang.org/std/future/fn.ready.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet