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

Stabilise feature(const_generics_defaults) #90207

Merged
merged 5 commits into from
Dec 12, 2021

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Oct 23, 2021

feature(const_generics_defaults) is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation.

needs stabilisation report and maybe an RFC 😅

r? @lcnr
cc @rust-lang/project-const-generics

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 23, 2021
@rust-log-analyzer

This comment has been minimized.

@crlf0710 crlf0710 added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Oct 24, 2021
@bors
Copy link
Contributor

bors commented Nov 3, 2021

☔ The latest upstream changes (presumably #90516) made this pull request unmergeable. Please resolve the merge conflicts.

@BoxyUwU
Copy link
Member Author

BoxyUwU commented Nov 3, 2021

Stabilization report

This is the stabilization report for const parameter defaults and the removal of the type and const parameter ordering restriction. Its feature is #![feature(const_generics_defaults)].

This report is a collaborative effort of @BoxyUwU and @lcnr.

Summary

While supplying default arguments for type parameters is already possible on stable, this is not allowed for const parameters. Due to the restriction that type parameters must be in front of all const parameters, type parameter defaults cannot be used on stable if a const parameter exists.

This stabilization allows type and const parameters to be in an arbitrary order and adds the ability to specify default values for const parameters in all places where this is already allowed for type parameters. These defaults have the same restriction as other const arguments, so they must either be a fully concrete expression or another const parameter.

Motivation

Const parameter defaults

  • Reduces the difference between const generics and type generics by allowing both to have defaults
  • Allows libraries to backwards compatibly add const generics to traits and types
  • Makes working with const generics more ergonomic when there is a reasonable default for the generic parameter

Removal of the ordering restriction

  • Type and const parameters are similar enough and there are cases where a specific order of generic parameters is prefered for clarity.
  • It is not possible to have generics with both a type default (T = 32) and a const generic (const N: u8) without removing the ordering restriction

Examples

struct ArrayStorage<T, const N: usize = 2> {
    arr: [T; N],
}

impl<T> ArrayStorage<T> {
    fn new(a: T, b: T) -> ArrayStorage<T> {
        ArrayStorage {
            arr: [a, b],
        }
    }
}


struct Image<
    const WIDTH: usize,
    const HEIGHT: usize,
    // Without loosening the ordering restriction,
    // we could not add a default for this type parameter.
    FORMAT: ImageFormat = PngFormat, 
> {
    // ...
}

// This order is a lot clearer than
//
//    T, U, V, F, const N: usize, const M: usize
fn cartesian_product<
    T, const N: usize,
    U, const M: usize,
    V, F
>(a: [T; N], b: [U; M]) -> [[V; N]; M]
where
    F: FnMut(&T, &U) -> V
{
    // ...    
}

Detailed feature description

Ordering

The ordering restriction between types and consts is removed. The ordering of generic params is now: lifetimes, then type and const parameters.

We previously restricted the ordering due to implementation concerns, which have since been fixed.

Example

struct Foo<
    T, 
    const N: usize, 
    U, 
    const M: usize = 3
    V = [i64; M],
>(T, U, V);

fn foo<const N: usize, T, const M: usize>() { }

Default const parameters

It is currently possible to provide a default type to type parameters in type and trait definition. With this stabilization it becomes possible to provide default values for const parameters as well.

The used syntax is const PARAM_NAME: Ty = expr where expr is either a single segment path, a literal, or surrounded by braces, e.g. { foo() }. This restriction is identical to the restriction of const parameters and simplifies parsing.

Const defaults, for now, are not permitted to involve computations depending on generic parameters. This means that defaults may only be:

  1. const expressions that do not depend on any generic parameters, e.g. { foo() + 1 }, where foo is a const fn.
  2. standalone const parameters, e.g. N. Note that both type and const parameter defaults may only refer to preceeding parameters, meaning that struct Foo<const N: usize = M, const M: usize = 3> causes an error.

When using an expression which does not evaluate successfully, e.g. usize::MAX + 1, as a const parameter default, we eagerly emit an error. This also mirrors the behavior of type parameter defaults.

The decision whether const parameter defaults are used or the parameter has to be inferred is directly taken from the existing behavior of type parameter defaults.

Example

struct Foo<const N: usize = 10>;
struct Bar<const N: usize = { usize::MAX - 1 }, const M: usize = N>;

fn foo() -> (Foo, Bar<10>) {
    (Foo::<10>, Bar)
}

struct Baz<const N: usize, const M: usize = { N + 1 }>;
//^ error: generic parameters may not be used in const operations

trait Trait<const N: usize> { const ASSOC: usize; }
pub struct UwU<const N: usize = { <()>::ASSOC }> where (): Trait<N>;
//^ error: no associated item named `ASSOC` found for unit type `()` in the current scope

Documentation

The Book: Does not contain any documentation about const generics
The Reference: rust-lang/reference#1098

Important Tests

Future Incompatibilty concerns

trait Trait<T> {
    const ASSOC: usize;
}

impl Trait<()> for usize {
    const ASSOC: usize = 2;
}

struct Foo<T, U, const N: usize = { usize::ASSOC }>(T, U)
where
    usize: Trait<T> + Trait<U>;

usize::ASSOC is resolved today, but will be ambiguous if we start providing where clauses to type level constants. This is not a new issue however, as the following code has the same issue and currently compiles on stable:

fn foo<T, U>() -> [(); { usize::ASSOC }] 
where
    usize: Trait<T> + Trait<U> {
  ...
}

struct Foo<T, U>(T, U, [(); { usize::ASSOC }])
where
    usize: Trait<T> + Trait<U>;

We therefore believe that this issue should not block the stabilization of const parameter defaults.

@lcnr lcnr added the I-lang-nominated Nominated for discussion during a lang team meeting. label Nov 3, 2021
@nikomatsakis

This comment has been minimized.

@nikomatsakis nikomatsakis removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Nov 16, 2021
@nikomatsakis

This comment has been minimized.

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Nov 26, 2021

@rfcbot fcp merge

I am kicking off an FCP for stabilization report here

@rfcbot
Copy link

rfcbot commented Nov 26, 2021

Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Nov 26, 2021
@scottmcm
Copy link
Member

Thanks for the report!

It looks to me (https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=68f0f12f1dde47e0100411fe551c0288) like the inference rules for this match the ones for types, which was my biggest question here.

Const defaults, for now, are not permitted to involve computations depending on generic parameters.

Is there a separate gate for this? Or a test that it's not inadvertently stabilized?

@lcnr
Copy link
Contributor

lcnr commented Nov 26, 2021

Is there a separate gate for this? Or a test that it's not inadvertently stabilized?

the gate for this is generic_const_exprs and we do have a test for this:

// revisions: full min
//[full] check-pass
#![cfg_attr(full, feature(generic_const_exprs))]
#![feature(const_generics_defaults)]
#![allow(incomplete_features)]
struct Foo<const N: usize, const M: usize = { N + 1 }>;
//[min]~^ ERROR generic parameters may not be used in const operations
struct Bar<T, const TYPE_SIZE: usize = { std::mem::size_of::<T>() }>(T);
//[min]~^ ERROR generic parameters may not be used in const operations
fn main() {}

the inference rules for this match the ones for types

yes, whether const parameter defaults are used is decided in the same way as for type parameters. Added a sentence to the report itself for this.

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Nov 30, 2021
@rfcbot
Copy link

rfcbot commented Nov 30, 2021

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Dec 10, 2021
@rfcbot
Copy link

rfcbot commented Dec 10, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

some stuff for future prs.

Comment on lines 333 to 338
Lifetime,
Type,
// `unordered` is only `true` if `sess.unordered_const_ty_params()`
// returns true. Specifically, if it's only `min_const_generics`, it will still require
// ordering consts after types.
Const { unordered: bool },
Const,
// `Infer` is not actually constructed directly from the AST, but is implicitly constructed
// during HIR lowering, and `ParamKindOrd` will implicitly order inferred variables last.
Infer,
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 be able to change this to

pub enum ParamKindOrd {
    Lifetime,
    TypeOrConst,
}

should make stuff a bit cleaner.


// This test checks that generic parameter re-ordering diagnostic suggestions mention that
// consts come after types and lifetimes when the `const_generics_defaults` feature is enabled.
// consts come after types and lifetimes.
// We cannot run rustfix on this test because of the above const generics warning.
Copy link
Contributor

Choose a reason for hiding this comment

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

That comment seems outdated and we should enable rustfix for this test

@lcnr
Copy link
Contributor

lcnr commented Dec 11, 2021

A huge thanks to @JulianKnodt and @lqd for doing most of the early implementation work of this feature and to @varkor for reviewing their work!

Its kind of funny to me that back when I started to work on const generics, having const params in front of type parameters was breaking the compiler. As I believed that we actually want to keep that strict ordering, I simply sorted the generic params before they caused any problems in #70032. Only a few months later I understood what was going wrong there and was able to fix that in #74676.


this change might very slightly improve perf.

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Dec 12, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 12, 2021
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 12, 2021
@lcnr
Copy link
Contributor

lcnr commented Dec 12, 2021

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Dec 12, 2021

📌 Commit 1e896df has been approved by lcnr

@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 Dec 12, 2021
@bors
Copy link
Contributor

bors commented Dec 12, 2021

⌛ Testing commit 1e896df with merge 753e569...

@bors
Copy link
Contributor

bors commented Dec 12, 2021

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 753e569 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 12, 2021
@bors bors merged commit 753e569 into rust-lang:master Dec 12, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 12, 2021
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (753e569): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Dec 16, 2021
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Mar 2, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.58.1.
 * Adjust one patch (and checksum) so that it still applies.

Upstream changes:

Version 1.59.0 (2022-02-24)
==========================

Language
--------

- [Stabilize default arguments for const generics][90207]
- [Stabilize destructuring assignment][90521]
- [Relax private in public lint on generic bounds and where clauses
  of trait impls][90586]
- [Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64,
  and RISC-V][91728]

Compiler
--------

- [Stabilize new symbol mangling format, leaving it opt-in
  (-Csymbol-mangling-version=v0)][90128]
- [Emit LLVM optimization remarks when enabled with `-Cremark`][90833]
- [Fix sparc64 ABI for aggregates with floating point members][91003]
- [Warn when a `#[test]`-like built-in attribute macro is present
  multiple times.][91172]
- [Add support for riscv64gc-unknown-freebsd][91284]
- [Stabilize `-Z emit-future-incompat` as `--json future-incompat`][91535]
- [Soft disable incremental compilation][94124]

This release disables incremental compilation, unless the user has explicitly
opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
This is due to a known and relatively frequently occurring bug in incremental
compilation, which causes builds to issue internal compiler errors. This
particular bug is already fixed on nightly, but that fix has not yet rolled out
to stable and is deemed too risky for a direct stable backport.

As always, we encourage users to test with nightly and report bugs so that we
can track failures and fix issues earlier.

See [94124] for more details.

[94124]: rust-lang/rust#94124

Libraries
---------

- [Remove unnecessary bounds for some Hash{Map,Set} methods][91593]

Stabilized APIs
---------------

- [`std::thread::available_parallelism`][available_parallelism]
- [`Result::copied`][result-copied]
- [`Result::cloned`][result-cloned]
- [`arch::asm!`][asm]
- [`arch::global_asm!`][global_asm]
- [`ops::ControlFlow::is_break`][is_break]
- [`ops::ControlFlow::is_continue`][is_continue]
- [`TryFrom<char> for u8`][try_from_char_u8]
- [`char::TryFromCharError`][try_from_char_err]
  implementing `Clone`, `Debug`, `Display`, `PartialEq`, `Copy`, `Eq`, `Error`
- [`iter::zip`][zip]
- [`NonZeroU8::is_power_of_two`][is_power_of_two8]
- [`NonZeroU16::is_power_of_two`][is_power_of_two16]
- [`NonZeroU32::is_power_of_two`][is_power_of_two32]
- [`NonZeroU64::is_power_of_two`][is_power_of_two64]
- [`NonZeroU128::is_power_of_two`][is_power_of_two128]
- [`DoubleEndedIterator for ToLowercase`][lowercase]
- [`DoubleEndedIterator for ToUppercase`][uppercase]
- [`TryFrom<&mut [T]> for [T; N]`][tryfrom_ref_arr]
- [`UnwindSafe for Once`][unwindsafe_once]
- [`RefUnwindSafe for Once`][refunwindsafe_once]
- [armv8 neon intrinsics for aarch64][stdarch/1266]

Const-stable:

- [`mem::MaybeUninit::as_ptr`][muninit_ptr]
- [`mem::MaybeUninit::assume_init`][muninit_init]
- [`mem::MaybeUninit::assume_init_ref`][muninit_init_ref]
- [`ffi::CStr::from_bytes_with_nul_unchecked`][cstr_from_bytes]

Cargo
-----

- [Stabilize the `strip` profile option][cargo/10088]
- [Stabilize future-incompat-report][cargo/10165]
- [Support abbreviating `--release` as `-r`][cargo/10133]
- [Support `term.quiet` configuration][cargo/10152]
- [Remove `--host` from cargo {publish,search,login}][cargo/10145]

Compatibility Notes
-------------------

- [Refactor weak symbols in std::sys::unix][90846]
  This may add new, versioned, symbols when building with a newer glibc, as the
  standard library uses weak linkage rather than dynamically attempting to load
  certain symbols at runtime.
- [Deprecate crate_type and crate_name nested inside `#![cfg_attr]`][83744]
  This adds a future compatibility lint to supporting the use of cfg_attr
  wrapping either crate_type or crate_name specification within Rust files;
  it is recommended that users migrate to setting the equivalent command line
  flags.
- [Remove effect of `#[no_link]` attribute on name resolution][92034]
  This may expose new names, leading to conflicts with preexisting names in a
  given namespace and a compilation failure.
- [Cargo will document libraries before binaries.][cargo/10172]
- [Respect doc=false in dependencies, not just the root crate][cargo/10201]
- [Weaken guarantee around advancing underlying iterators in zip][83791]
- [Make split_inclusive() on an empty slice yield an empty output][89825]
- [Update std::env::temp_dir to use GetTempPath2 on Windows when
  available.][89999]
- [unreachable! was updated to match other formatting macro behavior
  on Rust 2021][92137]

Internal Changes
----------------

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

- [Fix many cases of normalization-related ICEs][91255]
- [Replace dominators algorithm with simple Lengauer-Tarjan][85013]
- [Store liveness in interval sets for region inference][90637]

- [Remove `in_band_lifetimes` from the compiler and standard library,
  in preparation for removing this unstable feature.][91867]

[91867]: rust-lang/rust#91867
[83744]: rust-lang/rust#83744
[83791]: rust-lang/rust#83791
[85013]: rust-lang/rust#85013
[89825]: rust-lang/rust#89825
[89999]: rust-lang/rust#89999
[90128]: rust-lang/rust#90128
[90207]: rust-lang/rust#90207
[90521]: rust-lang/rust#90521
[90586]: rust-lang/rust#90586
[90637]: rust-lang/rust#90637
[90833]: rust-lang/rust#90833
[90846]: rust-lang/rust#90846
[91003]: rust-lang/rust#91003
[91172]: rust-lang/rust#91172
[91255]: rust-lang/rust#91255
[91284]: rust-lang/rust#91284
[91535]: rust-lang/rust#91535
[91593]: rust-lang/rust#91593
[91728]: rust-lang/rust#91728
[91878]: rust-lang/rust#91878
[91896]: rust-lang/rust#91896
[91926]: rust-lang/rust#91926
[91984]: rust-lang/rust#91984
[92020]: rust-lang/rust#92020
[92034]: rust-lang/rust#92034
[92483]: rust-lang/rust#92483
[cargo/10088]: rust-lang/cargo#10088
[cargo/10133]: rust-lang/cargo#10133
[cargo/10145]: rust-lang/cargo#10145
[cargo/10152]: rust-lang/cargo#10152
[cargo/10165]: rust-lang/cargo#10165
[cargo/10172]: rust-lang/cargo#10172
[cargo/10201]: rust-lang/cargo#10201
[cargo/10269]: rust-lang/cargo#10269

[cstr_from_bytes]: https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.from_bytes_with_nul_unchecked
[muninit_ptr]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_ptr
[muninit_init]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init
[muninit_init_ref]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
[unwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-UnwindSafe
[refunwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-RefUnwindSafe
[tryfrom_ref_arr]: https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3C%26%27_%20mut%20%5BT%5D%3E
[lowercase]: https://doc.rust-lang.org/stable/std/char/struct.ToLowercase.html#impl-DoubleEndedIterator
[uppercase]: https://doc.rust-lang.org/stable/std/char/struct.ToUppercase.html#impl-DoubleEndedIterator
[try_from_char_err]: https://doc.rust-lang.org/stable/std/char/struct.TryFromCharError.html
[available_parallelism]: https://doc.rust-lang.org/stable/std/thread/fn.available_parallelism.html
[result-copied]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.copied
[result-cloned]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.cloned
[asm]: https://doc.rust-lang.org/stable/core/arch/macro.asm.html
[global_asm]: https://doc.rust-lang.org/stable/core/arch/macro.global_asm.html
[is_break]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_break
[is_continue]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_continue
[try_from_char_u8]: https://doc.rust-lang.org/stable/std/primitive.char.html#impl-TryFrom%3Cchar%3E
[zip]: https://doc.rust-lang.org/stable/std/iter/fn.zip.html
[is_power_of_two8]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU8.html#method.is_power_of_two
[is_power_of_two16]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU16.html#method.is_power_of_two
[is_power_of_two32]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU32.html#method.is_power_of_two
[is_power_of_two64]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU64.html#method.is_power_of_two
[is_power_of_two128]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU128.html#method.is_power_of_two
[stdarch/1266]: rust-lang/stdarch#1266
bors bot added a commit to rust-lang/rust-analyzer that referenced this pull request Mar 4, 2022
11140: Preserve order of generic args r=HKalbasi a=HKalbasi

rust-lang/rust#90207 removed order restriction of generic args, i.e. const generics can now become before of type generics. We need to preserve this order to analyze correctly, and this PR does that.

It also simplifies implementation of const generics a bit IMO.

Implementing default generics the same problem of #7434, we need lower them to body and then evaluate them.


Co-authored-by: hkalbasi <[email protected]>
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Apr 15, 2022
Pkgsrc changes:
 * Bump available bootstraps to 1.58.1.
 * Adjust one patch (and checksum) so that it still applies.

Upstream changes:

Version 1.59.0 (2022-02-24)
==========================

Language
--------

- [Stabilize default arguments for const generics][90207]
- [Stabilize destructuring assignment][90521]
- [Relax private in public lint on generic bounds and where clauses
  of trait impls][90586]
- [Stabilize asm! and global_asm! for x86, x86_64, ARM, Aarch64,
  and RISC-V][91728]

Compiler
--------

- [Stabilize new symbol mangling format, leaving it opt-in
  (-Csymbol-mangling-version=v0)][90128]
- [Emit LLVM optimization remarks when enabled with `-Cremark`][90833]
- [Fix sparc64 ABI for aggregates with floating point members][91003]
- [Warn when a `#[test]`-like built-in attribute macro is present
  multiple times.][91172]
- [Add support for riscv64gc-unknown-freebsd][91284]
- [Stabilize `-Z emit-future-incompat` as `--json future-incompat`][91535]
- [Soft disable incremental compilation][94124]

This release disables incremental compilation, unless the user has explicitly
opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
This is due to a known and relatively frequently occurring bug in incremental
compilation, which causes builds to issue internal compiler errors. This
particular bug is already fixed on nightly, but that fix has not yet rolled out
to stable and is deemed too risky for a direct stable backport.

As always, we encourage users to test with nightly and report bugs so that we
can track failures and fix issues earlier.

See [94124] for more details.

[94124]: rust-lang/rust#94124

Libraries
---------

- [Remove unnecessary bounds for some Hash{Map,Set} methods][91593]

Stabilized APIs
---------------

- [`std::thread::available_parallelism`][available_parallelism]
- [`Result::copied`][result-copied]
- [`Result::cloned`][result-cloned]
- [`arch::asm!`][asm]
- [`arch::global_asm!`][global_asm]
- [`ops::ControlFlow::is_break`][is_break]
- [`ops::ControlFlow::is_continue`][is_continue]
- [`TryFrom<char> for u8`][try_from_char_u8]
- [`char::TryFromCharError`][try_from_char_err]
  implementing `Clone`, `Debug`, `Display`, `PartialEq`, `Copy`, `Eq`, `Error`
- [`iter::zip`][zip]
- [`NonZeroU8::is_power_of_two`][is_power_of_two8]
- [`NonZeroU16::is_power_of_two`][is_power_of_two16]
- [`NonZeroU32::is_power_of_two`][is_power_of_two32]
- [`NonZeroU64::is_power_of_two`][is_power_of_two64]
- [`NonZeroU128::is_power_of_two`][is_power_of_two128]
- [`DoubleEndedIterator for ToLowercase`][lowercase]
- [`DoubleEndedIterator for ToUppercase`][uppercase]
- [`TryFrom<&mut [T]> for [T; N]`][tryfrom_ref_arr]
- [`UnwindSafe for Once`][unwindsafe_once]
- [`RefUnwindSafe for Once`][refunwindsafe_once]
- [armv8 neon intrinsics for aarch64][stdarch/1266]

Const-stable:

- [`mem::MaybeUninit::as_ptr`][muninit_ptr]
- [`mem::MaybeUninit::assume_init`][muninit_init]
- [`mem::MaybeUninit::assume_init_ref`][muninit_init_ref]
- [`ffi::CStr::from_bytes_with_nul_unchecked`][cstr_from_bytes]

Cargo
-----

- [Stabilize the `strip` profile option][cargo/10088]
- [Stabilize future-incompat-report][cargo/10165]
- [Support abbreviating `--release` as `-r`][cargo/10133]
- [Support `term.quiet` configuration][cargo/10152]
- [Remove `--host` from cargo {publish,search,login}][cargo/10145]

Compatibility Notes
-------------------

- [Refactor weak symbols in std::sys::unix][90846]
  This may add new, versioned, symbols when building with a newer glibc, as the
  standard library uses weak linkage rather than dynamically attempting to load
  certain symbols at runtime.
- [Deprecate crate_type and crate_name nested inside `#![cfg_attr]`][83744]
  This adds a future compatibility lint to supporting the use of cfg_attr
  wrapping either crate_type or crate_name specification within Rust files;
  it is recommended that users migrate to setting the equivalent command line
  flags.
- [Remove effect of `#[no_link]` attribute on name resolution][92034]
  This may expose new names, leading to conflicts with preexisting names in a
  given namespace and a compilation failure.
- [Cargo will document libraries before binaries.][cargo/10172]
- [Respect doc=false in dependencies, not just the root crate][cargo/10201]
- [Weaken guarantee around advancing underlying iterators in zip][83791]
- [Make split_inclusive() on an empty slice yield an empty output][89825]
- [Update std::env::temp_dir to use GetTempPath2 on Windows when
  available.][89999]
- [unreachable! was updated to match other formatting macro behavior
  on Rust 2021][92137]

Internal Changes
----------------

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

- [Fix many cases of normalization-related ICEs][91255]
- [Replace dominators algorithm with simple Lengauer-Tarjan][85013]
- [Store liveness in interval sets for region inference][90637]

- [Remove `in_band_lifetimes` from the compiler and standard library,
  in preparation for removing this unstable feature.][91867]

[91867]: rust-lang/rust#91867
[83744]: rust-lang/rust#83744
[83791]: rust-lang/rust#83791
[85013]: rust-lang/rust#85013
[89825]: rust-lang/rust#89825
[89999]: rust-lang/rust#89999
[90128]: rust-lang/rust#90128
[90207]: rust-lang/rust#90207
[90521]: rust-lang/rust#90521
[90586]: rust-lang/rust#90586
[90637]: rust-lang/rust#90637
[90833]: rust-lang/rust#90833
[90846]: rust-lang/rust#90846
[91003]: rust-lang/rust#91003
[91172]: rust-lang/rust#91172
[91255]: rust-lang/rust#91255
[91284]: rust-lang/rust#91284
[91535]: rust-lang/rust#91535
[91593]: rust-lang/rust#91593
[91728]: rust-lang/rust#91728
[91878]: rust-lang/rust#91878
[91896]: rust-lang/rust#91896
[91926]: rust-lang/rust#91926
[91984]: rust-lang/rust#91984
[92020]: rust-lang/rust#92020
[92034]: rust-lang/rust#92034
[92483]: rust-lang/rust#92483
[cargo/10088]: rust-lang/cargo#10088
[cargo/10133]: rust-lang/cargo#10133
[cargo/10145]: rust-lang/cargo#10145
[cargo/10152]: rust-lang/cargo#10152
[cargo/10165]: rust-lang/cargo#10165
[cargo/10172]: rust-lang/cargo#10172
[cargo/10201]: rust-lang/cargo#10201
[cargo/10269]: rust-lang/cargo#10269

[cstr_from_bytes]: https://doc.rust-lang.org/stable/std/ffi/struct.CStr.html#method.from_bytes_with_nul_unchecked
[muninit_ptr]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.as_ptr
[muninit_init]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init
[muninit_init_ref]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_ref
[unwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-UnwindSafe
[refunwindsafe_once]: https://doc.rust-lang.org/stable/std/sync/struct.Once.html#impl-RefUnwindSafe
[tryfrom_ref_arr]: https://doc.rust-lang.org/stable/std/convert/trait.TryFrom.html#impl-TryFrom%3C%26%27_%20mut%20%5BT%5D%3E
[lowercase]: https://doc.rust-lang.org/stable/std/char/struct.ToLowercase.html#impl-DoubleEndedIterator
[uppercase]: https://doc.rust-lang.org/stable/std/char/struct.ToUppercase.html#impl-DoubleEndedIterator
[try_from_char_err]: https://doc.rust-lang.org/stable/std/char/struct.TryFromCharError.html
[available_parallelism]: https://doc.rust-lang.org/stable/std/thread/fn.available_parallelism.html
[result-copied]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.copied
[result-cloned]: https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.cloned
[asm]: https://doc.rust-lang.org/stable/core/arch/macro.asm.html
[global_asm]: https://doc.rust-lang.org/stable/core/arch/macro.global_asm.html
[is_break]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_break
[is_continue]: https://doc.rust-lang.org/stable/std/ops/enum.ControlFlow.html#method.is_continue
[try_from_char_u8]: https://doc.rust-lang.org/stable/std/primitive.char.html#impl-TryFrom%3Cchar%3E
[zip]: https://doc.rust-lang.org/stable/std/iter/fn.zip.html
[is_power_of_two8]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU8.html#method.is_power_of_two
[is_power_of_two16]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU16.html#method.is_power_of_two
[is_power_of_two32]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU32.html#method.is_power_of_two
[is_power_of_two64]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU64.html#method.is_power_of_two
[is_power_of_two128]: https://doc.rust-lang.org/stable/core/num/struct.NonZeroU128.html#method.is_power_of_two
[stdarch/1266]: rust-lang/stdarch#1266
@lcnr lcnr mentioned this pull request Sep 8, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 9, 2022
update `ParamKindOrd`

rust-lang#90207 (comment) 😁

writing comments "for future prs" sure works well :3

r? `@BoxyUwU`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. merged-by-bors This PR was explicitly merged by bors. 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.