about summary refs log tree commit diff
path: root/tests/ui/const-generics/issues
AgeCommit message (Collapse)AuthorLines
2025-09-24Improve derive suggestion of const paramtiif-2/+2
Make the suggestion not to remove the adt and use the name of the adt variant
2025-09-15Fix the testcases to not use UnsizedConstParamTytiif-1/+1
2025-08-19bless tests with new lint messagesKarol Zwolak-4/+4
2025-07-21Stabilize const `TypeId::of`Oli Scherer-3/+2
2025-07-13Rollup merge of #143803 - RalfJung:const-trait-tracking, r=compiler-errorsLeón Orell Valerian Liehr-1/+1
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-1/+1
2025-07-10chore: Improve how the other suggestions message gets renderedScott Schafer-1/+1
2025-07-09Add opaque TypeId handles for CTFEOli Scherer-25/+3
2025-06-30Avoid looking at HIR for trait and impl itemsOli Scherer-1/+1
2025-06-26Change const trait bound syntax from ~const to [const]Oli Scherer-2/+2
2025-06-20Rollup merge of #142485 - mu001999-contrib:dead-code/adt-pattern, r=petrochenkovTrevor Gross-2/+22
Marks ADT live if it appears in pattern Marks ADT live if it appears in pattern, it implies the construction of the ADT. 1. Then we can detect unused private ADTs impl `Default`, without special logics for `Default` and other std traits. 2. We can also remove `rustc_trivial_field_reads` on `Default`, and the logic in `should_ignore_item` (introduced by rust-lang/rust#126302). Fixes rust-lang/rust#120770 Extracted from rust-lang/rust#128637. r? `@petrochenkov`
2025-06-18Rollup merge of #141610 - BoxyUwU:stabilize_generic_arg_infer, ↵Jakub Beránek-15/+3
r=lcnr,traviscross Stabilize `feature(generic_arg_infer)` Fixes rust-lang/rust#85077 r? lcnr cc ````@rust-lang/project-const-generics````
2025-06-14Marks ADT live if it appears in patternMu001999-2/+22
2025-06-12Rollup merge of #142157 - Enselic:trivial-anon-const-use-cases, ↵Matthias Krüger-3/+3
r=compiler-errors rustc_resolve: Improve `resolve_const_param_in_non_trivial_anon_const` wording In some contexts, const expressions are OK. Add a `here` to the error message to clarify this. Closes rust-lang/rust#79429 which has 15 x 👍
2025-06-11stabilize gaiBoxy-15/+3
2025-06-07const-eval error: always say in which item the error occurredRalf Jung-1/+1
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-07rustc_resolve: Improve `resolve_const_param_in_non_trivial_anon_const` wordingMartin Nordholts-3/+3
In some contexts, const expressions are OK. Add a `here` to the error message to clarify this.
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-1/+1
2025-06-02Use the informative error as the main const eval error messageOli Scherer-3/+3
2025-05-21Fix testsBoxy-43/+197
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-3/+5
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-7/+7
2025-03-01Rollup merge of #137617 - BoxyUwU:generic_const_parameter_types, r=lcnrMatthias Krüger-30/+0
Introduce `feature(generic_const_parameter_types)` Allows to define const generic parameters whose type depends on other generic parameters, e.g. `Foo<const N: usize, const ARR: [u8; N]>;` Wasn't going to implement for this for a while until we could implement it with `bad_inference.rs` resolved but apparently the project simd folks would like to be able to use this for some intrinsics and the inference issue isn't really a huge problem there aiui. (cc ``@workingjubilee`` )
2025-03-01Rollup merge of #136503 - estebank:const-panic, r=RalfJungMatthias Krüger-12/+6
Tweak output of const panic diagnostic ### Shorten span of panic failures in const context Previously, we included a redundant prefix on the panic message and a postfix of the location of the panic. The prefix didn't carry any additional information beyond "something failed", and the location of the panic is redundant with the diagnostic's span, which gets printed out even if its code is not shown. ``` error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:11:9 | LL | MaybeUninit::<!>::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ panic: aborted execution: attempted to instantiate uninhabited type `!` ``` ``` error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-closure.rs:9:19 | LL | const C: () = panic!(); | ^^^^^^^^ explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` ``` error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:87:9 | LL | assert!(false); | ^^^^^^^^^^^^^^ assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) ``` ### Remove duplicated span from const eval frame list When the primary span for a const error is the same as the first frame in the const error report, skip it. ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ note: inside `_CONST` --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) note: erroneous constant encountered --> $DIR/issue-88434-removal-index-should-be-less.rs:3:23 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^^ ``` r? ``@oli-obk``
2025-02-28Introduce `feature(generic_const_parameter_types)`Boxy-30/+0
2025-02-28Shorten span of panic failures in const contextEsteban Küber-12/+6
Previously, we included a redundant prefix on the panic message and a postfix of the location of the panic. The prefix didn't carry any additional information beyond "something failed", and the location of the panic is redundant with the diagnostic's span, which gets printed out even if its code is not shown. ``` error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:11:9 | LL | MaybeUninit::<!>::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!` ``` ``` error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-closure.rs:9:19 | LL | const C: () = panic!(); | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` ``` error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:41:9 | LL | assert!(false); | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- When the primary span for a const error is the same as the first frame in the const error report, skip it. ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ evaluation panicked: explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ note: inside `_CONST` --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- Revert order of constant evaluation errors Point at the code the user wrote first and std functions last. ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ evaluation panicked: Some error occurred | note: called from `my_fn` --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Some error occurred | note: called from `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}` --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ```
2025-02-28normalizing where-clauses is also coinductive, add testslcnr-8/+68
2025-02-24Remove dyn_compatible_for_dispatchMichael Goulet-3/+20
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-3/+4
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-01-31Manually walk into WF obligations in BestObligation proof tree visitorMichael Goulet-20/+14
2025-01-28Properly check that array length is valid type during built-in unsizing in indexMichael Goulet-0/+31
2025-01-23Bless and add testsBoxy-9/+7
2025-01-18Revert "Rollup merge of #134371 - scottmcm:fix-134352, r=oli-obk"Rémy Rakic-23/+0
This reverts commit 7c301ecdf5e806b7aa3c44e4a185049fabbc4381, reversing changes made to dffaad83327454430129802f240121f8c7866208.
2025-01-06Add derived causes for host effect predicatesMichael Goulet-0/+18
2024-12-15Check for array lengths that aren't actually `usize`Scott McMurray-0/+23
2024-12-12Tweak multispan renderingEsteban Küber-3/+1
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-07Use trait name instead of full constraint in suggestion messageEsteban Küber-2/+2
``` help: consider restricting type parameter `T` with traits `Copy` and `Trait` | LL | fn duplicate_custom<T: Copy + Trait>(t: S<T>) -> (S<T>, S<T>) { | ++++++++++++++ ``` ``` help: consider restricting type parameter `V` with trait `Copy` | LL | fn index<'a, K, V: std::marker::Copy>(map: &'a HashMap<K, V>, k: K) -> &'a V { | +++++++++++++++++++ ```
2024-12-07reword trait bound suggestion message to include the boundsEsteban Küber-2/+2
2024-12-04Add comment to testBoxy-1/+2
2024-12-02Move `Const::{from_anon_const,try_from_lit}` to hir_ty_loweringNoah Lev-4/+21
These operations are much more about lowering the HIR than about `Const`s themselves. They fit better in hir_ty_lowering with `lower_const_arg` (formerly `Const::from_const_arg`) and the rest. To accomplish this, `const_evaluatable_predicates_of` had to be changed to not use `from_anon_const` anymore. Instead of visiting the HIR and lowering anon consts on the fly, it now visits the `rustc_middle::ty` data structures instead and directly looks for `UnevaluatedConst`s. This approach was proposed in: https://github.com/rust-lang/rust/pull/131081#discussion_r1821189257
2024-11-30Make compare_impl_item into a queryMichael Goulet-4/+4
2024-11-03Yeet effects featureMichael Goulet-4/+4
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-2/+2
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-10-26Deny calls to non-`#[const_trait]` methods in MIR constckDeadbeef-8/+0
2024-10-24Implement const effect predicate in new solverMichael Goulet-18/+0
2024-10-01Auto merge of #126839 - obeis:mpmc, r=Amanieubors-1/+1
Add multi-producer, multi-consumer channel (mpmc) Closes #125712 Tracking issue: #126840 r? m-ou-se
2024-09-30Add multi-producer, multi-consumer channel (mpmc)Obei Sideg-1/+1
2024-09-29fix(hir_analysis/wfcheck): don't leak {type error}Barrett Ray-40/+23
avoid `{type error}` being leaked in user-facing messages, particularly when using the `adt_const_params` feature
2024-09-24Ban combination of GCE and new solverMichael Goulet-1/+9
2024-09-15stabilize const_mut_refsRalf Jung-4/+3