summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2020-06-26Add regression test for #73431Dylan MacKenzie-0/+29
2020-06-02Fix commentRalf Jung-1/+1
Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
2020-06-01test miri-unleash TLS accessesRalf Jung-3/+55
2020-05-31Add descriptions for all queriesMatthew Jasper-1/+1
2020-05-30Rollup merge of #72772 - RalfJung:valid-char, r=petrochenkovRalf Jung-1/+1
miri validation: clarify valid values of 'char' The old text said "expected a valid unicode codepoint", which is not actually correct -- it has to be a scalar value (which is a code point that is not part of a surrogate pair).
2020-05-30miri validation: clarify valid values of 'char'Ralf Jung-1/+1
2020-05-27Add additional checks for isize overflowJoe Richey-2/+2
We now perform the correct checks even if the pointer size differs between the host and target. Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-26Add checks and tests for computing abs(offset_bytes)Joe Richey-1/+19
The previous code paniced if offset_bytes == i64::MIN. This commit: - Properly computes the absoulte value to avoid this panic - Adds a test for this edge case Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-25miri_unleached: We now allow offset in const fnJoe Richey-25/+6
Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-25test/ui/consts: Add tests for const ptr offsetsJoe Richey-0/+291
Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-21Auto merge of #72205 - ecstatic-morse:nrvo, r=oli-obkbors-0/+26
Dumb NRVO This is a very simple version of an NRVO pass, which scans backwards from the `return` terminator to see if there is an an assignment like `_0 = _1`. If a basic block with two or more predecessors is encountered during this scan without first seeing an assignment to the return place, we bail out. This avoids running a full "reaching definitions" dataflow analysis. I wanted to see how much `rustc` would benefit from even a very limited version of this optimization. We should be able to use this as a point of comparison for more advanced versions that are based on live ranges. r? @ghost
2020-05-19Rollup merge of #71886 - t-rapp:tr-saturating-funcs, r=dtolnayDylan DPC-1/+0
Stabilize saturating_abs and saturating_neg Stabilizes the following signed integer functions with saturation mechanics: * saturating_abs() * saturating_neg() Closes #59983
2020-05-17Don't unleash NRVO const-eval testDylan MacKenzie-32/+8
2020-05-16Test that Miri can handle MIR with NRVO appliedDylan MacKenzie-0/+50
2020-05-16Auto merge of #71665 - RalfJung:miri-intern-no-ice, r=oli-obkbors-179/+148
Miri interning: replace ICEs by proper errors Fixes https://github.com/rust-lang/rust/issues/71316 I also did some refactoring, as I kept being confused by all the parameters to `intern_shallow`, some of which have invalid combinations (such as a mutable const). So instead `InternMode` now contains all the information that is needed and invalid combinations are ruled out by the type system. Also I removed interpreter errors from interning. We already ignored almost all errors, and the `ValidationFailure` errors that we handled separately actually cannot ever happen here. The only interpreter failure that was actually reachable was the UB on dangling pointers -- and arguably, a dangling raw pointer is not UB, so the error was not even correct. It's just that the rest of the compiler does not like "dangling" `AllocId`. It should be possible to review the 3 commits separately. r? @oli-obk Cc @rust-lang/wg-const-eval
2020-05-14make sure even unleashed miri does not do pointer stuffRalf Jung-0/+68
2020-05-14Rollup merge of #71741 - RalfJung:pointer-print, r=oli-obkRalf Jung-14/+14
Pointer printing: do not print 0 offset r? @eddyb Cc @oli-obk
2020-05-12Pointer printing: do not print 0 offsetRalf Jung-14/+14
2020-05-12strings do not have to be valid UTF-8 any moreRalf Jung-8/+8
2020-05-10rebase falloutRalf Jung-5/+3
2020-05-10avoid raising interpreter errors from interningRalf Jung-11/+23
2020-05-10Miri interning: replace ICEs by proper errors, make intern_shallow type ↵Ralf Jung-168/+127
signature more precise
2020-05-09Rollup merge of #71185 - JohnTitor:run-fail, r=petrochenkovRalf Jung-0/+9
Move tests from `test/run-fail` to UI Fixes #65440 cc #65865 #65506 r? @nikomatsakis
2020-05-08Skip tests on emscriptenYuki Okushi-0/+1
2020-05-07use hex for pointers in Miri error messages; refine vtable error messageRalf Jung-3/+3
2020-05-06more precise vtable errorsRalf Jung-9/+9
2020-05-06convert remaining try_validation to new macroRalf Jung-5/+35
2020-05-06Move tests from `test/run-fail` to UIYuki Okushi-0/+8
2020-05-06add test for insufficiently aligned vtableRalf Jung-6/+16
2020-05-05Rollup merge of #71902 - mibac138:const-feature-diag, r=varkorDylan DPC-0/+12
Suggest to add missing feature when using gated const features Fixes #71797
2020-05-04Suggest to add missing feature when using gated const featuresmibac138-0/+12
2020-05-04Stabilize saturating_abs and saturating_negTobias Rapp-1/+0
Stabilizes the following signed integer functions with saturation mechanics: * saturating_abs() * saturating_neg() Closes #59983
2020-05-04Auto merge of #71751 - oli-obk:const_ice, r=RalfJungbors-0/+32
Move recursion check for zsts back to read site instead of access check site Reverts https://github.com/rust-lang/rust/pull/71140#discussion_r413709446 Fix #71612 Fix #71709 r? @RalfJung
2020-05-03Auto merge of #71631 - RalfJung:miri-unleash-the-gates, r=oli-obkbors-222/+330
Miri: unleash all feature gates IMO it is silly to unleash features that do not even have a feature gate yet, but not unleash features that do. The only thing this achieves is making unleashed mode annoying to use as we have to figure out the feature flags to enable (and not always do the error messages say what that flag is). Given that the point of `-Z unleash-the-miri-inside-of-you` is to debug the Miri internals, I see no good reason for this extra hurdle. I cannot imagine a situation where we'd use that flag, realize the program also requires some feature gate, and then be like "oh I guess if this feature is unstable I will do something else". Instead, we'll always just add that flag to the code as well, so requiring the flag achieves nothing. r? @oli-obk @ecstatic-morse Fixes https://github.com/rust-lang/rust/issues/71630
2020-05-03remove unneeded flags; exlain why we still have const_if_matchRalf Jung-27/+56
2020-05-03warn about each skipped feature gateRalf Jung-317/+315
2020-05-02Test associated const default qualifs cross-crateDylan MacKenzie-3/+41
This also tests for the ICE in #71734
2020-05-02fix miri-unleash delayed sanity checkingRalf Jung-9/+7
2020-05-02make sure the miri-unleash-flag is not used to circumvent feature gatesRalf Jung-17/+10
2020-05-01Name test appropriately and link to the issues it regress-checks forOliver Scherer-0/+5
2020-05-01Move recursion check for zsts back to read site instead of access check site.Oliver Scherer-0/+27
2020-05-01rename InvalidIntPtrUsageRalf Jung-4/+4
2020-05-01bless youRalf Jung-2/+2
2020-04-30Rollup merge of #71688 - ecstatic-morse:const-downcast, r=oli-obkTyler Mandry-10/+2
Allow `Downcast` projections unconditionally in const-checking `ProjectionElem::Downcast` sounds scary, but it's really just the projection we use to access a particular enum variant. They usually appear in the lowering of a `match` statement, so they have been associated with control flow in const-checking, but they don't do any control flow by themselves. We already have a HIR pass that looks for `if` and `match` (even ones that have 1 or fewer reachable branches). That pass is double-checked by a MIR pass that looks for `SwitchInt`s and `FakeRead`s for match scrutinees. In my opinion, there's no need to look for `Downcast` as well. r? @oli-obk
2020-04-30Rollup merge of #71590 - RalfJung:mir-dump-pointers, r=oli-obkTyler Mandry-37/+38
MIR dump: print pointers consistently with Miri output This makes MIR allocation dump pointer printing consistent with Miri output: both use hexadecimal offsets with a `0x` prefix. To save some space, MIR dump replaces the `alloc` prefix by `a` when necessary. I also made AllocId/Pointer printing more consistent in their Debug/Display handling, and adjusted Display printing for Scalar a bit to avoid using decimal printing when we do not know the sign with which to interpret the value (IMO using decimal then is misleading).
2020-04-30Rollup merge of #71597 - CohenArthur:refactor-unique-empty, r=shepmasterDylan DPC-2/+2
Rename Unique::empty() -> Unique::dangling() A `FIXME` comment in `src/libcore/ptr/unique.rs` suggested refactoring `Unique::empty()` to `Unique::dangling()` which this PR does.
2020-04-30deduplicate warningsRalf Jung-221/+225
2020-04-30remove no longer needed feature flagsRalf Jung-42/+128
2020-04-30Rollup merge of #71655 - RalfJung:const-pattern-soundness, r=oli-obkDylan DPC-14/+221
Miri: better document and fix dynamic const pattern soundness checks https://github.com/rust-lang/const-eval/issues/42 got me thinking about soundness for consts being used in patterns, and I found a hole in our existing dynamic checks: a const referring to a mutable static *in a different crate* was not caught. This PR fixes that. It also adds some comments that explain which invariants are crucial for soundness of const-patterns. Curiously, trying to weaponize this soundness hole failed: pattern matching compilation ICEd when encountering the cross-crate static, saying "expected allocation ID alloc0 to point to memory". I don't know why that would happen, statics *should* be entirely normal memory for pattern matching to access. r? @oli-obk Cc @rust-lang/wg-const-eval
2020-04-30rename-unique: Rename Unique::empty() to Unique::dangling()cohenarthur-2/+2
rename-unique: Change calls and doc in raw_vec.rs rename-unique: Change empty() -> dangling() in const-ptr-unique-rpass.rs