summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2019-08-10fix testRalf Jung-6/+55
2019-08-06pretty-pretty extremal constants!Zack M. Davis-12/+12
While many programmers may intuitively appreciate the significance of "magic numbers" like −2147483648, Rust is about empowering everyone to build reliable and efficient software! It's a bit more legible to print the constant names (even noisy fully-qualified-paths thereof). The bit-manipulation methods mirror those in `librustc_mir::hair::pattern::_match::all_constructors`; thanks to the immortal Varkor for guidance. Resolves #56393.
2019-08-06Rollup merge of #63230 - tmandry:disallow-possibly-uninitialized, r=CentrilMazdak Farrokhzad-48/+5
Make use of possibly uninitialized data [E0381] a hard error This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see #60889, discussion at #63035), so tests are included for that. cc #54987 --- I'm not sure if bypassing the buffer is a good way of doing this. We could also make a `force_errors_buffer` or similar that gets recombined with all the errors as they are emitted. But this is simpler and seems fine to me. r? @Centril cc @cramertj @nikomatsakis @pnkfelix @RalfJung
2019-08-05Make use of possibly uninitialized data a hard errorTyler Mandry-48/+5
This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see discussion at #63035), so tests are included for that.
2019-08-05Update to new passing-ui-test schemeOliver Scherer-2/+2
2019-08-05Address comment and formatting nitsOliver Scherer-1/+1
2019-08-05Add regression testsOliver Scherer-0/+37
2019-08-03Auto merge of #63234 - Centril:rollup-h9t731z, r=Centrilbors-40/+40
Rollup of 5 pull requests Successful merges: - #62954 (Fix typo in Delimited::open_tt) - #63146 (Cleanup syntax::attr) - #63218 (rustbuild: RISC-V is no longer an experimental LLVM target) - #63227 (dead_code: Properly inspect fields in struct patterns with type relative paths) - #63229 (A bit of Miri error cleanup) Failed merges: r? @ghost
2019-08-03blessRalf Jung-40/+40
2019-08-02fix rebase falloutRalf Jung-6/+7
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-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