about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2020-04-12fix issue 69130David Renshaw-1/+1
2020-04-11rustc: Add a warning count upon completionRoccoDev-20/+44
2020-04-08Small tweaks to required bound spanEsteban Küber-2/+2
2020-04-08Use `PredicateObligation`s instead of `Predicate`sEsteban Küber-2/+2
Keep more information about trait binding failures.
2020-04-05add testRalf Jung-0/+14
2020-04-05add testRalf Jung-0/+10
2020-04-03Rollup merge of #70696 - jumbatm:extend-issue-69020-test, r=RalfJungDylan DPC-119/+0
Extend #69020 test to include reversed operand order. Make sure we still emit if a lint if the generic argument comes first. See https://github.com/rust-lang/rust/pull/70566#issuecomment-607671340. r? @RalfJung
2020-04-02Move #69020 test to ui/associated-const + rebless.jumbatm-137/+0
2020-04-02Extend #69020 test to include reversed order.jumbatm-0/+18
Make sure we check the case where the generic operand comes first, in case any future changes make this ordering matter.
2020-04-02tests: remove ignore directives from tests that mention core/alloc/std spans.Eduard-Mihai Burtescu-30/+17
2020-04-01Rollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obkDylan DPC-74/+148
Miri: make backtrace function names and spans match up Currently, Miri backtraces are a bit confusing: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside call to `f` | ^^^^ = note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73 = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5 ``` When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*. This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows: ``` error: Undefined Behavior: entering unreachable code --> tests/compile-fail/never_transmute_void.rs:10:11 | 10 | match v {} //~ ERROR entering unreachable code | ^ entering unreachable code | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11 note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5 --> tests/compile-fail/never_transmute_void.rs:17:5 | 17 | f(v); //~ inside `main` | ^^^^ = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34 = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73 = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5 ``` Now function name and printed line numbers match up in the notes. This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside. With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used). r? @oli-obk
2020-04-01Rollup merge of #70081 - lcnr:issue68387, r=varkorDylan DPC-1/+1
add `unused_braces` lint Add the lint `unused_braces` which is warn by default. `unused_parens` is also extended and now checks anon consts. closes #68387 r? @varkor
2020-03-31update testsBastian Kauschke-1/+1
2020-03-31const backtrace: do not skip first frameRalf Jung-1/+12
2020-03-30bless testsRalf Jung-73/+136
2020-03-27non-exhastive diagnostic: add note re. scrutinee typeMazdak Farrokhzad-0/+15
2020-03-25Rollup merge of #70319 - lcnr:issue63695, r=eddybDylan DPC-1/+1
correctly normalize constants closes #70317 implements https://github.com/rust-lang/rust/issues/70125#issuecomment-602133708 r? eddyb cc @varkor
2020-03-24improve normalize cycle errorBastian Kauschke-1/+1
2020-03-24get back the more precise error messageRalf Jung-1/+1
2020-03-24bless; add test for mutating a staticRalf Jung-4/+48
2020-03-24Rollup merge of #70087 - ecstatic-morse:remove-const-eval-loop-detector, ↵Mazdak Farrokhzad-70/+46
r=RalfJung Remove const eval loop detector Now that there is a configurable instruction limit for CTFE (see #67260), we can replace the loop detector with something much simpler. See #66946 for more discussion about this. Although the instruction limit is nightly-only, the only practical way to reach the default limit uses nightly-only features as well (although CTFE will still execute code using such features inside an array initializer on stable). This will at the very least require a crater run, since it will result in an error wherever the "long running const eval" warning appeared before. We may need to increase the default for `const_eval_limit` to work around this. Resolves #54384 cc #49980 r? @oli-obk cc @RalfJung
2020-03-23Remove leftover mentions of `from_anon_const`Oliver Scherer-1/+1
2020-03-23Evaluate repeat expression lengths as late as possibleOliver Scherer-39/+67
2020-03-22Rename `TimeLimitReached` -> `StepLimitReached`Dylan MacKenzie-3/+3
2020-03-21Rollup merge of #70126 - wesleywiser:fix_miri_ice_neg_zst_enum_discr, ↵Dylan DPC-0/+47
r=RalfJung,eddyb Fix ICE caused by truncating a negative ZST enum discriminant Fixes #70114 r? @oli-obk or @RalfJung
2020-03-21Fix ICE caused by truncating a negative ZST enum discriminantWesley Wiser-0/+47
2020-03-21Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJungMazdak Farrokhzad-0/+22
Remove the call that makes miri fail Fixes the concern raised in https://github.com/rust-lang/rust/pull/69645/files#r392884274 cc @RalfJung
2020-03-20Update const_forget.rsDutchGhost-1/+1
2020-03-18Move the const-forget test into ui testsDutchGhost-0/+22
2020-03-18Rollup merge of #69839 - RalfJung:miri-error-cleanup, r=oli-obkMazdak Farrokhzad-80/+80
Miri error reform Some time ago we started moving Miri errors into a few distinct categories, but we never classified all the old errors. That's what this PR does. ~~This is on top of https://github.com/rust-lang/rust/pull/69762; [relative diff](https://github.com/RalfJung/rust/compare/validity-errors...RalfJung:miri-error-cleanup).~~ r? @oli-obk Fixes https://github.com/rust-lang/const-eval/issues/4
2020-03-17Update const-eval testsDylan MacKenzie-70/+46
2020-03-17Update tests for erasing regions in typeckMatthew Jasper-1/+1
2020-03-16Auto merge of #67133 - oli-obk:it_must_be_a_sign, r=eddybbors-1/+1
Deduplicate pretty printing of constants r? @eddyb for the pretty printing logic cc @RalfJung
2020-03-13Auto merge of #67502 - Mark-Simulacrum:opt-catch, r=Mark-Simulacrumbors-2/+0
Optimize catch_unwind to match C++ try/catch This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown. https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is *exactly the same* if `-Cpanic=abort` is passed, which is clearly not great. This PR, on the other hand, generates the following assembly: ```asm # -Cpanic=unwind: push rbx mov ebx,0x2a call QWORD PTR [rip+0x1c53c] # <happy> mov eax,ebx pop rbx ret mov rdi,rax call QWORD PTR [rip+0x1c537] # cleanup function call call QWORD PTR [rip+0x1c539] # <unfortunate> mov ebx,0xd mov eax,ebx pop rbx ret # -Cpanic=abort: push rax call QWORD PTR [rip+0x20a1] # <happy> mov eax,0x2a pop rcx ret ``` Fixes #64224, and resolves #64222.
2020-03-14Rollup merge of #69960 - RalfJung:abort, r=oli-obkYuki Okushi-1/+1
miri engine: fix treatment of abort intrinsic I screwed up in https://github.com/rust-lang/rust/pull/69830 and added `abort` to the wrong block of intrinsics, namely the one that actually has a return place. So that branch was never actually reached. r? @oli-obk
2020-03-13bless testsRalf Jung-1/+1
2020-03-12Move some more tests to `check-pass`LeSeulArtichaut-3/+6
2020-03-12Move some const-eval `build-pass` tests to `check-pass`LeSeulArtichaut-20/+20
2020-03-11make error message less confusingRalf Jung-24/+24
2020-03-11start Miri messages lower-caseRalf Jung-45/+45
2020-03-11generalize InvalidNullPointerUsage to InvalidIntPointerUsageRalf Jung-3/+3
2020-03-11fmt, tweak messages and blessRalf Jung-32/+32
2020-03-11Rollup merge of #69825 - lcnr:discriminant, r=oli-obkMazdak Farrokhzad-0/+40
make `mem::discriminant` const implements #69821, which could be used as a tracking issue for `const_discriminant`. Should this be added to the meta tracking issue #57563? @Lokathor
2020-03-11Rollup merge of #69373 - tspiteri:const_int_conversion, r=oli-obkMazdak Farrokhzad-2/+0
Stabilize const for integer {to,from}_{be,le,ne}_bytes methods All of these functions can be implemented simply and naturally as const functions, e.g. `u32::from_le_bytes` can be implemented as ```rust (bytes[0] as u32) | (bytes[1] as u32) << 8 | (bytes[2] as u32) << 16 | (bytes[3] as u32) << 24 ``` So stabilizing the constness will not expose that internally they are implemented using transmute which is not const in stable.
2020-03-11Deduplicate and clean up pretty printing logicOliver Scherer-1/+1
2020-03-10explain the use of a custom identity functionBastian Kauschke-0/+3
2020-03-10rustc_errors: Use ensure_source_file_source_present where necessary.Ana-Maria Mihalache-1/+1
2020-03-09discrimant test must not be inlined!Bastian Kauschke-0/+1
2020-03-08fix some cases of unexpected exceptions leaving validationRalf Jung-28/+48
2020-03-08allow dead code in discriminant testBastian Kauschke-0/+1