about summary refs log tree commit diff
path: root/tests/ui/traits/const-traits
AgeCommit message (Collapse)AuthorLines
2025-09-12Constify Eq, Ord, PartialOrdEvgenii Zheltonozhskii-33/+2
2025-09-10Less greedily parse `[const]` boundsLeón Orell Valerian Liehr-0/+25
2025-09-10Restore the test intention of several MBE trait bound modifier testsLeón Orell Valerian Liehr-85/+107
2025-09-06clean up some old const trait impl syntaxNathaniel McCallum-4/+4
2025-09-01Constify conversion traitsltdk-3/+3
2025-08-21next-solver fix const_trait_impl bootstraplcnr-0/+53
2025-08-21Rollup merge of #145627 - compiler-errors:const-supertrait-dyn-compat, ↵Jacob Pratt-0/+36
r=fee1-dead Unconditionally-const supertraits are considered not dyn compatible Let's save some space in the design of const traits by making `dyn Trait` where `trait Trait: const Super` not dyn compatible. Such a trait cannot satisfy `dyn Trait: Trait`; we could in the future make this dyn compatible but *NOT* implement `Trait`, but that's a bit weird and seems like it needs to be independently justified moving forward. Fixes https://github.com/rust-lang/rust/issues/145198 r? fee1-dead
2025-08-20Unconditionally-const supertraits are considered not dyn compatibleMichael Goulet-0/+36
2025-08-19bless tests with new lint messagesKarol Zwolak-1/+1
2025-08-15fix: Reject async assoc fns of const traits/impls in ast_passesShoyu Vanilla-0/+36
2025-08-14Update uitestsJonathan Brouwer-12/+12
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-11Tweak trait modifier errorsCameron Steffen-11/+11
2025-08-11Move trait impl modifier errors to parsingCameron Steffen-11/+11
This is a technically a breaking change for what can be parsed in `#[cfg(false)]`.
2025-08-08Clean up some resolved test regressions of const trait removals in stdShoyu Vanilla-4/+4
2025-08-06Rollup merge of #144956 - fmease:gate-const-trait-syntax, r=BoxyUwUGuillaume Gomez-3/+26
Gate const trait syntax Missed this during my review of rust-lang/rust#143879, huge apologies! Fixes [after beta backport] https://github.com/rust-lang/rust/issues/144958. cc ``@fee1-dead`` r? ``@BoxyUwU`` or anyone
2025-08-06Rollup merge of #144910 - ShoyuVanilla:add-regression-tests, r=fee1-deadJakub Beránek-0/+73
Add regression tests for seemingly fixed issues Closes rust-lang/rust#104314 Closes rust-lang/rust#125866
2025-08-05Add regression tests for seemingly fixed issuesShoyu Vanilla-0/+73
2025-08-05Gate const trait syntaxLeón Orell Valerian Liehr-3/+26
2025-08-04fix: Error on illegal `[const]`s inside blocks within legal positionsShoyu Vanilla-26/+85
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-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-25Update ui tests with new macro early erroringGuillaume Gomez-29/+42
2025-07-23Add `ignore-backends` annotations in failing GCC backend ui testsGuillaume Gomez-16/+17
2025-07-21Constify Try, From, TryFromEvgenii Zheltonozhskii-117/+12
2025-07-18Rollup merge of #142693 - fmease:unbound-bettering, r=compiler-errorsMatthias Krüger-6/+37
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-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 #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-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-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-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 #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-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-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-08Constify `Fn*` traitsOli Scherer-285/+42
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-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-02Rollup merge of #143235 - compiler-errors:const-item-bound, r=oli-obkMatthias Krüger-0/+19
Assemble const bounds via normal item bounds in old solver too Fixes the first example in https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/elaboration.20of.20const.20bounds.3F/with/526378135 The code duplication here is not that nice, but it's at least very localized. cc `@davidtwco` r? oli-obk
2025-06-30Replace `ItemCtxt::report_placeholder_type_error` `match` with a call to ↵Guillaume Gomez-1/+1
`TyCtxt::def_descr`
2025-06-30Assemble const bounds via normal item bounds in old solver tooMichael Goulet-0/+19
2025-06-29Fix the span of trait bound modifier `[const]`León Orell Valerian Liehr-215/+215