summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval
AgeCommit message (Collapse)AuthorLines
2021-07-15tweak pointer out-of-bounds error messageRalf Jung-4/+4
2021-07-14more precise message for the ptr access check on derefRalf Jung-2/+2
2021-07-14adjust testsRalf Jung-82/+72
2021-07-10remove duplicate testRalf Jung-15/+0
2021-07-10remove const_raw_ptr_to_usize_cast featureRalf Jung-34/+17
2021-07-09Use #[track_caller] in const panic diagnostics.Mara Bos-0/+38
It was already used for the message. This also uses it for the spans used for the error and backtrace.
2021-07-06Add s to non_fmt_panicRyan Levick-1/+1
2021-06-28Bless the test suite.Charles Lew-2/+2
2021-06-18bless youRalf Jung-160/+61
2021-06-17Rollup merge of #86340 - Smittyvb:ctfe-hard-error-message, r=RalfJungYuki Okushi-79/+48
Use better error message for hard errors in CTFE I noticed this while working on #86255: currently the same message is used for hard errors and soft errors in CTFE. This changes the error messages to make hard errors use a message that indicates the reality of the situation correctly, since usage of the constant is never allowed when there was a hard error evaluating it. This doesn't affect the behaviour of these error messages, only the content. This changes the error logic to check if the error should be hard or soft where it is generated, instead of where it is emitted, to allow this distinction in error messages.
2021-06-15Use better error message for hard errors in CTFESmitty-79/+48
Currently the same message is used for hard errors and soft errors. This makes hard errors use a message that indicates the reality of the situation correctly, since usage of the constant is never allowed when there was a hard error evaluating it.
2021-06-13update tests involving CTFE validationRémy Rakic-79/+79
2021-06-13Test invalid vtable size/alignment const UB errorsRémy Rakic-27/+129
2021-06-09detect incorrect vtable alignment during const eval instead of ICE-ingRémy Rakic-0/+48
also add tests for these 2 kinds of errors for size and alignment, as the existing size check wasn't apparently tested
2021-05-30Emit a hard error when a panic occurs during const-evalAaron Hill-119/+52
Previous, a panic during const evaluation would go through the `const_err` lint. This PR ensures that such a panic always causes compilation to fail.
2021-05-28const eval errors: display the current item instance if there are generics ↵Rémy Rakic-2/+2
involved
2021-05-27don't trim paths in collector PME messageRémy Rakic-2/+2
2021-05-25add test for issue 85155 and similarRémy Rakic-0/+56
This test reproduces post-monomorphization errors one can encounter when using incorrect immediate arguments to some of the stdarch intrinsics using const generics.
2021-05-15get rid of a bunch of unnecessary NOTE in const testsRalf Jung-5/+2
2021-05-13Auto merge of #85110 - RalfJung:no-rustc_args_required_const, r=oli-obkbors-17/+0
Remove rustc_args_required_const attribute Now that stdarch no longer needs it (thanks `@Amanieu!),` we can kill the `rustc_args_required_const` attribute. This means that lifetime extension of references to temporaries is the only remaining job that promotion is performing. :-) r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/69493
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-19/+19
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-05-12entirely remove rustc_args_required_const attributeRalf Jung-17/+0
2021-05-09more erroneous-const testsRalf Jung-3/+63
2021-05-09ensure failing promoteds in const/static bodies are handled correctlyRalf Jung-16/+38
2021-05-07bless 32bitRalf Jung-1/+1
2021-05-07fix null pointer error messagesRalf Jung-1/+1
2021-05-0632bit blessRalf Jung-1/+1
2021-05-06use CheckInAllocMsg::PointerArithmeticTest for ptr_offset errorRalf Jung-1/+1
2021-05-02Change 'NULL' to 'null'Brent Kerby-9/+9
2021-04-29re-bless on 32bitRalf Jung-7/+7
2021-04-29remove const_fn feature gate from const testsRalf Jung-41/+30
2021-04-18move 'trait bounds on const fn' to separate feature gateRalf Jung-1/+1
2021-04-02Auto merge of #76881 - hameerabbasi:issue-53325, r=oli-obkbors-100/+1263
Add allocation information to undefined behaviour errors. So far I'm looking on information on whether the error messages are suitable. Fixes #53325.
2021-04-01Limit the problematic tests to x86_64.Hameer Abbasi-63/+2
2021-03-31Revert testsOli Scherer-11/+8
2021-03-31Add a new normalization query just for mir constantsOli Scherer-10/+13
2021-03-31Add 32bit.stderr files.Hameer Abbasi-0/+969
2021-03-31Rename stderr->64bit.stderr where needed.Hameer Abbasi-102/+115
2021-03-31Add allocation information to undefined behaviour errors.Hameer Abbasi-0/+242
2021-02-16add testRalf Jung-10/+37
2021-02-08Rollup merge of #81779 - geogriff:const-ptr-to-int-error, r=lcnrMara Bos-1/+1
improve error message for disallowed ptr-to-int casts in const eval Improves an error message as [suggested](https://github.com/rust-lang/rust/issues/80875#issuecomment-762754580) in #80875. Does the wording make enough sense? I tried to follow precedent for error message style while maintaining brevity. It seems like the rest of the `ConstEvalErrKind::NeedsRfc` error messages could be improved as well. I could give that a go if this approach works. Closes #80875
2021-02-07Auto merge of #80652 - calebzulawski:simd-lanes, r=nagisabors-3/+7
Improve SIMD type element count validation Resolves rust-lang/stdsimd#53. These changes are motivated by `stdsimd` moving in the direction of const generic vectors, e.g.: ```rust #[repr(simd)] struct SimdF32<const N: usize>([f32; N]); ``` This makes a few changes: * Establishes a maximum SIMD lane count of 2^16 (65536). This value is arbitrary, but attempts to validate lane count before hitting potential errors in the backend. It's not clear what LLVM's maximum lane count is, but cranelift's appears to be much less than `usize::MAX`, at least. * Expands some SIMD intrinsics to support arbitrary lane counts. This resolves the ICE in the linked issue. * Attempts to catch invalid-sized vectors during typeck when possible. Unresolved questions: * Generic-length vectors can't be validated in typeck and are only validated after monomorphization while computing layout. This "works", but the errors simply bail out with no context beyond the name of the type. Should these errors instead return `LayoutError` or otherwise provide context in some way? As it stands, users of `stdsimd` could trivially produce monomorphization errors by making zero-length vectors. cc `@bjorn3`
2021-02-05fix ui tests referencing pointer-to-integer cast error messageJeffrey Griffin-1/+1
2021-02-03Allow/fix non_fmt_panic in tests.Mara Bos-20/+21
2021-02-03make const_err a future incompat lintRalf Jung-117/+431
2021-02-01Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkovbors-7/+7
Implement Rust 2021 panic This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007. It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller. This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: https://github.com/rust-lang/rust/pull/80879/commits/c5273bdfb266c35e8eab9413aa8d58d27fdbe114 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.
2021-01-29Rollup merge of #81333 - RalfJung:const-err-simplify, r=oli-obkYuki Okushi-39/+25
clean up some const error reporting around promoteds These are some error reporting simplifications enabled by https://github.com/rust-lang/rust/pull/80579. Further simplifications are possible but could be blocked on making `const_err` a hard error. r? ``````@oli-obk``````
2021-01-25Implement new panic!() behaviour for Rust 2021.Mara Bos-7/+7
2021-01-24Rollup merge of #78578 - oli-obk:const_mut_refs, r=RalfJungJonas Schievink-3/+6
Permit mutable references in all const contexts fixes #71212 cc `@rust-lang/wg-const-eval` `@christianpoveda`
2021-01-24clean up some const error reporting around promotedsRalf Jung-39/+25