summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2019-08-12fix cycle when looking up size and align of a staticRalf Jung-0/+11
2019-06-29Rollup merge of #61755 - Centril:compiletest-force-check, r=petrochenkovMazdak Farrokhzad-30/+36
Add `--pass $mode` to compiletest through `./x.py` Adds a flag `--pass $mode` to compiletest, which is exposed through `./x.py`. When `--pass $mode` is passed, `{check,build,compile,run}-pass` tests will be forced to run under the given `$mode` unless the directive `// ignore-pass` exists in the test file. The modes are explained in https://github.com/rust-lang/rust/pull/61778: - `check` has the same effect as `cargo check` - `build` or `compile` have the same effect as `cargo build` - `run` has the same effect as `cargo run` On my machine, `./x.py -i test src/test/run-pass --stage 1 --pass check` takes 38 seconds whereas it takes 2 min 7 seconds without `--pass check`. cc https://github.com/rust-lang/rust/issues/61712 r? @petrochenkov
2019-06-25Rollup merge of #62055 - matthewjasper:fix-error-counting, r=pnkfelixMazdak Farrokhzad-0/+48
Fix error counting Count duplicate errors for `track_errors` and other error counting checks. Add FIXMEs to make it clear that we should be moving away from this kind of logic. Closes #61663
2019-06-25Rollup merge of #61814 - varkor:uninhabited-const-61744, r=oli-obkMazdak Farrokhzad-0/+43
Fix an ICE with uninhabited consts Fixes https://github.com/rust-lang/rust/issues/61744. r? @oli-obk
2019-06-25Auto merge of #62094 - oli-obk:zst_intern, r=eddybbors-2/+8
Don't ICE on mutable zst slices fixes #62045
2019-06-25Fix an ICE with uninhabited constsvarkor-0/+43
2019-06-24Auto merge of #62081 - RalfJung:miri-pointer-checks, r=oli-obkbors-3/+3
Refactor miri pointer checks Centralize bounds, alignment and NULL checking for memory accesses in one function: `memory.check_ptr_access`. That function also takes care of converting a `Scalar` to a `Pointer`, should that be needed. Not all accesses need that though: if the access has size 0, `None` is returned. Everyone accessing memory based on a `Scalar` should use this method to get the `Pointer` they need. All operations on the `Allocation` work on `Pointer` inputs and expect all the checks to have happened (and will ICE if the bounds are violated). The operations on `Memory` work on `Scalar` inputs and do the checks themselves. The only other public method to check pointers is `memory.ptr_may_be_null`, which is needed in a few places. No need for `check_align` or similar methods. That makes the public API surface much easier to use and harder to mis-use. This should be largely no-functional-change, except that ZST accesses to a "true" pointer that is dangling or out-of-bounds are now considered UB. This is to be conservative wrt. whatever LLVM might be doing. While I am at it, this also removes the assumption that the vtable part of a `dyn Trait`-fat-pointer is a `Pointer` (as opposed to a pointer cast to an integer, stored as raw bits). r? @oli-obk
2019-06-24Pacify tidyOliver Scherer-2/+1
2019-06-24Add regression testOliver Scherer-0/+6
2019-06-24Simplify vtable interningOliver Scherer-2/+3
2019-06-24promoted_errors: warn -> deny.Mazdak Farrokhzad-30/+36
2019-06-23Auto merge of #61778 - petrochenkov:pass, r=Mark-Simulacrumbors-6/+1
compiletest: Introduce `// {check,build,run}-pass` pass modes Pass UI tests now have three modes ``` // check-pass // build-pass // run-pass ``` mirroring equivalent well-known `cargo` commands. `// check-pass` will compile the test skipping codegen (which is expensive and isn't supposed to fail in most cases). `// build-pass` will compile and link the test without running it. `// run-pass` will compile, link and run the test. Tests without a "pass" annotation are still considered "fail" tests. Most UI tests would probably want to switch to `check-pass`. Tests validating codegen would probably want to run the generated code as well and use `run-pass`. `build-pass` should probably be rare (linking tests?). https://github.com/rust-lang/rust/pull/61755 will provide a way to run the tests with any mode, e.g. bump `check-pass` tests to `run-pass` to satisfy especially suspicious people, and be able to make sure that codegen doesn't breaks in some entirely unexpected way. Tests marked with any mode are expected to pass with any other mode, if that's not the case for some legitimate reason, then the test should be made a "fail" test rather than a "pass" test. Perhaps some secondary CI can verify this invariant, but that's not super urgent. `// compile-pass` still works and is equivalent to `build-pass`. Why is `// compile-pass` bad - 1) it gives an impression that the test is only compiled, but not linked, 2) it doesn't mirror a cargo command. It can be removed some time in the future in a separate PR. cc https://github.com/rust-lang/rust/issues/61712
2019-06-23comment tweaks, better validation errors, update UI testsRalf Jung-3/+3
2019-06-22Count all errors for `track_errors`Matthew Jasper-0/+48
2019-06-19Update ui test outputOliver Scherer-1/+1
2019-06-19Add and update more testsOliver Scherer-1/+28
2019-06-19Make interning explicitly care about types and the mutability of memoryOliver Scherer-0/+160
2019-06-17Make use of `ptr::null(_mut)` instead of casting zeroLzu Tao-5/+5
2019-06-16Auto merge of #61347 - Centril:stabilize-underscore_const_names, r=petrochenkovbors-6/+35
Stabilize underscore_const_names in 1.37.0 You are now permitted to write: ```rust const _: $type_expression = $term_expression; ``` That is, we change the [grammar of items](https://github.com/rust-lang-nursery/wg-grammar/blob/9d1984d7ae8d6576f943566539a31a5800644c57/grammar/item.lyg#L3-L42), as written in [the *`.lyg`* notation](https://github.com/rust-lang/gll/tree/263bf161dad903e67aa65fc591ced3cab18afa2a#grammar), from: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IDENT ":" ty:Type "=" value:Expr ";" } | ... ; ``` into: ```java Item = attrs:OuterAttr* vis:Vis? kind:ItemKind; ItemKind = | ... | Const:{ "const" name:IdentOrUnderscore ":" ty:Type "=" value:Expr ";" } | ... ; IdentOrUnderscore = | Named:IDENT | NoName:"_" ; ``` r? @petrochenkov
2019-06-16Auto merge of #60730 - matthewjasper:optimize-false-edges, r=pnkfelixbors-20/+42
Optimize matches Attempt to fix or improve #60571 This is breaking some diagnostics because the MIR for match arms isn't in source order any more. cc @centril
2019-06-16compiletest: Remove `skip-codegen`Vadim Petrochenkov-4/+1
2019-06-16compiletest: Validate pass modes harderVadim Petrochenkov-2/+0
2019-06-13Create fewer basic blocks in match MIR loweringMatthew Jasper-20/+42
2019-06-12Handle index out of bound errors during const eval without panicEsteban Küber-0/+30
2019-06-11Rollup merge of #61518 - czipperz:const-fn-doc-disallow-loops, r=CentrilMazdak Farrokhzad-13/+13
Add loops to doc list of things not stable in const fn Closes #61508
2019-06-10Stabilize underscore_const_names.Mazdak Farrokhzad-6/+35
2019-06-09Reword const fn conditional and loop error textChris Gregory-13/+13
2019-06-07Rollup merge of #61532 - wesleywiser:const_prop_more, r=oli-obkMazdak Farrokhzad-0/+12
[const-prop] Support Rvalue::{Ref,Len} and Deref Also fixes an ICE I found in testing. r? @oli-obk ~~The final commit is just for a perf run. I'll remove it after that is completed.~~
2019-06-06Bless test outputWesley Wiser-0/+12
2019-06-06Make constructors actually be const functionsMatthew Jasper-0/+212
2019-06-05Rollup merge of #61536 - oli-obk:args_required_const_in_const_fn, r=eddybMazdak Farrokhzad-0/+26
Don't allow using const fn arguments as "args_required_const" r? @eddyb
2019-06-05Explain the existience of the regression testOliver Scherer-2/+11
2019-06-05Don't allow using const fn arguments as "args_required_const"Oliver Scherer-0/+17
2019-06-04Remove unneeded feature attr from atomic integers doctestsLzu Tao-2/+0
2019-05-31Stabilize reverse_bits featureLzu Tao-9/+7
2019-05-29Auto merge of #61203 - memoryruins:bare_trait_objects, r=Centrilbors-28/+28
Warn on bare_trait_objects by default The `bare_trait_objects` lint is set to `warn` by default. Most ui tests have been updated to use `dyn` to avoid creating noise in stderr files. r? @Centril cc #54910
2019-05-29bless youRalf Jung-1/+1
2019-05-29Update ui test suite to use dynmemoryruins-28/+28
2019-05-28Make sure array length diagnostic doesn't regressvarkor-3/+7
2019-05-28Correct pluralisation of tuple/array/associated type binding mismatch errorsvarkor-2/+2
2019-05-28Reintroduce `TypeError::FixedArraySize`varkor-2/+2
2019-05-28Use Display rather than Debug printing for const mismatchvarkor-2/+2
2019-05-28Update tests after pretty printingvarkor-2/+2
2019-05-28Eagerly evaluate in `super_relate_consts`varkor-2/+2
2019-05-25Update nll ui testsOliver Scherer-1/+1
2019-05-25Update ui testsOliver Scherer-1/+1
2019-05-21Add FAQ for NLL migrationJethro Beekman-0/+4
2019-05-19Rollup merge of #60370 - Richard-W:const-layout-construction, r=sfacklerMazdak Farrokhzad-0/+21
Mark core::alloc::Layout::from_size_align_unchecked const Makes it possible (pending stabilization of #57563 (`const_fn`)) to rewrite code like ```rust const BUFFER_SIZE: usize = 0x2000; const BUFFER_ALIGN: usize = 0x1000; fn foo() { let layout = std::alloc::Layout::from_size_align(BUFFER_SIZE, BUFFER_ALIGN) .unwrap(); let buffer = std::alloc::alloc(layout); } ``` to ```rust const BUFFER_LAYOUT: std::alloc::Layout = unsafe { std::alloc::Layout::from_size_align_unchecked(0x2000, 0x1000) }; fn foo() { let buffer = std::alloc::alloc(BUFFER_LAYOUT); } ``` which (although `unsafe` is used) looks somewhat cleaner and is easier to read.
2019-05-14Add ui test for const Layout::from_size_align_uncheckedRichard Wiedenhöft-0/+21
2019-05-12Remove feature(nll) when compare mode is sufficientMatthew Jasper-12/+2