about summary refs log tree commit diff
path: root/tests/ui/traits
AgeCommit message (Collapse)AuthorLines
2025-09-11Less greedily parse `[const]` boundsLeón Orell Valerian Liehr-0/+25
(cherry picked from commit f5dad62d4cd)
2025-09-08Only consider auto traits empty for the purposes of omitting vptrs from ↵Zachary S-0/+161
subtrait vtables (cherry picked from commit 904e83c53fece4a34c2e90bb44e362d8868d65f3)
2025-08-21Gate const trait syntaxLeón Orell Valerian Liehr-3/+26
(cherry picked from commit 092c6f3a188ec8b261ec3368e49ad3b07bcc13dc)
2025-08-14Revert "Use DeepRejectCtxt in assemble_inherent_candidates_from_param"Michael Goulet-46/+0
This reverts commit ad59f0b6e6e5c45ea64064758a88e8521259bfcf.
2025-08-01Rollup merge of #144397 - Kivooeo:issue2, r=jieyouxuRalf Jung-0/+50
`tests/ui/issues/`: The Issues Strike Back [2/N] Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895. r? ``@jieyouxu``
2025-07-31commentsKivooeo-150/+4
2025-07-31Auto merge of #144405 - lcnr:hir-typeck-uniquify, r=BoxyUwUbors-0/+125
uniquify root goals during HIR typeck We need to rely on region identity to deal with hangs such as https://github.com/rust-lang/trait-system-refactor-initiative/issues/210 and to keep the current behavior of `fn try_merge_responses`. This is a problem as borrowck starts by replacing each *occurrence* of a region with a unique inference variable. This frequently splits a single region during HIR typeck into multiple distinct regions. As we assume goals to always succeed during borrowck, relying on two occurances of a region being identical during HIR typeck causes ICE. See the now fixed examples in https://github.com/rust-lang/trait-system-refactor-initiative/issues/27 and rust-lang/rust#139409. We've previously tried to avoid this issue by always *uniquifying* regions when canonicalizing goals. This prevents caching subtrees during canonicalization which resulted in hangs for very large types. People rely on such types in practice, which caused us to revert our attempt to reinstate `#[type_length_limit]` in https://github.com/rust-lang/rust/pull/127670. The complete list of changes here: - rust-lang/rust#107981 - rust-lang/rust#110180 - rust-lang/rust#114117 - rust-lang/rust#130821 After more consideration, all occurrences of such large types need to happen outside of typeck/borrowck. We know this as we already walk over all types in the MIR body when replacing their regions with nll vars. This PR therefore enables us to rely on region identity inside of the trait solver by exclusively **uniquifying root goals during HIR typeck**. These are the only goals we assume to hold during borrowck. This is insufficient as type inference variables may "hide" regions we later uniquify. Because of this, we now stash proven goals which depend on inference variables in HIR typeck and reprove them after writeback. This closes https://github.com/rust-lang/trait-system-refactor-initiative/issues/127. This was originally part of rust-lang/rust#144258 but I've moved it into a separate PR. While I believe we need to rely on region identity to fix the performance issues in some way, I don't know whether rust-lang/rust#144258 is the best approach to actually do so. Regardless of how we deal with the hangs however, this change is necessary and desirable regardless. r? `@compiler-errors` or `@BoxyUwU`
2025-07-30handle region dependent goals due to infer varslcnr-0/+52
2025-07-29add `nonpoison::mutex` implementationConnor Tsui-3/+3
Adds the equivalent `nonpoison` types to the `poison::mutex` module. These types and implementations are gated under the `nonpoison_mutex` feature gate. Also blesses the ui tests that now have a name conflicts (because these types no longer have unique names). The full path distinguishes the different types. Co-authored-by: Aandreba <aandreba@gmail.com> Co-authored-by: Trevor Gross <tmgross@umich.edu>
2025-07-28Rollup merge of #144151 - Kivooeo:issue1, r=jieyouxuMatthias Krüger-0/+66
`tests/ui/issues/`: The Issues Strike Back [1/N] I believe I’ve finally brought [my program](https://github.com/Kivooeo/test-manager) to life -- it now handles multiple test moves in one go: plain moves first, then a gentle touch on each file depends on given options. The process should be much smoother now. Of course, I won’t rush through everything in a few days -- that would be unkind to `@Oneirical.` I’ll pace myself. And also I can't have more than one such PR because `issues.txt` will conflict with previous parts after merging them which is not fun as well. This PR is just that: first commit - moves; second - regression comments and the occasional .stderr reblesses, also issue.txt and tidy changes. Nothing special, but progress nonetheless. This is for the purpose of preserving test file history during restructuring Part of https://github.com/rust-lang/rust/issues/133895. r? `@jieyouxu`
2025-07-27Rollup merge of #144226 - cjgillot:known-panics-panics, r=oli-obkMatthias Krüger-25/+5
Do not assert layout in KnownPanicsLint. Fixes rust-lang/rust#121176 Fixes rust-lang/rust#129109 Fixes rust-lang/rust#130970 Fixes rust-lang/rust#131347 Fixes rust-lang/rust#139872 Fixes rust-lang/rust#140332
2025-07-26Rollup merge of #144409 - GuillaumeGomez:macro-expansion-early-abort, r=oli-obkJacob Pratt-29/+42
Stop compilation early if macro expansion failed Fixes rust-lang/rust#116180. So there isn't really a type that is central for macro expansion and some errors are actually emitted (because the resolution happens after the expansion I suppose) after the expansion pass (like "not found macro"). Sometimes, errors are only emitted on the second "try" (to improve error output). So I couldn't reach a similar solution than what was done in https://github.com/rust-lang/rust/pull/133937 and suggested by ````@estebank```` in https://github.com/rust-lang/rust/issues/116180#issuecomment-3109468922. But maybe I missed something? So in the end, I realized that there is method called every time (except one, described below) a macro error is actually emitted: `ExtCtxt::trace_macros_diag`. Considering I updated what it did, I renamed it into `macro_error_and_trace_macros_diag` to better reflect it. There is only one call of `trace_macros_diag` which isn't reporting an error but just used for `macro_trace` feature, so I kept it as is. r? ````@oli-obk````
2025-07-26Rollup merge of #144356 - GuillaumeGomez:gcc-ignore-tests, r=jieyouxuTrevor Gross-16/+17
Add `ignore-backends` annotations in failing GCC backend ui tests Follow-up of https://github.com/rust-lang/rust/pull/144125. In the GCC backend, we don't support all ui tests yet and we have a list of tests we currently ignore available [here](https://github.com/rust-lang/rustc_codegen_gcc/blob/master/tests/failing-ui-tests.txt). This PR adds the `ignore-backends` annotations to the corresponding ui tests. The second commit is a fix to compiletest, complaining about `ignore-backends`. r? ```@jieyouxu```
2025-07-25Check statics' type in type_of.Camille GILLOT-25/+5
2025-07-25Update ui tests with new macro early erroringGuillaume Gomez-29/+42
2025-07-25commentsKivooeo-22/+19
2025-07-25move 28 testsKivooeo-0/+69
2025-07-25uniquify root goals during HIR typecklcnr-0/+73
2025-07-24Rehome tests/ui/issues/ tests [1/?]Oneirical-0/+97
2025-07-24Rollup merge of #144014 - dianne:edition-guide-links, r=estebankLeón Orell Valerian Liehr-8/+8
don't link to the nightly version of the Edition Guide in stable lints As reported in rust-lang/rust#143557 for `rust_2024_incompatible_pat`, most future-Edition-incompatibility lints link to the nightly version of the Edition Guide; the lints were written before their respective Editions (and their guides) stabilized. But now that Rusts 2021 and 2024 are stable, these lints are emitted on stable versions of the compiler, where it makes more sense to present users with links that don't say "nightly" in them. This does not change the link for `rust_2024_incompatible_pat`. That's handled in rust-lang/rust#144006.
2025-07-24moved 35 tests to organized locationsKivooeo-0/+196
2025-07-23Add `ignore-backends` annotations in failing GCC backend ui testsGuillaume Gomez-16/+17
2025-07-22Rollup merge of #143768 - Randl:const-try, r=oli-obk许杰友 Jieyou Xu (Joe)-117/+12
Constify Try, From, TryFrom and relevant traits
2025-07-21Constify Try, From, TryFromEvgenii Zheltonozhskii-117/+12
2025-07-20Consider param-env for fast pathMichael Goulet-40/+2
2025-07-18Rollup merge of #142693 - fmease:unbound-bettering, r=compiler-errorsMatthias Krüger-205/+67
More robustly deal with relaxed bounds and improve their diagnostics Scaffolding for https://github.com/rust-lang/rust/issues/135229 (CC https://github.com/rust-lang/rust/pull/135331) Fixes https://github.com/rust-lang/rust/issues/136944 (6th commit). Fixes https://github.com/rust-lang/rust/issues/142718 (8th commit).
2025-07-18Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-deadMatthias Krüger-21/+25
Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ```@fee1-dead``` cc rust-lang/rust#143800
2025-07-18Don't reject *multiple* relaxed bounds, reject *duplicate* ones.León Orell Valerian Liehr-30/+0
Having multiple relaxed bounds like `?Sized + ?Iterator` is actually *fine*. We actually want to reject *duplicate* relaxed bounds like `?Sized + ?Sized` because these most certainly represent a user error. Note that this doesn't mean that we accept more code because a bound like `?Iterator` is still invalid as it's not relaxing a *default* trait and the only way to define / use more default bounds is under the experimental and internal feature `more_maybe_bounds` plus `lang_items` plus unstable flag `-Zexperimental-default-bounds` (historical context: for the longest time, bounds like `?Iterator` were actually allowed and lead to a hard warning). Ultimately, this simply *reframes* the diagnostic. The scope of `more_maybe_bounds` / `-Zexperimental-default-bounds` remains unchanged as well.
2025-07-18Reword diagnostic about relaxing non-`Sized` boundLeón Orell Valerian Liehr-49/+4
* The phrasing "only does something for" made sense back when this diagnostic was a (hard) warning. Now however, it's simply a hard error and thus completely rules out "doing something". * The primary message was way too long * The new wording more closely mirrors the wording we use for applying other bound modifiers (like `const` and `async`) to incompatible traits. * "all other traits are not bound by default" is no longer accurate under Sized Hierarchy. E.g., traits and assoc tys are (currently) bounded by `MetaSized` by default but can't be relaxed using `?MetaSized` (instead, you relax it by adding `PointeeSized`). * I've decided against adding any diagnositic notes or suggestions for now like "trait `Trait` can't be relaxed as it's not bound by default" which would be incorrect for `MetaSized` and assoc tys as mentioned above) or "consider changing `?MetaSized` to `PointeeSized`" as the Sized Hierarchy impl is still WIP)
2025-07-18Reword diagnostics about relaxed bounds in invalid contextsLeón Orell Valerian Liehr-122/+3
2025-07-18AST lowering: More robustly deal with relaxed boundsLeón Orell Valerian Liehr-1/+1
2025-07-18HIR ty lowering: Validate relaxed bounds in trait object typesLeón Orell Valerian Liehr-2/+27
Only relevant to the internal feature `more_maybe_bounds`.
2025-07-18HIR ty lowering: Simplify signature of `lower_poly_trait_ref`León Orell Valerian Liehr-6/+37
2025-07-17Make slices `[const] PartialEq`Oli Scherer-21/+24
2025-07-17Make `derive_const` usable within libcore againOli Scherer-0/+1
Also make it *only* usable on nightly
2025-07-17parse `const trait Trait`Deadbeef-139/+137
2025-07-17Rollup merge of #144016 - davidtwco:sized-hierarchy-temp-pseudo-revert, r=lcnrLeón Orell Valerian Liehr-10/+2
trait_sel: `MetaSized` always holds temporarily As a temporary measure while a proper fix for `tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs` is implemented, make `MetaSized` obligations always hold. In effect, temporarily reverting the `sized_hierarchy` feature. This is a small change that can be backported. cc rust-lang/rust#143992 r? ```@lcnr```
2025-07-17Rollup merge of #143895 - compiler-errors:trait-wc-item-bound-host-eff, ↵León Orell Valerian Liehr-0/+32
r=oli-obk Dont collect assoc ty item bounds from trait where clause for host effect predicates For background, we uplift `where Self::Assoc: Trait` bounds in a trait's where clauses into *item bounds* on `type Assoc;`. This is because before we *had* syntactical item bounds, users would express their item bounds like so. Let's opt out of doing this same behavior for `HostEffect` predicates like `where Self::Assoc: [const] Trait`. I left a comment in the code: ```rust // FIXME(const_trait_impl): We *could* uplift the // `where Self::Assoc: [const] Trait` bounds from the parent trait // here too, but we'd need to split `const_conditions` into two // queries (like we do for `trait_explicit_predicates_and_bounds`) // since we need to also filter the predicates *out* of the const // conditions or they lead to cycles in the trait solver when // utilizing these bounds. For now, let's do nothing. ``` As an aside, this was an ICE that was only triggerable when building libraries and not binaries because we never were calling `tcx.ensure_ok().explicit_implied_const_bounds(def_id);` on associated types like we should have been. I adjusted the calls to `ensure_ok` to make sure this happens, so we catch bugs like this in the future more easily. As another aside, I fixed the bound uplifting logic for *always const* predicates, since those act like normal clauses and have no notion of conditional constness. r? ```@oli-obk``` ```@fee1-dead``` or anyone really Fixes rust-lang/rust#133275
2025-07-16trait_sel: `MetaSized` always holds temporarilyDavid Wood-10/+2
As a temporary measure while a proper fix for `tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs` is implemented, make `MetaSized` obligations always hold. In effect, temporarily reverting the `sized_hierarchy` feature. This is a small change that can be backported.
2025-07-16future-incompat lints: don't link to the nightly edition-guide versiondianne-8/+8
2025-07-15Rollup merge of #143927 - oli-obk:const-dyn-trait-hir-ty, r=fmeaseSamuel Tardieu-2/+26
Preserve constness in trait objects up to hir ty lowering r? ``@compiler-errors`` While we don't support `dyn const Trait`, we can at least also inform the user that `const Trait` is only legal for `#[const_trait] trait Trait {}`
2025-07-14Preserve constness in trait objects up to hir ty loweringOli Scherer-2/+26
2025-07-14Rollup merge of #143875 - fee1-dead-contrib:push-zvqrmzrprpzt, r=compiler-errorsJakub Beránek-29/+29
update issue number for `const_trait_impl` r? project-const-traits cc rust-lang/rust#67792 rust-lang/rust#143874
2025-07-13Auto merge of #143357 - cjgillot:no-assoc-item-kind, r=compiler-errorsbors-5/+5
Retire hir::*ItemRef. This information was kept for various places that iterate on HIR to know about trait-items and impl-items. This PR replaces them by uses of the `associated_items` query that contain pretty much the same information. This shortens many spans to just `def_span`, which can be easier to read.
2025-07-13Imply always-const host effects the same as any other item boundMichael Goulet-0/+19
2025-07-13Dont collect assoc ty item bounds from trait where clause for host effect ↵Michael Goulet-0/+13
predicates
2025-07-13update issue number for `const_trait_impl`Deadbeef-29/+29
2025-07-13Retire hir::*ItemRef.Camille GILLOT-5/+5
2025-07-13Rollup merge of #143774 - oli-obk:const_from, r=fee1-deadMatthias Krüger-32/+2
constify `From` and `Into` tracking issue rust-lang/rust#143773 r? ``````@fee1-dead`````` I did not mark any impls elsewhere as `const`, those can happen on their own timeframe and don't need to be part of this MVP. But if there are some core ones you think should be in there I'll happily add them, just couldn't think of any
2025-07-13Rollup merge of #143301 - Kivooeo:tf26, r=tgross35Matthias Krüger-0/+50
`tests/ui`: A New Order [26/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ````@tgross35````