about summary refs log tree commit diff
path: root/tests/ui/consts/required-consts
AgeCommit message (Collapse)AuthorLines
2025-09-12ci: Increase `rust.debuginfo-level-tests` to `2` in `x86_64-gnu-debug` jobMartin Nordholts-8/+10
Simply to increase the scope of the testing. Force debuginfo=0 for a handful of tests so that we can have CI prevent regressing on more tests.
2025-08-06Add support for shortening `Instance` and use itEsteban Küber-8/+8
Replace ad-hoc type path shortening logic for recursive mono instantiation errors to use `tcx.short_string()` instead.
2025-06-07const-eval error: always say in which item the error occurredRalf Jung-2/+2
also adjust the wording a little so that we don't say "the error occurred here" for two different spans
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-31/+31
2025-06-02Use the informative error as the main const eval error messageOli Scherer-78/+78
2025-05-21Add some track_caller info to precondition panicsBen Kimock-6/+2
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-13/+17
2025-03-14Do not suggest using `-Zmacro-backtrace` for builtin macrosEsteban Küber-58/+0
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-0/+1
2025-02-28Shorten span of panic failures in const contextEsteban Küber-49/+41
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) ```
2024-04-23properly fill a promoted's required_constsRalf Jung-1/+89
then we can also make all_required_consts_are_checked a constant instead of a function
2024-03-21make sure we don't inline these generic fn as that could monomorphize themRalf Jung-6/+12
2024-03-20explicitly set opt-level=0Ralf Jung-94/+109
2024-03-20mentioned_items: record all callee and coerced closure types, whether they ↵Ralf Jung-2/+229
are FnDef/Closure or not They may become FnDef during monomorphization!
2024-03-20mentioned items: also handle closure-to-fn-ptr coercionsRalf Jung-0/+75
2024-03-20mentioned items: also handle vtablesRalf Jung-13/+32
2024-03-20fix comments in required-consts testsRalf Jung-34/+29
2024-03-20collector: recursively traverse 'mentioned' items to evaluate their constantsRalf Jung-25/+230
2024-03-14preserve span when evaluating mir::ConstOperandRalf Jung-0/+36
2024-03-13const-eval: organize and extend tests for required-constsRalf Jung-0/+476