about summary refs log tree commit diff
path: root/tests/ui/consts
AgeCommit message (Collapse)AuthorLines
2025-07-21Constify Try, From, TryFromEvgenii Zheltonozhskii-113/+43
2025-07-19Auto merge of #144145 - matthiaskrgr:rollup-swc74s4, r=matthiaskrgrbors-95/+186
Rollup of 9 pull requests Successful merges: - rust-lang/rust#138554 (Distinguish delim kind to decide whether to emit unexpected closing delimiter) - rust-lang/rust#142673 (Show the offset, length and memory of uninit read errors) - rust-lang/rust#142693 (More robustly deal with relaxed bounds and improve their diagnostics) - rust-lang/rust#143382 (stabilize `const_slice_reverse`) - rust-lang/rust#143928 (opt-dist: make llvm builds optional) - rust-lang/rust#143961 (Correct which exploit mitigations are enabled by default) - rust-lang/rust#144050 (Fix encoding of link_section and no_mangle cross crate) - rust-lang/rust#144059 (Refactor `CrateLoader` into the `CStore`) - rust-lang/rust#144123 (Generalize `unsize` and `unsize_into` destinations) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-18Rollup merge of #142673 - oli-obk:uninit-read-mem, r=RalfJungMatthias Krüger-95/+186
Show the offset, length and memory of uninit read errors r? ``@RalfJung`` I want to improve memory dumps in general. Not sure yet how to do so best within rust diagnostics, but in a perfect world I could generate a dummy in-memory file (that contains the rendered memory dump) that we then can then provide regular rustc `Span`s to. So we'd basically report normal diagnostics for them with squiggly lines and everything.
2025-07-18Auto merge of #143845 - cjgillot:stability-query, r=jieyouxubors-24/+24
Split-up stability_index query This PR aims to move deprecation and stability processing away from the monolithic `stability_index` query, and directly implement `lookup_{deprecation,stability,body_stability,const_stability}` queries. The basic idea is to: - move per-attribute sanity checks into `check_attr.rs`; - move attribute compatibility checks into the `MissingStabilityAnnotations` visitor; - progressively dismantle the `Annotator` visitor and the `stability_index` query. The first commit contains functional change, and now warns when `#[automatically_derived]` is applied on a non-trait impl block. The other commits should not change visible behaviour. Perf in https://github.com/rust-lang/rust/pull/143845#issuecomment-3066308630 shows small but consistent improvement, except for unused-warnings case. That case being a stress test, I'm leaning towards accepting the regression. This PR changes `check_attr`, so has a high conflict rate on that file. This should not cause issues for review.
2025-07-18Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-deadMatthias Krüger-6/+7
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-18Show the memory of uninit readsOli Scherer-79/+170
2025-07-17Check stability attributes are compatible in `check_unused_or_stable_features`.Camille GILLOT-24/+24
2025-07-17Report the range of uninit bytes in CTFE errorsOli Scherer-16/+16
2025-07-17Make slices `[const] PartialEq`Oli Scherer-2/+2
2025-07-17Auto merge of #143879 - fee1-dead-contrib:push-lrlpoouyqqry, r=fmeasebors-8/+8
parse `const trait Trait` r? oli-obk or anyone from project-const-traits cc `@rust-lang/project-const-traits`
2025-07-17Make `derive_const` usable within libcore againOli Scherer-4/+5
Also make it *only* usable on nightly
2025-07-17parse `const trait Trait`Deadbeef-8/+8
2025-07-17Rollup merge of #143975 - RalfJung:type-id-eq, r=oli-obkMatthias Krüger-10/+9
type_id_eq: check that the hash fully matches the type The previous logic wouldn't always detect when the hash mismatches the provenance. Fix that by adding a new helper, `read_type_id`, that reads a single type ID while fully checking it for validity and consistency. r? ``@oli-obk``
2025-07-17Rollup merge of #144016 - davidtwco:sized-hierarchy-temp-pseudo-revert, r=lcnrLeón Orell Valerian Liehr-33/+9
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 #143595 - fee1-dead-contrib:push-sylpykzkmynr, ↵León Orell Valerian Liehr-26/+201
r=RalfJung,fee1-dead add `const_make_global`; err for `const_allocate` ptrs if didn't call Implements as discussed on Zulip: [#t-compiler/const-eval > const heap](https://rust-lang.zulipchat.com/#narrow/channel/146212-t-compiler.2Fconst-eval/topic/const.20heap/with/527125421) r? ```@rust-lang/wg-const-eval``` Fixes https://github.com/rust-lang/rust/issues/129233
2025-07-16Rollup merge of #143921 - oli-obk:const-index, r=fee1-deadSamuel Tardieu-16/+30
Constify `Index` traits tracking issue: rust-lang/rust#143775 the `SliceIndex` trait cannot be implemented by users as it is sealed. While it would be useful for the `get` method on slices, it seems weird to have a feature gate for that that isn't also gating index syntax at the same time, so I put them under the same feature gate. r? ```````@fee1-dead```````
2025-07-16Rollup merge of #143692 - RalfJung:miri-oob, r=oli-obkSamuel Tardieu-10/+10
miri: fix out-of-bounds error for ptrs with negative offsets r? ```````@oli-obk```````
2025-07-16const heap: fix ICE on forgotten make_globalRalf Jung-12/+5
2025-07-16trait_sel: `MetaSized` always holds temporarilyDavid Wood-33/+9
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-16type_id_eq: check that the hash fully matches the typeRalf Jung-10/+9
2025-07-16Comment more code and make tests clearerDeadbeef-11/+24
Co-Authored-By: Ralf Jung <post@ralfj.de>
2025-07-16add `const_make_global`; err for `const_allocate` ptrs if didn't callDeadbeef-8/+177
Co-Authored-By: Ralf Jung <post@ralfj.de> Co-Authored-By: Oli Scherer <github333195615777966@oli-obk.de>
2025-07-15Rollup merge of #143736 - oli-obk:uninspectable-type-id, r=RalfJungSamuel Tardieu-3/+42
Give all bytes of TypeId provenance This makes all bytes of TypeId uninspectable at compile-time. For context see https://github.com/rust-lang/rust/issues/77125#issuecomment-3057049217 r? ``@RalfJung``
2025-07-15constify `Index` trait and its slice implsOli Scherer-9/+22
2025-07-15constify some methods using `SliceIndex`Oli Scherer-7/+8
2025-07-14Rollup merge of #143875 - fee1-dead-contrib:push-zvqrmzrprpzt, r=compiler-errorsJakub Beránek-3/+3
update issue number for `const_trait_impl` r? project-const-traits cc rust-lang/rust#67792 rust-lang/rust#143874
2025-07-14Give all bytes of TypeId provenanceOli Scherer-3/+42
2025-07-13update issue number for `const_trait_impl`Deadbeef-3/+3
2025-07-13Retire hir::*ItemRef.Camille GILLOT-7/+4
2025-07-13Rollup merge of #143803 - RalfJung:const-trait-tracking, r=compiler-errorsLeón Orell Valerian Liehr-14/+15
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-14/+15
2025-07-11Rollup merge of #143302 - Kivooeo:tf27, r=tgross35Matthias Krüger-0/+26
`tests/ui`: A New Order [27/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-10Rollup merge of #143742 - estebank:borrow-suggestion, r=compiler-errorsTrevor Gross-4/+16
Rework borrowing suggestions to use `Expr` instead of just `Span` In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`. (We were already doing this, but only for a subset of cases.) This now better handles situations where parentheses and `<>` are needed for correct syntax (`&(foo + bar)`, `(&foo).bar()`, `<&Foo>::bar()`, etc.). Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases. (Instead of having two branches for emitting the suggestion, we now have a single one, using `Diag::multipart_suggestions` always.) Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`. Fix rust-lang/rust#143393. Make `Diag::multipart_suggestions` always verbose. CC rust-lang/rust#141973.
2025-07-10Rollup merge of #143640 - oli-obk:const-fn-traits, r=compiler-errorsMatthias Krüger-202/+5
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-10Rework borrowing suggestions to use `Expr` instead of just `Span`Esteban Küber-4/+16
In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`. Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases. Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`.
2025-07-10cleaned up some testsKivooeo-2/+4
2025-07-09miri: fix out-of-bounds error for ptrs with negative offsetsRalf Jung-10/+10
2025-07-09Add opaque TypeId handles for CTFEOli Scherer-23/+125
2025-07-08Constify `Fn*` traitsOli Scherer-202/+5
2025-07-07Make `Default` const and add some `const Default` implsEsteban Küber-7/+7
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-01Auto merge of #143287 - GuillaumeGomez:rollup-fdjcti9, r=GuillaumeGomezbors-0/+21
Rollup of 12 pull requests Successful merges: - rust-lang/rust#136801 (Implement `Random` for tuple) - rust-lang/rust#141867 (Describe Future invariants more precisely) - rust-lang/rust#142760 (docs(fs): Touch up grammar on lock api) - rust-lang/rust#143181 (Improve testing and error messages for malformed attributes) - rust-lang/rust#143210 (`tests/ui`: A New Order [19/N] ) - rust-lang/rust#143212 (`tests/ui`: A New Order [20/N]) - rust-lang/rust#143230 ([COMPILETEST-UNTANGLE 2/N] Make some compiletest errors/warnings/help more visually obvious) - rust-lang/rust#143240 (Port `#[rustc_object_lifetime_default]` to the new attribute parsing …) - rust-lang/rust#143255 (Do not enable LLD by default in the dist profile) - rust-lang/rust#143262 (mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`) - rust-lang/rust#143269 (bootstrap: make comment more clear) - rust-lang/rust#143279 (Remove `ItemKind::descr` method) Failed merges: - rust-lang/rust#143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-01moved testsKivooeo-0/+24
2025-07-01Rollup merge of #143212 - Kivooeo:tf20, r=tgross35Guillaume Gomez-0/+21
`tests/ui`: A New Order [20/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-01Auto merge of #142030 - oli-obk:wfck-less-hir, r=compiler-errorsbors-9/+9
Start moving wf checking away from HIR I'm trying to only access the HIR in the error path. My hope is that once we move significant portions of wfcheck off HIR that incremental will be able to cache wfcheck queries significantly better. I think I am reaching a blocker because we normally need to provide good spans to `ObligationCause`, so that the trait solver can report good errors. In some cases I have been able to use bad spans and improve them depending on the `ObligationCauseCode` (by loading HIR in the case where we actually want to error). To scale that further we'll likely need to remove spans from the `ObligationCause` entirely (leaving it to some variants of `ObligationCauseCode` to have a span when they can't recompute the information later). Unsure this is the right approach, but we've already been using it. I will create an MCP about it, but that should not affect this PR, which is fairly limited in where it does those kind of tricks. Especially https://github.com/rust-lang/rust/commit/b862d8828e375ab8c128a9d9e93bf98b77cb5928 is interesting here, because I think it improves spans in all cases
2025-07-01cleaned up some testsKivooeo-5/+7
2025-06-30Don't look at static items' HIR for wfcheckOli Scherer-8/+8
2025-06-30Unconditionally run `check_item_type` on all itemsOli Scherer-1/+1
2025-06-30Remove the nullary intrinsic const eval logic and treat them like other ↵Oli Scherer-1/+1
intrinsics
2025-06-30moved testsKivooeo-0/+19
2025-06-29Fix the span of trait bound modifier `[const]`León Orell Valerian Liehr-34/+34