about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2019-08-02bless all the thingsRalf Jung-4/+4
2019-08-02add is_any_ptr type test; this also helps pacify tidyRalf Jung-1/+0
2019-08-02improve error when CTFE does ptr-int-cast; update testsRalf Jung-20/+25
2019-07-29Add a test for std::any::type_name() as a const fnTankhouseAle-0/+29
This is a modified version of the test I added previously. The difference is this version implements a wrapper around std::any::type_name versus core::intrinsics::type_name, in order to show that it works as desired / intended.
2019-07-28fix testsRalf Jung-15/+21
2019-07-27Auto merge of #63029 - petrochenkov:rpass, r=Centrilbors-0/+2430
Move run-pass tests to ui This is the second attempt at doing https://github.com/rust-lang/rust/pull/53994 (which was previously reverted in https://github.com/rust-lang/rust/pull/54530). The issue with inability to run the test suite in a faster way (https://github.com/rust-lang/rust/issues/54047) that motivated the revert was recently addressed by https://github.com/rust-lang/rust/pull/61755. r? @Centril
2019-07-27tests: Move run-pass tests with naming conflicts to uiVadim Petrochenkov-0/+263
2019-07-27tests: Move run-pass tests without naming conflicts to uiVadim Petrochenkov-0/+2167
2019-07-27Rollup merge of #62982 - oli-obk:static_cycle, r=RalfJungMazdak Farrokhzad-0/+11
Don't access a static just for its size and alignment cc @RalfJung fixes #62189
2019-07-25Rollup merge of #62930 - iluuu1994:test-for-51559, r=oli-obkMazdak Farrokhzad-0/+18
Add test for #51559 Closes #51559
2019-07-25Don't access a static just for its size and alignmentOliver Scherer-0/+11
2019-07-24Add test for #51559Ilija Tovilo-0/+18
Closes #51559
2019-07-22Bless output of test consts/promote_const_let.rs for Poloniuslqd-0/+29
2019-07-18Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddybbors-0/+426
rustc/rustc_mir: Implement RFC 2203. This PR implements RFC 2203, allowing constants in array repeat expressions. Part of #49147. r? @eddyb
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-19/+19
https://github.com/rust-lang/rust/issues/60532
2019-07-14miri validation: better error messages for dangling referencesRalf Jung-3/+3
2019-07-11rustc_mir: follow FalseUnwind's real_target edge in qualify_consts.Eduard-Mihai Burtescu-23/+48
2019-07-10Rollup merge of #62275 - eddyb:const-drop-replace, r=pnkfelixMazdak Farrokhzad-10/+32
rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts. This slipped through the cracks and never got implemented (thankfully that just meant it was overly conservative and didn't allow assignments that don't *actually* drop the previous value). Fixes #62273. r? @oli-obk
2019-07-09normalize use of backticks in compiler messages for libsyntax/feature_gateSamy Kacimi-12/+12
https://github.com/rust-lang/rust/issues/60532
2019-07-07tests: Add tests that use const fns.David Wood-0/+39
2019-07-07tests: Update and add tests for RFC 2203.David Wood-32/+96
2019-07-07rustc_mir: Re-use `report_selection_error`.David Wood-12/+22
This commit replaces the new error that was being emitted in NLL type check with a call to `report_selection_error` so that the same trait error as before this PR is emitted.
2019-07-07syntax: Add feature gate.David Wood-3/+4
This commit adds a `const_in_array_repeat_expressions` feature gate and only create `Candidate::Repeat` if it is enabled.
2019-07-07rustc/rustc_mir: Implement RFC 2203.David Wood-0/+312
This commit implements RFC 2203, allowing constants in array repeat expressions. Firstly, the check that the array repeat expression implements `Copy` is removed and re-implemented in `rustc_mir::borrow_check::nll::type_check` by emitting an error when the MIR contains a `Operand::Move` and the type does not implement `Copy`. Next, the `qualify_consts` pass is modified to construct a `Candidate::Repeat` when it would be correct to promote a array repeat expression. Finally, the `promote_consts` pass is modified to promote the candidates previously identified.
2019-07-06normalize use of backticks/lowercase in compiler messages for librustc_mirSamy Kacimi-97/+97
https://github.com/rust-lang/rust/issues/60532 r? @alexreg
2019-07-06Auto merge of #61988 - Centril:there-is-only-loop, r=matthewjasperbors-35/+54
[let_chains, 3/6] And then there was only Loop Here we remove `hir::ExprKind::While`. Instead, we desugar: `'label: while $cond $body` into: ```rust 'label: loop { match DropTemps($cond) { true => $body, _ => break, } } ``` Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239. This is a follow up to https://github.com/rust-lang/rust/pull/59288 which did the same for `if` expressions. r? @matthewjasper
2019-07-06--bless --compare-mode=nllMazdak Farrokhzad-17/+17
2019-07-06while desugars to loop so 'a: while break 'a {} in ctfe doesn't work yet.Mazdak Farrokhzad-0/+18
2019-07-06min_const_fn: change error message due to changed desugaring.Mazdak Farrokhzad-18/+19
2019-07-06Rollup merge of #62245 - RalfJung:miri-extra-fn, r=eddyb,zackmdavisMazdak Farrokhzad-37/+88
Miri engine: support extra function (pointer) values We want to add basic support for `dlsym` in Miri (needed to run the latest version of `getrandom`). For that to work, `dlsym` needs to return *something* that can be stored in a function pointer and later called. So we add a new `ExtraFnVal` type to the `Machine` trait, and enable Miri's memory to associate allocation IDs with such values, so that `create_fn_alloc` and `get_fn` can work on *both* `Instance` (this is used for "normal" function pointers) and `ExtraFnVal`. Cc @oli-obk
2019-07-05Rollup merge of #62133 - petrochenkov:norustc, r=eddybMazdak Farrokhzad-4/+4
Feature gate `rustc` attributes harder Fixes https://github.com/rust-lang/rust/issues/62116
2019-07-04improve validity error range printing for singleton rangesRalf Jung-2/+2
2019-07-04turns out that dangling pointer branch is dead code; remove it and improve ↵Ralf Jung-37/+88
the error that actually gets shown a bit
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-46/+46
2019-07-02rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts.Eduard-Mihai Burtescu-10/+32
2019-06-30Make sure `#[rustc_doc_only_macro]` and other rustc attributes are registeredVadim Petrochenkov-4/+4
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