Dylan MacKenzie
d36302da53
Add a UI test for #50637
...
This test relies on the fact that restrictions on expressions in `const
fn` do not apply when computing array lengths. It is more difficult to
statically analyze than the simple `loop{}` mentioned in #50637 .
This test should be updated to ignore the warning after #49980 is resolved.
2018-07-04 14:36:07 -07:00
Mark Rousskov
7b8fc87733
Rollup merge of #51839 - oli-obk:const_shift_overflow, r=nikomatsakis
...
Detect overflows of non u32 shifts
2018-06-28 16:07:14 -06:00
Oliver Schneider
4d473300a2
Turn the use of erroneous constants into errors again
2018-06-28 11:04:26 +02:00
Oliver Schneider
4eea1a4e5e
Don't const propagate the body of constants
2018-06-28 11:04:25 +02:00
Oliver Schneider
89d8e0a260
Don't use ParamEnv::reveal_all() if there is a real one available
2018-06-27 18:24:24 +02:00
Oliver Schneider
0fa166ad7f
Detect overflows of non u32 shifts
2018-06-27 13:47:19 +02:00
Zack M. Davis
057715557b
migrate codebase to ..= inclusive range patterns
...
These were stabilized in March 2018's #47813 , and are the Preferred Way
to Do It going forward (q.v. #51043 ).
2018-06-26 07:53:30 -07:00
Oliver Schneider
14d08e5371
Rebase fallout
2018-06-05 21:08:43 +02:00
Oliver Schneider
13a55e8801
Satisfy the untiring tidy
2018-06-05 20:49:47 +02:00
Oliver Schneider
78d48867da
Properly report transitive errors
2018-06-05 20:49:47 +02:00
Oliver Schneider
9cb47de813
Referring to erroneous constants in promoteds must abort the build
2018-06-05 20:49:46 +02:00
Oliver Schneider
5c0d1355f2
Refactor the const eval diagnostic API
2018-06-05 20:49:46 +02:00
Fabian Zaiser
29c43fea37
Fix tidy
2018-06-05 10:35:44 +02:00
Fabian Zaiser
589f9a87a8
Propagate uses of constants correctly so that array index checks work
2018-06-05 10:35:44 +02:00
bors
c610be92e2
Auto merge of #51307 - oli-obk:miri_fixes, r=eddyb
...
ScalarPairs are offset==0 field + other non-zst field
r? @eddyb
fixes #51300
2018-06-04 23:10:15 +00:00
Oliver Schneider
9d613c27b7
Do not promote union field accesses
2018-06-03 19:06:31 +02:00
Oliver Schneider
47f37d67f1
Correctly access ScalarPair fields during const eval
2018-06-02 23:34:25 +02:00
bors
990d8aa743
Auto merge of #50967 - oli-obk:miri_api_refactor, r=eddyb
...
Miri api refactor
r? @eddyb
cc @Zoxc
based on https://github.com/rust-lang/rust/pull/50916
2018-05-25 13:59:48 +00:00
Oliver Schneider
5f599bb490
Adjust test for 32 bit targets
2018-05-25 15:13:54 +02:00
Oliver Schneider
d0610fd26e
Add missing newlines
2018-05-24 20:49:38 +02:00
Oliver Schneider
c6d25dc224
Don't ICE on horrible transmutes in pattern constants
2018-05-24 20:49:38 +02:00
Oliver Schneider
ca8c27e1c1
Ensure llvm doesn't trigger an assert for crazy transmutes
2018-05-24 20:49:38 +02:00
Oliver Schneider
383a5df58c
Enforce stability of const fn in promoteds
2018-05-24 17:22:31 +02:00
kennytm
e7e3261121
Rollup merge of #50863 - oli-obk:const_len, r=SimonSapin,Gankro
...
Make `[T]::len` and `str::len` const fn
r? @Gankro
2018-05-23 00:26:10 +08:00
Oliver Schneider
8a5eb68958
Report let bindings and statements as unstable
2018-05-22 10:54:05 +02:00
Oliver Schneider
2788f66ab0
Add some runtime sanity checks
2018-05-21 19:00:56 +02:00
Oliver Schneider
d6fc3e176e
Make [T]::len and str::len const fn
2018-05-21 18:59:09 +02:00
bors
22c25dd737
Auto merge of #50841 - oli-obk:promote_errors_to_panics, r=eddyb
...
Don't lint numeric overflows in promoteds in release mode
r? @eddyb
mitigates #50814
2018-05-20 11:13:24 +00:00
Oliver Schneider
6630678428
Go through an allocation when accessing fields of constants
2018-05-19 14:24:24 +02:00
Oliver Schneider
27e710f557
Add a test showing the erroneous promoted bug
2018-05-19 13:10:51 +02:00
Oliver Schneider
d81651e8e9
Release mode overflows should not cause const eval to error
2018-05-19 13:10:51 +02:00
bors
a722296b6e
Auto merge of #50653 - oli-obk:bad_const, r=cramertj
...
Make the `const_err` lint `deny`-by-default
At best these things are runtime panics (debug mode) or overflows (release mode). More likely they are public constants that are unused in the crate declaring them.
This is not a breaking change, as dependencies won't break and root crates can `#![warn(const_err)]`, though I don't know why anyone would do that.
2018-05-18 17:17:35 +00:00
Jane Lusby
16adb0c725
Remove empty files
2018-05-16 10:19:45 -07:00
Oliver Schneider
1788af357a
Make the const_err lint deny-by-default
2018-05-12 16:21:02 +02:00
Roman Stoliar
4d8d0a6f85
const time
...
added rustc_const_unstable attribute
extended tests
added conversion test
fixed tidy test
added feature attribute
2018-05-10 22:10:11 +03:00
Oliver Schneider
5258871825
Fix thinning pointers to extern types in miri
2018-05-08 13:52:20 +02:00
Oliver Schneider
bf2a6c3ff9
Allow unaligned reads in constants
2018-05-02 15:48:26 +02:00
Oliver Schneider
f66367dacc
Improve div by zero const eval errors
2018-04-30 18:29:15 +02:00
Oliver Schneider
5f46e5cc7e
Update ui test output
2018-04-30 18:18:33 +02:00
bors
3eca70a0c5
Auto merge of #50072 - oli-obk:discriminants, r=eddyb
...
Allow variant discriminant initializers to refer to other initializer…
…s of the same enum
r? @eddyb
fixes the 2.4 failure of https://github.com/rust-lang/rust/issues/49765
cc @durka @retep998
2018-04-26 08:51:39 +00:00
Oliver Schneider
195c9f47e9
Allow variant discriminant initializers to refer to other initializers of the same enum
2018-04-26 08:54:14 +02:00
Oliver Schneider
cd6c186e4e
Warn on all erroneous constants
2018-04-24 13:11:48 +02:00
bors
725c9b0ede
Auto merge of #49779 - oli-obk:const_err_regression, r=eddyb
...
Don't report compile-time errors for promoteds
Fixes the regression part of #49760 , the missing warnings still are missing
r? @eddyb
2018-04-23 22:58:00 +00:00
Oliver Schneider
bb367c4720
always optimize test
...
The error messages differ between optimized and nonoptimized mode
2018-04-23 11:12:33 +02:00
Oliver Schneider
b22c9c01fb
Sign extend constants in range patterns
2018-04-19 09:01:27 +02:00
Oliver Schneider
a406af885d
Only warn on erroneous promoted constants
2018-04-15 15:08:37 +02:00
Guillaume Gomez
812656dc95
Rename must-compile-successfully into compile-pass
2018-04-13 23:28:03 +02:00
Guillaume Gomez
2e104a77cf
update tests
2018-03-14 00:53:24 +01:00
Oliver Schneider
b5ace9a906
Unify the const folding errors
...
before they differed depending on whether optimizations were on or not
2018-03-08 08:35:39 +01:00
Oliver Schneider
aedd4c61ea
Regenerate tests
2018-03-08 08:35:38 +01:00