about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2019-09-15const interning: move mutability computation into intern_shallow, and always ↵Ralf Jung-1/+1
intern constants as immutable
2019-09-11Auto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebankbors-20/+23
check_match: refactor + improve non-exhaustive diagnostics for default binding modes Refactor `check_match` a bit with more code-reuse and improve the diagnostics for a non-exhaustive pattern match by peeling off any references from the scrutinee type so that the "defined here" label is added in more cases. For example: ```rust error[E0004]: non-exhaustive patterns: `&mut &B` not covered --> foo.rs:4:11 | 1 | enum E { A, B } | --------------- | | | | | not covered | `E` defined here ... 4 | match x { | ^ pattern `&mut &B` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms ``` Moreover, wrt. "defined here", we give irrefutable pattern matching (i.e. in `let`, `for`, and `fn` parameters) a more consistent treatment in line with `match`. r? @estebank
2019-09-10Rollup merge of #63786 - tspiteri:const-abs, r=alexcrichtonMazdak Farrokhzad-0/+22
Make `abs`, `wrapping_abs`, `overflowing_abs` const functions This makes `abs`, `wrapping_abs` and `overflowing_abs` const functions like #58044 makes `wrapping_neg` and `overflowing_neg` const functions. `abs` is made const by returning `(self ^ -1) - -1` = `!self + 1` = `-self` for negative numbers and `(self ^ 0) - 0` = `self` for non-negative numbers. The subexpression `self >> ($BITS - 1)` evaluates to `-1` for negative numbers and `0` otherwise. The subtraction overflows when `self` is `min_value()`, as we would be subtracting `max_value() - -1`; this is when `abs` should overflow. `wrapping_abs` and `overflowing_abs` make use of `wrapping_sub` and `overflowing_sub` instead of the subtraction operator.
2019-09-09check_match: unify check_irrefutable & check_exhaustive more.Mazdak Farrokhzad-20/+20
2019-09-09check_match: refactor + improve non-exhaustive diag for default binding modes.Mazdak Farrokhzad-0/+3
2019-09-08Update test stderr with results of enabling unused lintsMark Rousskov-1/+18
2019-09-06Fixed grammar/style in error messages and reblessed tests.Alexander Regueiro-68/+68
2019-09-05Rollup merge of #64063 - JohnTitor:fix-const-err, r=oli-obkMazdak Farrokhzad-8/+178
Fix const_err with `-(-0.0)` Fixes #64059 r? @oli-obk
2019-09-02Fix tests againYuki Okushi-39/+194
2019-09-02Fix condition and tests' flagsYuki Okushi-40/+41
2019-09-02Fix overflow_checkYuki Okushi-19/+63
2019-09-02Add `opt-level` checkYuki Okushi-45/+17
2019-09-01Fix const_err with `-(-0.0)`Yuki Okushi-14/+12
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-10/+6
2019-08-30Rollup merge of #64015 - RalfJung:const-tests, r=oli-obkMazdak Farrokhzad-60/+84
some const-eval test tweaks Best reviewed commit-by-commit. r? @oli-obk
2019-08-30add testRalf Jung-0/+29
2019-08-30const-eval tests: make all unions repr(C)Ralf Jung-59/+79
2019-08-30explain why REF_AS_USIZE is importantRalf Jung-0/+3
2019-08-30tweak const-valid testRalf Jung-1/+2
2019-08-30make unions repr(C)Ralf Jung-18/+21
2019-08-30better variable namesRalf Jung-28/+28
2019-08-29Rollup merge of #63880 - RalfJung:miri-meta, r=oli-obkMazdak Farrokhzad-66/+123
Validation: check raw wide pointer metadata While I was at it, I also added a missing check for slices not to be too big. r? @oli-obk Fixes https://github.com/rust-lang/miri/issues/918
2019-08-28Auto merge of #63820 - oli-obk:eager_const_eval, r=nikomatsakisbors-5/+5
Simplify eager normalization of constants r? @nikomatsakis
2019-08-26adjust testsRalf Jung-18/+9
2019-08-25test for too long slicesRalf Jung-7/+17
2019-08-25validate raw wide pointersRalf Jung-66/+122
2019-08-25factor wide ptr metadata checking into separate methodRalf Jung-6/+6
also fat -> wide
2019-08-23Simplify eager normalization of constantsOliver Scherer-5/+5
2019-08-22Changed testsWesley Wiser-37/+16
2019-08-21test const abs, wrapping_abs, and overflowing_absTrevor Spiteri-0/+22
2019-08-19Cherry-pick src/test changes with Centril's changessd234678-27/+22
2019-08-19test: add test from #61041.Eduard-Mihai Burtescu-0/+60
2019-08-18Auto merge of #63635 - oli-obk:default-slice-dangles, r=eddybbors-0/+19
Do not generate allocations for zero sized allocations Alternative to https://github.com/rust-lang/rust/issues/62487 r? @eddyb There are other places where we could do this, too, but that would cause `static FOO: () = ();` to not have a unique address
2019-08-17fix testsRalf Jung-3/+3
2019-08-17Add testsOliver Scherer-0/+19
2019-08-16Rollup merge of #62593 - kper:cleanup_abi, r=CentrilMazdak Farrokhzad-9/+0
Group all ABI tests. r? @eddyb Closes #62401
2019-08-15Group all ui tests and move to abi #62593Kevin Per-9/+0
2019-08-15Rollup merge of #63582 - JohnTitor:fix-ice-63226, r=oli-obkMazdak Farrokhzad-0/+26
Fix ICE #63226 Fixes #63226 r? @oli-obk
2019-08-15Adjust regression testYuki Okushi-0/+26
2019-08-14Rollup merge of #63075 - RalfJung:deref-checks, r=oli-obkMazdak Farrokhzad-15/+21
Miri: Check that a ptr is aligned and inbounds already when evaluating `*` This syncs Miri with what the Nomicon and the Reference say, and resolves https://github.com/rust-lang/miri/issues/447. Also this would not have worked without https://github.com/rust-lang/rust/pull/62982 due to new cycles. ;) r? @oli-obk
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