{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":410517312,"defaultBranch":"master","name":"rust","ownerLogin":"Urgau","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2021-09-26T10:13:52.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/3616612?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1726754229.0","currentOid":""},"activityList":{"items":[{"before":"46b0f8bafcf11fa1d6b6c172f4f5c1b95c11ebdb","after":"2b11f265b68c151909aa7f31bfe49da1d788b317","ref":"refs/heads/master","pushedAt":"2024-09-20T12:39:00.000Z","pushType":"push","commitsCount":365,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Auto merge of #130508 - adwinwhite:niche-not-depend-on-order, r=the8472\n\nGet rid of niche selection's dependence on fields's order\n\nFixes #125630.\nUse the optimal niche selection decided in `univariant()` rather than picking niche field manually.\n\nr? `@the8472`","shortMessageHtmlLink":"Auto merge of rust-lang#130508 - adwinwhite:niche-not-depend-on-order…"}},{"before":"ea6e3f2d41a25d1b5aaa3bab9e461874ce4a4433","after":"aec3c9dea0941af71509bc3f65a5b419e05203ae","ref":"refs/heads/check-cfg-test-userspace","pushedAt":"2024-09-20T12:38:01.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Temporarily make the `test` cfg a well known bootstrap cfg","shortMessageHtmlLink":"Temporarily make the test cfg a well known bootstrap cfg"}},{"before":null,"after":"b67485e196ac87833d6a30285133f5e6bb6218f3","ref":"refs/heads/link_cfg_internal","pushedAt":"2024-09-19T13:57:09.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Make `link_cfg` internal because it's in perme-unstable","shortMessageHtmlLink":"Make link_cfg internal because it's in perme-unstable"}},{"before":"2b1fa67cc9cd0131bf309c6314d0a410e6a5c19b","after":"5e3fbff7458f0a845506d96fd84a020f466a3457","ref":"refs/heads/cfg-true-false","pushedAt":"2024-09-19T13:07:58.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Document `cfg_boolean_literal` feature in the unstable-book","shortMessageHtmlLink":"Document cfg_boolean_literal feature in the unstable-book"}},{"before":"0cb5010b2fc8a8629531e209f466c764d1846c2f","after":"2b1fa67cc9cd0131bf309c6314d0a410e6a5c19b","ref":"refs/heads/cfg-true-false","pushedAt":"2024-09-19T11:44:39.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Document `cfg_boolean_literal` feature in the unstable-book","shortMessageHtmlLink":"Document cfg_boolean_literal feature in the unstable-book"}},{"before":null,"after":"0cb5010b2fc8a8629531e209f466c764d1846c2f","ref":"refs/heads/cfg-true-false","pushedAt":"2024-09-18T15:45:48.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Implement lit bool for cfg evaluation","shortMessageHtmlLink":"Implement lit bool for cfg evaluation"}},{"before":"9aa27fa40230c08294be8f16e705fe1ff3014e59","after":"89f04c2521e8ca27457f84c5be7fb81ec1a5a223","ref":"refs/heads/check-cfg-raw-keywords","pushedAt":"2024-09-18T09:08:09.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Improve handling of raw-idents in check-cfg","shortMessageHtmlLink":"Improve handling of raw-idents in check-cfg"}},{"before":null,"after":"9aa27fa40230c08294be8f16e705fe1ff3014e59","ref":"refs/heads/check-cfg-raw-keywords","pushedAt":"2024-09-18T09:02:35.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Improve handling of (raw)keywords in check-cfg","shortMessageHtmlLink":"Improve handling of (raw)keywords in check-cfg"}},{"before":null,"after":"ea6e3f2d41a25d1b5aaa3bab9e461874ce4a4433","ref":"refs/heads/check-cfg-test-userspace","pushedAt":"2024-09-17T21:56:47.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Temporarily make the `test` cfg a well known bootstrap cfg","shortMessageHtmlLink":"Temporarily make the test cfg a well known bootstrap cfg"}},{"before":"17b322fa69eed7216dccc9f097eb68237cf62234","after":"46b0f8bafcf11fa1d6b6c172f4f5c1b95c11ebdb","ref":"refs/heads/master","pushedAt":"2024-09-17T14:59:03.000Z","pushType":"push","commitsCount":631,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Auto merge of #130455 - compiler-errors:inline-ordering, r=saethlin\n\nRemove semi-nondeterminism of `DefPathHash` ordering from inliner\n\nDéjà vu or something because I kinda thought I had put this PR up before. I recall a discussion somewhere where I think it was `@saethlin` mentioning that this check was no longer needed since we have \"proper\" cycle detection. Putting that up as a PR now.\n\nThis may slighlty negatively affect inlining, since the cycle breaking here means that we still inlined some cycles when the def path hashes were ordered in certain ways, this leads to really bad nondeterminism that makes minimizing ICEs and putting up inliner bugfixes difficult.\n\nr? `@cjgillot` or `@saethlin` or someone else idk","shortMessageHtmlLink":"Auto merge of rust-lang#130455 - compiler-errors:inline-ordering, r=s…"}},{"before":"5f367bbbd251b8cfb898f4d5711c9244888b1852","after":null,"ref":"refs/heads/fix-llvm-if-unchanged","pushedAt":"2024-09-10T10:22:19.000Z","pushType":"branch_deletion","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"}},{"before":"892daab68e9989443017b74102c98c87255d36ad","after":"0f9cb070bc312df3c9cadd358efaa1d1efe4a9d0","ref":"refs/heads/missing_docs-expect","pushedAt":"2024-09-09T12:52:45.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Add test about missing docs at crate level","shortMessageHtmlLink":"Add test about missing docs at crate level"}},{"before":"ae661ddea39cc9cce7c0f2616c11d18660f4988c","after":"892daab68e9989443017b74102c98c87255d36ad","ref":"refs/heads/missing_docs-expect","pushedAt":"2024-09-09T12:09:13.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Add test about missing docs at crate level","shortMessageHtmlLink":"Add test about missing docs at crate level"}},{"before":"13522e756beef90a4d15fc24a319aeea6bb7438e","after":"5f367bbbd251b8cfb898f4d5711c9244888b1852","ref":"refs/heads/fix-llvm-if-unchanged","pushedAt":"2024-09-06T15:50:42.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Make `download-ci-llvm = true` check if CI llvm is available\n\nand make it the default for the compiler profile, as to prevent\nunnecessarily checking out `src/llvm-project` with `\"if-unchanged\"`.","shortMessageHtmlLink":"Make download-ci-llvm = true check if CI llvm is available"}},{"before":"eb33b43bab08223fa6b46abacc1e95e859fe375d","after":"17b322fa69eed7216dccc9f097eb68237cf62234","ref":"refs/heads/master","pushedAt":"2024-09-06T15:49:10.000Z","pushType":"push","commitsCount":95,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Auto merge of #121848 - lcnr:stabilize-next-solver, r=compiler-errors\n\nstabilize `-Znext-solver=coherence`\n\nr? `@compiler-errors`\n\n---\n\nThis PR stabilizes the use of the next generation trait solver in coherence checking by enabling `-Znext-solver=coherence` by default. More specifically its use in the *implicit negative overlap check*. The tracking issue for this is https://github.com/rust-lang/rust/issues/114862. Closes #114862.\n\n## Background\n\n### The next generation trait solver\n\nThe new solver lives in [`rustc_trait_selection::solve`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/solve/mod.rs) and is intended to replace the existing *evaluate*, *fulfill*, and *project* implementation. It also has a wider impact on the rest of the type system, for example by changing our approach to handling associated types.\n\nFor a more detailed explanation of the new trait solver, see the [rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/solve/trait-solving.html). This does not stabilize the current behavior of the new trait solver, only the behavior impacting the implicit negative overlap check. There are many areas in the new solver which are not yet finalized. We are confident that their final design will not conflict with the user-facing behavior observable via coherence. More on that further down.\n\nPlease check out [the chapter](https://rustc-dev-guide.rust-lang.org/solve/significant-changes.html) summarizing the most significant changes between the existing and new implementations.\n\n### Coherence and the implicit negative overlap check\n\nCoherence checking detects any overlapping impls. Overlapping trait impls always error while overlapping inherent impls result in an error if they have methods with the same name. Coherence also results in an error if any other impls could exist, even if they are currently unknown. This affects impls which may get added to upstream crates in a backwards compatible way and impls from downstream crates.\n\nCoherence failing to detect overlap is generally considered to be unsound, even if it is difficult to actually get runtime UB this way. It is quite easy to get ICEs due to bugs in coherence.\n\nIt currently consists of two checks:\n\nThe [orphan check] validates that impls do not overlap with other impls we do not know about: either because they may be defined in a sibling crate, or because an upstream crate is allowed to add it without being considered a breaking change.\n\nThe [overlap check] validates that impls do not overlap with other impls we know about. This is done as follows:\n- Instantiate the generic parameters of both impls with inference variables\n- Equate the `TraitRef`s of both impls. If it fails there is no overlap.\n- [implicit negative]: Check whether any of the instantiated `where`-bounds of one of the impls definitely do not hold when using the constraints from the previous step. If a `where`-bound does not hold, there is no overlap.\n- *explicit negative (still unstable, ignored going forward)*: Check whether the any negated `where`-bounds can be proven, e.g. a `&mut u32: Clone` bound definitely does not hold as an explicit `impl !Clone for &mut T` exists.\n\nThe overlap check has to *prove that unifying the impls does not succeed*. This means that **incorrectly getting a type error during coherence is unsound** as it would allow impls to overlap: coherence has to be *complete*.\n\nCompleteness means that we never incorrectly error. This means that during coherence we must only add inference constraints if they are definitely necessary. During ordinary type checking [this does not hold](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=01d93b592bd9036ac96071cbf1d624a9), so the trait solver has to behave differently, depending on whether we're in coherence or not.\n\nThe implicit negative check only considers goals to \"definitely not hold\" if they could not be implemented downstream, by a sibling, or upstream in a backwards compatible way. If the goal is is \"unknowable\" as it may get added in another crate, we add an ambiguous candidate: [source](https://github.com/rust-lang/rust/blob/bea5bebf3defc56e5e3446b4a95c685dbb885fd3/compiler/rustc_trait_selection/src/solve/assembly/mod.rs#L858-L883).\n\n[orphan check]: https://github.com/rust-lang/rust/blob/fd80c02c168c2dfbb82c29d2617f524d2723205b/compiler/rustc_trait_selection/src/traits/coherence.rs#L566-L579\n[overlap check]: https://github.com/rust-lang/rust/blob/fd80c02c168c2dfbb82c29d2617f524d2723205b/compiler/rustc_trait_selection/src/traits/coherence.rs#L92-L98\n[implicit negative]: https://github.com/rust-lang/rust/blob/fd80c02c168c2dfbb82c29d2617f524d2723205b/compiler/rustc_trait_selection/src/traits/coherence.rs#L223-L281\n\n## Motivation\n\nReplacing the existing solver in coherence fixes soundness bugs by removing sources of incompleteness in the type system. The new solver separately strengthens coherence, resulting in more impls being disjoint and passing the coherence check. The concrete changes will be elaborated further down. We believe the stabilization to reduce the likelihood of future bugs in coherence as the new implementation is easier to understand and reason about.\n\nIt allows us to remove the support for coherence and implicit-negative reasoning in the old solver, allowing us to remove some code and simplifying the old trait solver. We will only remove the old solver support once this stabilization has reached stable to make sure we're able to quickly revert in case any unexpected issues are detected before then.\n\nStabilizing the use of the next-generation trait solver expresses our confidence that its current behavior is intended and our work towards enabling its use everywhere will not require any breaking changes to the areas used by coherence checking. We are also confident that we will be able to replace the existing solver everywhere, as maintaining two separate systems adds a significant maintainance burden.\n\n## User-facing impact and reasoning\n\n### Breakage due to improved handling of associated types\n\nThe new solver fixes multiple issues related to associated types. As these issues caused coherence to consider more types distinct, fixing them results in more overlap errors. This is therefore a breaking change.\n\n#### Structurally relating aliases containing bound vars\n\nFixes https://github.com/rust-lang/rust/issues/102048. In the existing solver relating ambiguous projections containing bound variables is structural. This is *incomplete* and allows overlapping impls. These was mostly not exploitable as the same issue also caused impls to not apply when trying to use them. The new solver defers alias-relating to a nested goal, fixing this issue:\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\ntrait Trait {}\n\ntrait Project {\n type Assoc<'a>;\n}\n\nimpl Project for u32 {\n type Assoc<'a> = &'a u32;\n}\n\n// Eagerly normalizing `::Assoc<'a>` is ambiguous,\n// so the old solver ended up structurally relating\n//\n// (?infer, for<'a> fn(::Assoc<'a>))\n//\n// with\n//\n// ((u32, fn(&'a u32)))\n//\n// Equating `&'a u32` with `::Assoc<'a>` failed, even\n// though these types are equal modulo normalization.\nimpl Trait for (T, for<'a> fn(::Assoc<'a>)) {}\n\nimpl<'a> Trait for (u32, fn(&'a u32)) {}\n//[next]~^ ERROR conflicting implementations of trait `Trait` for type `(u32, for<'a> fn(&'a u32))`\n```\n\nA crater run did not discover any breakage due to this change.\n\n#### Unknowable candidates for higher ranked trait goals\n\nThis avoids an unsoundness by attempting to normalize in `trait_ref_is_knowable`, fixing https://github.com/rust-lang/rust/issues/114061. This is a side-effect of supporting lazy normalization, as that forces us to attempt to normalize when checking whether a `TraitRef` is knowable: [source](https://github.com/rust-lang/rust/blob/47dd709bedda8127e8daec33327e0a9d0cdae845/compiler/rustc_trait_selection/src/solve/assembly/mod.rs#L754-L764).\n\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\ntrait IsUnit {}\nimpl IsUnit for () {}\n\npub trait WithAssoc<'a> {\n type Assoc;\n}\n\n// We considered `for<'a> >::Assoc: IsUnit`\n// to be knowable, even though the projection is ambiguous.\npub trait Trait {}\nimpl Trait for T\nwhere\n T: 'static,\n for<'a> T: WithAssoc<'a>,\n for<'a> >::Assoc: IsUnit,\n{\n}\nimpl Trait for Box {}\n//[next]~^ ERROR conflicting implementations of trait `Trait`\n```\nThe two impls of `Trait` overlap given the following downstream crate:\n```rust\nuse dep::*;\nstruct Local;\nimpl WithAssoc<'_> for Box {\n type Assoc = ();\n}\n```\n\nThere a similar coherence unsoundness caused by our handling of aliases which is fixed separately in https://github.com/rust-lang/rust/pull/117164.\n\nThis change breaks the [`derive-visitor`](https://crates.io/crates/derive-visitor) crate. I have opened an issue in that repo: nikis05/derive-visitor#16.\n\n### Evaluating goals to a fixpoint and applying inference constraints\n\nIn the old implementation of the implicit-negative check, each obligation is [checked separately without applying its inference constraints](https://github.com/rust-lang/rust/blob/bea5bebf3defc56e5e3446b4a95c685dbb885fd3/compiler/rustc_trait_selection/src/traits/coherence.rs#L323-L338). The new solver instead [uses a `FulfillmentCtxt`](https://github.com/rust-lang/rust/blob/bea5bebf3defc56e5e3446b4a95c685dbb885fd3/compiler/rustc_trait_selection/src/traits/coherence.rs#L315-L321) for this, which evaluates all obligations in a loop until there's no further inference progress.\n\nThis is necessary for backwards compatibility as we do not eagerly normalize with the new solver, resulting in constraints from normalization to only get applied by evaluating a separate obligation. This also allows more code to compile:\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\ntrait Mirror {\n type Assoc;\n}\nimpl Mirror for T {\n type Assoc = T;\n}\n\ntrait Foo {}\ntrait Bar {}\n\n// The self type starts out as `?0` but is constrained to `()`\n// due to the where-clause below. Because `(): Bar` is known to\n// not hold, we can prove the impls disjoint.\nimpl Foo for T where (): Mirror {}\n//[current]~^ ERROR conflicting implementations of trait `Foo` for type `()`\nimpl Foo for T where T: Bar {}\n\nfn main() {}\n```\nThe old solver does not run nested goals to a fixpoint in evaluation. The new solver does do so, strengthening inference and improving the overlap check:\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\ntrait Foo {}\nimpl Foo for (u8, T, T) {}\ntrait NotU8 {}\ntrait Bar {}\nimpl Bar for (T, T, U) {}\n\ntrait NeedsFixpoint {}\nimpl NeedsFixpoint for T {}\nimpl NeedsFixpoint for (u8, u8, u8) {}\n\ntrait Overlap {}\nimpl Overlap for T {}\nimpl Overlap for (T, U, V) {}\n//[current]~^ ERROR conflicting implementations of trait `Foo`\n```\n\n### Breakage due to removal of incomplete candidate preference\n\nFixes #107887. In the old solver we incompletely prefer the builtin trait object impl over user defined impls. This can break inference guidance, inferring `?x` in `dyn Trait: Trait` to `u32`, even if an explicit impl of `Trait` also exists.\n\nThis caused coherence to incorrectly allow overlapping impls, resulting in ICEs and a theoretical unsoundness. See https://github.com/rust-lang/rust/issues/107887#issuecomment-1997261676. This compiles on stable but results in an overlap error with `-Znext-solver=coherence`:\n\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\nstruct W(*const T);\n\ntrait Trait {\n type Assoc;\n}\n\n// This would trigger the check for overlap between automatic and custom impl.\n// They actually don't overlap so an impl like this should remain possible\n// forever.\n//\n// impl Trait for dyn Trait {}\ntrait Indirect {}\nimpl Indirect for dyn Trait {}\nimpl Trait for T {\n type Assoc = ();\n}\n\n// Incomplete impl where `dyn Trait: Trait<_>` does not hold, but\n// `dyn Trait: Trait` does.\ntrait EvaluateHack {}\nimpl EvaluateHack> for T\nwhere\n T: Trait, // incompletely constrains `_` to `u32`\n U: IsU64,\n T: Trait, // incompletely constrains `_` to `u32`\n{\n}\n\ntrait IsU64 {}\nimpl IsU64 for u64 {}\n\ntrait Overlap {\n type Assoc: Default;\n}\nimpl>, U: ?Sized> Overlap for T {\n type Assoc = Box;\n}\nimpl Overlap for dyn Trait {\n//[next]~^ ERROR conflicting implementations of trait `Overlap<_>`\n type Assoc = usize;\n}\n```\n\n### Considering region outlives bounds in the `leak_check`\n\nFor details on the `leak_check`, see the FCP proposal in #119820.[^leak_check]\n\n[^leak_check]: which should get moved to the dev-guide once that PR lands :3\n\nIn both coherence and during candidate selection, the `leak_check` relies on the region constraints added in `evaluate`. It therefore currently does not register outlives obligations: [source](https://github.com/rust-lang/rust/blob/ccb1415eac3289b5ebf64691c0190dc52e0e3d0e/compiler/rustc_trait_selection/src/traits/select/mod.rs#L792-L810). This was likely done as a performance optimization without considering its impact on the `leak_check`. This is the case as in the old solver, *evaluatation* and *fulfillment* are split, with evaluation being responsible for candidate selection and fulfillment actually registering all the constraints.\n\nThis split does not exist with the new solver. The `leak_check` can therefore eagerly detect errors caused by region outlives obligations. This improves both coherence itself and candidate selection:\n\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\ntrait LeakErr<'a, 'b> {}\n// Using this impl adds an `'b: 'a` bound which results\n// in a higher-ranked region error. This bound has been\n// previously ignored but is now considered.\nimpl<'a, 'b: 'a> LeakErr<'a, 'b> for () {}\n\ntrait NoOverlapDir<'a> {}\nimpl<'a, T: for<'b> LeakErr<'a, 'b>> NoOverlapDir<'a> for T {}\nimpl<'a> NoOverlapDir<'a> for () {}\n//[current]~^ ERROR conflicting implementations of trait `NoOverlapDir<'_>`\n\n// --------------------------------------\n\n// necessary to avoid coherence unknowable candidates\nstruct W(T);\n\ntrait GuidesSelection<'a, U> {}\nimpl<'a, T: for<'b> LeakErr<'a, 'b>> GuidesSelection<'a, W> for T {}\nimpl<'a, T> GuidesSelection<'a, W> for T {}\n\ntrait NotImplementedByU8 {}\ntrait NoOverlapInd<'a, U> {}\nimpl<'a, T: GuidesSelection<'a, W>, U> NoOverlapInd<'a, U> for T {}\nimpl<'a, U: NotImplementedByU8> NoOverlapInd<'a, U> for () {}\n//[current]~^ conflicting implementations of trait `NoOverlapInd<'_, _>`\n```\n\n### Removal of `fn match_fresh_trait_refs`\n\nThe old solver tries to [eagerly detect unbounded recursion](https://github.com/rust-lang/rust/blob/b14fd2359f47fb9a14bbfe55359db4bb3af11861/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1196-L1211), forcing the affected goals to be ambiguous. This check is only an approximation and has not been added to the new solver.\n\nThe check is not necessary in the new solver and it would be problematic for caching. As it depends on all goals currently on the stack, using a global cache entry would have to always make sure that doing so does not circumvent this check.\n\nThis changes some goals to error - or succeed - instead of failing with ambiguity. This allows more code to compile:\n\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\n\n// Need to use this local wrapper for the impls to be fully\n// knowable as unknowable candidate result in ambiguity.\nstruct Local(T);\n\ntrait Trait {}\n// This impl does not hold, but is ambiguous in the old\n// solver due to its overflow approximation.\nimpl Trait for Local where Local: Trait {}\n// This impl holds.\nimpl Trait> for Local {}\n\n// In the old solver, `Local: Trait>` is ambiguous,\n// resulting in `Local: NoImpl`, also being ambiguous.\n//\n// In the new solver the first impl does not apply, constraining\n// `?u` to `Local<()>`, causing `Local<()>: NoImpl` to error.\ntrait Indirect {}\nimpl Indirect for T\nwhere\n T: Trait,\n U: NoImpl\n{}\n\n// Not implemented for `Local<()>`\ntrait NoImpl {}\nimpl NoImpl for Local {}\nimpl NoImpl for Local {}\n\n// `Local: Indirect>` cannot hold, so\n// these impls do not overlap.\ntrait NoOverlap {}\nimpl, U> NoOverlap for T {}\nimpl NoOverlap> for Local {}\n//~^ ERROR conflicting implementations of trait `NoOverlap>`\n```\n\n### Non-fatal overflow\n\nThe old solver immediately emits a fatal error when hitting the recursion limit. The new solver instead returns overflow. This both allows more code to compile and is results in performance and potential future compatability issues.\n\nNon-fatal overflow is generally desirable. With fatal overflow, changing the order in which we evaluate nested goals easily causes breakage if we have goal which errors and one which overflows. It is also required to prevent breakage due to the removal of `fn match_fresh_trait_refs`, e.g. [in `typenum`](https://github.com/rust-lang/trait-system-refactor-initiative/issues/73).\n\n#### Enabling more code to compile\n\nIn the below example, the old solver first tried to prove an overflowing goal, resulting in a fatal error. The new solver instead returns ambiguity due to overflow for that goal, causing the implicit negative overlap check to succeed as `Box: NotImplemented` does not hold.\n```rust\n// revisions: current next\n//[next] compile-flags: -Znext-solver=coherence\n//[current] ERROR overflow evaluating the requirement\n\ntrait Indirect {}\nimpl> Indirect for () {}\n\ntrait Overflow {}\nimpl Overflow for Box\nwhere\n U: Indirect>>,\n{}\n\ntrait NotImplemented {}\n\ntrait Trait {}\nimpl Trait for T\nwhere\n // T: NotImplemented, // causes old solver to succeed\n U: Indirect,\n T: NotImplemented,\n{}\n\nimpl Trait<()> for Box {}\n```\n\n#### Avoiding hangs with non-fatal overflow\n\nSimply returning ambiguity when reaching the recursion limit can very easily result in hangs, e.g.\n```rust\ntrait Recur {}\nimpl Recur for ((T, U), (U, T))\nwhere\n (T, U): Recur,\n (U, T): Recur,\n{}\n\ntrait NotImplemented {}\nimpl Recur for T {}\n```\nThis can happen quite frequently as it's easy to have exponential blowup due to multiple nested goals at each step. As the trait solver is depth-first, this immediately caused a fatal overflow error in the old solver. In the new solver we have to handle the whole proof tree instead, which can very easily hang.\n\nTo avoid this we restrict the recursion depth after hitting the recursion limit for the first time. We also **ignore all inference constraints from goals resulting in overflow**. This is mostly backwards compatible as any overflow in the old solver resulted in a fatal error.\n\n### sidenote about normalization\n\nWe return ambiguous nested goals of `NormalizesTo` goals to the caller and ignore their impact when computing the `Certainty` of the current goal. See the [normalization chapter](https://rustc-dev-guide.rust-lang.org/solve/normalization.html) for more details.This means we apply constraints resulting from other nested goals and from equating the impl header when normalizing, even if a nested goal results in overflow. This is necessary to avoid breaking the following example:\n```rust\ntrait Trait {\n type Assoc;\n}\n\nstruct W(*mut T);\nimpl Trait for W>\nwhere\n W: Trait,\n{\n type Assoc = ();\n}\n\n// `W: Trait` does not hold as\n// `Assoc` gets normalized to `()`. However, proving\n// the where-bounds of the impl results in overflow.\n//\n// For this to continue to compile we must not discard\n// constraints from normalizing associated types.\ntrait NoOverlap {}\nimpl> NoOverlap for T {}\nimpl NoOverlap for W {}\n```\n\n#### Future compatability concerns\n\nNon-fatal overflow results in some unfortunate future compatability concerns. Changing the approach to avoid more hangs by more strongly penalizing overflow can cause breakage as we either drop constraints or ignore candidates necessary to successfully compile. Weakening the overflow penalities instead allows more code to compile and strengthens inference while potentially causing more code to hang.\n\nWhile the current approach is not perfect, we believe it to be good enough. We believe it to apply the necessary inference constraints to avoid breakage and expect there to not be any desirable patterns broken by our current penalities. Similarly we believe the current constraints to avoid most accidental hangs. Ignoring constraints of overflowing goals is especially useful, as it may allow major future optimizations to our overflow handling. See [this summary](https://hackmd.io/ATf4hN0NRY-w2LIVgeFsVg) and the linked documents in case you want to know more.\n\n### changes to performance\n\nIn general, trait solving during coherence checking is not significant for performance. Enabling the next-generation trait solver in coherence does not impact our compile time benchmarks. We are still unable to compile the benchmark suite when fully enabling the new trait solver.\n\nThere are rare cases where the new solver has significantly worse performance due to non-fatal overflow, its reliance on fixpoint algorithms and the removal of the `fn match_fresh_trait_refs` approximation. We encountered such issues in [`typenum`](https://crates.io/crates/typenum) and believe it should be [pretty much as bad as it can get](https://github.com/rust-lang/trait-system-refactor-initiative/issues/73).\n\nDue to an improved structure and far better caching, we believe that there is a lot of room for improvement and that the new solver will outperform the existing implementation in nearly all cases, sometimes significantly. We have not yet spent any time micro-optimizing the implementation and have many unimplemented major improvements, such as fast-paths for trivial goals.\n\nTODO: get some rough results here and put them in a table\n\n### Unstable features\n\n#### Unsupported unstable features\n\nThe new solver currently does not support all unstable features, most notably `#![feature(generic_const_exprs)]`, `#![feature(associated_const_equality)]` and `#![feature(adt_const_params)]` are not yet fully supported in the new solver. We are confident that supporting them is possible, but did not consider this to be a priority. This stabilization introduces new ICE when using these features in impl headers.\n\n#### fixes to `#![feature(specialization)]`\n\n- fixes #105782\n- fixes #118987\n\n#### fixes to `#![feature(type_alias_impl_trait)]`\n\n- fixes #119272\n- https://github.com/rust-lang/rust/issues/105787#issuecomment-1750112388\n- fixes #124207\n\n## This does not stabilize the whole solver\n\nWhile this stabilizes the use of the new solver in coherence checking, there are many parts of the solver which will remain fully unstable. We may still adapt these areas while working towards stabilizing the new solver everywhere. We are confident that we are able to do so without negatively impacting coherence.\n\n### goals with a non-empty `ParamEnv`\n\nCoherence always uses an empty environment. We therefore do not depend on the behavior of `AliasBound` and `ParamEnv` candidates. We only stabilizes the behavior of user-defined and builtin implementations of traits. There are still many open questions there.\n\n### opaque types in the defining scope\n\nThe handling of opaque types - `impl Trait` - in both the new and old solver is still not fully figured out. Luckily this can be ignored for now. While opaque types are reachable during coherence checking by using `impl_trait_in_associated_types`, the behavior during coherence is separate and self-contained. The old and new solver fully agree here.\n\n### normalization is hard\n\nThis stabilizes that we equate associated types involving bound variables using deferred-alias-equality. We also stop eagerly normalizing in coherence, which should not have any user-facing impact.\n\nWe do not stabilize the normalization behavior outside of coherence, e.g. we currently deeply normalize all types during writeback with the new solver. This may change going forward\n\n### how to replace `select` from the old solver\n\nWe sometimes depend on getting a single `impl` for a given trait bound, e.g. when resolving a concrete method for codegen/CTFE. We do not depend on this during coherence, so the exact approach here can still be freely changed going forward.\n\n## Acknowledgements\n\nThis work would not have been possible without `@compiler-errors.` He implemented large chunks of the solver himself but also and did a lot of testing and experimentation, eagerly discovering multiple issues which had a significant impact on our approach. `@BoxyUwU` has also done some amazing work on the solver. Thank you for the endless hours of discussion resulting in the current approach. Especially the way aliases are handled has gone through multiple revisions to get to its current state.\n\nThere were also many contributions from - and discussions with - other members of the community and the rest of `@rust-lang/types.` This solver builds upon previous improvements to the compiler, as well as lessons learned from `chalk` and `a-mir-formality`. Getting to this point would not have been possible without that and I am incredibly thankful to everyone involved. See the [list of relevant PRs](https://github.com/rust-lang/rust/pulls?q=is%3Apr+is%3Amerged+label%3AWG-trait-system-refactor+-label%3Arollup+closed%3A%3C2024-03-22+).","shortMessageHtmlLink":"Auto merge of rust-lang#121848 - lcnr:stabilize-next-solver, r=compil…"}},{"before":"7dd1be1d0d2911b16aa1347efa47e7c43c507ade","after":"ae661ddea39cc9cce7c0f2616c11d18660f4988c","ref":"refs/heads/missing_docs-expect","pushedAt":"2024-09-06T11:51:18.000Z","pushType":"push","commitsCount":2,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Don't emit `missing_docs` lint with dummy spans","shortMessageHtmlLink":"Don't emit missing_docs lint with dummy spans"}},{"before":null,"after":"7dd1be1d0d2911b16aa1347efa47e7c43c507ade","ref":"refs/heads/missing_docs-expect","pushedAt":"2024-09-06T10:32:07.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Also emit `missing_docs` lint with `--test` to fulfill expectations","shortMessageHtmlLink":"Also emit missing_docs lint with --test to fulfill expectations"}},{"before":"634a2c23a07b9fbd15c422d572c654c895fc7a4f","after":"13522e756beef90a4d15fc24a319aeea6bb7438e","ref":"refs/heads/fix-llvm-if-unchanged","pushedAt":"2024-09-06T06:50:08.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Make `download-ci-llvm = true` check if CI llvm is available\n\nand make it the default for the compiler profile, as to prevent\nunnecessarily checking out `src/llvm-project` with `\"if-unchanged\"`.","shortMessageHtmlLink":"Make download-ci-llvm = true check if CI llvm is available"}},{"before":"9fed172b30c16927194a2ad93df2e89a2e7c3803","after":"634a2c23a07b9fbd15c422d572c654c895fc7a4f","ref":"refs/heads/fix-llvm-if-unchanged","pushedAt":"2024-09-05T20:54:03.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Make `download-ci-llvm = true` check if CI llvm is available\n\nand make it the default for the compiler profile, as to prevent\nunnecessarily checking out `src/llvm-project` with `\"if-unchanged\"`.","shortMessageHtmlLink":"Make download-ci-llvm = true check if CI llvm is available"}},{"before":"a60a9e567a7319b33619f6551dc29522c6f58687","after":"eb33b43bab08223fa6b46abacc1e95e859fe375d","ref":"refs/heads/master","pushedAt":"2024-09-05T20:52:09.000Z","pushType":"push","commitsCount":964,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Auto merge of #129978 - matthiaskrgr:rollup-a7ryoox, r=matthiaskrgr\n\nRollup of 10 pull requests\n\nSuccessful merges:\n\n - #101339 (enable -Zrandomize-layout in debug CI builds )\n - #120736 (rustdoc: add header map to the table of contents)\n - #127021 (Add target support for RTEMS Arm)\n - #128928 (CI: rfl: add more tools and steps)\n - #129584 (warn the user if the upstream master branch is old)\n - #129664 (Arbitrary self types v2: pointers feature gate.)\n - #129752 (Make supertrait and implied predicates queries defaulted)\n - #129918 (Update docs of `missing_abi` lint)\n - #129919 (Stabilize `waker_getters`)\n - #129925 (remove deprecated option `rust.split-debuginfo`)\n\nFailed merges:\n\n - #129789 (rustdoc: use strategic boxing to shrink `clean::Item`)\n\nr? `@ghost`\n`@rustbot` modify labels: rollup","shortMessageHtmlLink":"Auto merge of rust-lang#129978 - matthiaskrgr:rollup-a7ryoox, r=matth…"}},{"before":"29886a342023d951fb34f03148b958d3cdd7cb6b","after":"9fed172b30c16927194a2ad93df2e89a2e7c3803","ref":"refs/heads/fix-llvm-if-unchanged","pushedAt":"2024-09-05T20:49:04.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Make `download-ci-llvm = true` check if CI llvm is available\n\nand make it the default for the compiler profile, as to prevent\nunnecessarily checking out `src/llvm-project` with `\"if-unchanged\"`.","shortMessageHtmlLink":"Make download-ci-llvm = true check if CI llvm is available"}},{"before":"427f03997d3da9b5669ba35495094368b9791499","after":"29886a342023d951fb34f03148b958d3cdd7cb6b","ref":"refs/heads/fix-llvm-if-unchanged","pushedAt":"2024-08-25T10:04:38.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Only update `src/llvm-project` submodule if already existing","shortMessageHtmlLink":"Only update src/llvm-project submodule if already existing"}},{"before":null,"after":"427f03997d3da9b5669ba35495094368b9791499","ref":"refs/heads/fix-llvm-if-unchanged","pushedAt":"2024-08-23T15:02:06.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Only update `src/llvm-project` submodule if already existing","shortMessageHtmlLink":"Only update src/llvm-project submodule if already existing"}},{"before":"c9a3bc8896d96a199c853a7c6838e7c4790debf0","after":"cac4a30069af129a3f38a41498c50237423844de","ref":"refs/heads/rfc3127-sysroot-2","pushedAt":"2024-08-23T14:20:53.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Implement RFC3137 trim-paths sysroot changes","shortMessageHtmlLink":"Implement RFC3137 trim-paths sysroot changes"}},{"before":"e08b80c0fb7667bdcd040761891701e576c42ec8","after":"a60a9e567a7319b33619f6551dc29522c6f58687","ref":"refs/heads/master","pushedAt":"2024-08-23T14:19:40.000Z","pushType":"push","commitsCount":891,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Auto merge of #129464 - GuillaumeGomez:rollup-ckfqd7h, r=GuillaumeGomez\n\nRollup of 9 pull requests\n\nSuccessful merges:\n\n - #128511 (Document WebAssembly target feature expectations)\n - #129243 (do not build `cargo-miri` by default on stable channel)\n - #129263 (Add a missing compatibility note in the 1.80.0 release notes)\n - #129276 (Stabilize feature `char_indices_offset`)\n - #129350 (adapt integer comparison tests for LLVM 20 IR changes)\n - #129408 (Fix handling of macro arguments within the `dropping_copy_types` lint)\n - #129426 (rustdoc-search: use tighter json for names and parents)\n - #129437 (Fix typo in a help diagnostic)\n - #129457 (kobzol vacation)\n\nr? `@ghost`\n`@rustbot` modify labels: rollup","shortMessageHtmlLink":"Auto merge of rust-lang#129464 - GuillaumeGomez:rollup-ckfqd7h, r=Gui…"}},{"before":"8bd90a9e1ce6cde3acb249cadca60144f84d4d12","after":"c9a3bc8896d96a199c853a7c6838e7c4790debf0","ref":"refs/heads/rfc3127-sysroot-2","pushedAt":"2024-08-22T12:03:01.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Fix handling of macro arguments within the dropping_copy_types lint","shortMessageHtmlLink":"Fix handling of macro arguments within the dropping_copy_types lint"}},{"before":null,"after":"6a878a9630945cd6a61ad5e83ec5c543c6e8dab7","ref":"refs/heads/macro-arg-drop_copy","pushedAt":"2024-08-22T11:33:46.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Fix handling of macro arguments within the `dropping_copy_types lint","shortMessageHtmlLink":"Fix handling of macro arguments within the `dropping_copy_types lint"}},{"before":null,"after":"8bd90a9e1ce6cde3acb249cadca60144f84d4d12","ref":"refs/heads/rfc3127-sysroot-2","pushedAt":"2024-08-21T18:55:58.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Implement RFC3137 trim-paths sysroot changes","shortMessageHtmlLink":"Implement RFC3137 trim-paths sysroot changes"}},{"before":null,"after":"b6909ce61e580d7e57c2539d9ae36437bfdb091d","ref":"refs/heads/run-make-lc_all-c","pushedAt":"2024-08-21T17:11:31.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Force `LC_ALL=C` for all run-make tests","shortMessageHtmlLink":"Force LC_ALL=C for all run-make tests"}},{"before":null,"after":"4325ac9652016896edc4209805d23c1cb0ea5ae0","ref":"refs/heads/ptr_fn_addr_eq","pushedAt":"2024-08-20T17:33:14.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Urgau","name":null,"path":"/Urgau","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/3616612?s=80&v=4"},"commit":{"message":"Implement `ptr::fn_addr_eq`","shortMessageHtmlLink":"Implement ptr::fn_addr_eq"}}],"hasNextPage":true,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"Y3Vyc29yOnYyOpK7MjAyNC0wOS0yMFQxMjozOTowMC4wMDAwMDBazwAAAAS78m8g","startCursor":"Y3Vyc29yOnYyOpK7MjAyNC0wOS0yMFQxMjozOTowMC4wMDAwMDBazwAAAAS78m8g","endCursor":"Y3Vyc29yOnYyOpK7MjAyNC0wOC0yMFQxNzozMzoxNC4wMDAwMDBazwAAAASfYEkN"}},"title":"Activity · Urgau/rust"}