about summary refs log tree commit diff
path: root/tests/ui/traits
AgeCommit message (Collapse)AuthorLines
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-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````
2025-07-13Rollup merge of #143803 - RalfJung:const-trait-tracking, r=compiler-errorsLeón Orell Valerian Liehr-7/+7
New tracking issues for const_ops and const_cmp Let's do a clean start with new tracking issues to avoid mixing things up with the previous constification. I assume the fact that the `PartialEq` *trait* and *impls* used different feature names was a mistake (the feature name on the impl is entirely irrelevant anyway). Part of https://github.com/rust-lang/rust/issues/143800, https://github.com/rust-lang/rust/issues/143802 r? ``@oli-obk``
2025-07-13Rollup merge of #143778 - oli-obk:const-cleanup, r=fee1-deadLeón Orell Valerian Liehr-12/+4
Some const_trait_impl test cleanups Some tests we forgot to update when the feature gate was reimplemented r? ``@fee1-dead`` ``@compiler-errors``
2025-07-13cleaned up some testsKivooeo-3/+15
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
2025-07-13moved testsKivooeo-0/+38
2025-07-11fix PartialEq const feature name and const_cmp tracking issueRalf Jung-7/+7
2025-07-11Some const_trait_impl test cleanupsOli Scherer-12/+4
2025-07-11constify `From` and `Into`Oli Scherer-32/+2
2025-07-11Rollup merge of #143303 - Kivooeo:tf28, r=tgross35Matthias Krüger-0/+47
`tests/ui`: A New Order [28/28] FINAL PART > [!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``
2025-07-10Rollup merge of #143640 - oli-obk:const-fn-traits, r=compiler-errorsMatthias Krüger-285/+42
Constify `Fn*` traits r? `@compiler-errors` `@fee1-dead` this should unlock a few things. A few `const_closures` tests have broken even more than before, but that feature is marked as incomplete anyway cc rust-lang/rust#67792
2025-07-10cleaned up some testsKivooeo-2/+4
2025-07-10Rollup merge of #143298 - Kivooeo:tf23, r=tgross35Trevor Gross-0/+49
`tests/ui`: A New Order [23/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``
2025-07-08Rollup merge of #143499 - compiler-errors:predicates-of-crate, r=davidtwcoTrevor Gross-0/+37
Don't call `predicates_of` on a dummy obligation cause's body id See the test for a brief explanation Fixes rust-lang/rust#143481.
2025-07-08Constify `Fn*` traitsOli Scherer-285/+42
2025-07-08Auto merge of #134628 - estebank:const-default, r=oli-obkbors-101/+110
Make `Default` const and add some `const Default` impls Full list of `impl const Default` types: - () - bool - char - std::ascii::Char - usize - u8 - u16 - u32 - u64 - u128 - i8 - i16 - i32 - i64 - i128 - f16 - f32 - f64 - f128 - std::marker::PhantomData<T> - Option<T> - std::iter::Empty<T> - std::ptr::Alignment - &[T] - &mut [T] - &str - &mut str - String - Vec<T>
2025-07-07Make `Default` const and add some `const Default` implsEsteban Küber-101/+110
Full list of `impl const Default` types: - () - bool - char - Cell - std::ascii::Char - usize - u8 - u16 - u32 - u64 - u128 - i8 - i16 - i32 - i64 - i128 - f16 - f32 - f64 - f128 - std::marker::PhantomData<T> - Option<T> - std::iter::Empty<T> - std::ptr::Alignment - &[T] - &mut [T] - &str - &mut str - String - Vec<T>
2025-07-07Point to correct argument in Func Call when Self type fails trait boundxizheyin-3/+3
When a trait bound fails due to the Self type parameter, adjust_fulfillment_errors now correctly points to the corresponding function argument instead of incorrectly pointing to other arguments. Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-05Rename tests named with `mbe` to use `macro` insteadJosh Triplett-6/+6
Most macro tests use `macro` in the name, making it easy to find and run tests relevant to macros. However, a few use `mbe` instead. Rename those to say `macro`.
2025-07-05Don't call predicates_of on a dummy obligation cause's body idMichael Goulet-0/+37
2025-07-05Auto merge of #143473 - workingjubilee:rollup-bxie7zg, r=scottmcmbors-0/+161
Rollup of 11 pull requests Successful merges: - rust-lang/rust#142440 (`tests/ui`: A New Order [14/N]) - rust-lang/rust#143040 (Add `const Rem`) - rust-lang/rust#143086 (Update poison.rs to fix the typo (sys->sync)) - rust-lang/rust#143202 (`tests/ui`: A New Order [18/N]) - rust-lang/rust#143296 (`tests/ui`: A New Order [21/N]) - rust-lang/rust#143297 (`tests/ui`: A New Order [22/N]) - rust-lang/rust#143299 (`tests/ui`: A New Order [24/N]) - rust-lang/rust#143300 (`tests/ui`: A New Order [25/N]) - rust-lang/rust#143397 (test passing a `VaList` from rust to C) - rust-lang/rust#143410 (Block SIMD in transmute_immediate; delete `OperandValueKind`) - rust-lang/rust#143452 (Fix CLI completion check in `tidy`) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-04Rollup merge of #143300 - Kivooeo:tf25, r=tgross35Jubilee-0/+13
`tests/ui`: A New Order [25/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`
2025-07-04Rollup merge of #143297 - Kivooeo:tf22, r=tgross35Jubilee-0/+45
`tests/ui`: A New Order [22/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`
2025-07-04Rollup merge of #143296 - Kivooeo:tf21, r=tgross35Jubilee-0/+103
`tests/ui`: A New Order [21/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`
2025-07-05cleaned up some testsKivooeo-5/+7