rust/src/test
bors 1ec22171e6 Auto merge of #33130 - eddyb:mir-const, r=nikomatsakis
Implement constant support in MIR.

All of the intended features in `trans::consts` are now supported by `mir::constant`.
The implementation is considered a temporary measure until `miri` replaces it.

A `-Z orbit` bootstrap build will only translate LLVM IR from AST for `#[rustc_no_mir]` functions.

Furthermore, almost all checks of constant expressions have been moved to MIR.
In non-`const` functions, trees of temporaries are promoted, as per RFC 1414 (rvalue promotion).
Promotion before MIR borrowck would allow reasoning about promoted values' lifetimes.

The improved checking comes at the cost of four `[breaking-change]`s:
* repeat counts must contain a constant expression, e.g.:
`let arr = [0; { println!("foo"); 5 }];` used to be allowed (it behaved like `let arr = [0; 5];`)
* dereference of a reference to a `static` cannot be used in another `static`, e.g.:
`static X: [u8; 1] = [1]; static Y: u8 = (&X)[0];` was unintentionally allowed before
* the type of a `static` *must* be `Sync`, irrespective of the initializer, e.g.
`static FOO: *const T = &BAR;` worked as `&T` is `Sync`, but it shouldn't because `*const T` isn't
* a `static` cannot wrap `UnsafeCell` around a type that *may* need drop, e.g.
`static X: MakeSync<UnsafeCell<Option<String>>> = MakeSync(UnsafeCell::new(None));`
was previously allowed based on the fact `None` alone doesn't need drop, but in `UnsafeCell`
it can be later changed to `Some(String)` which *does* need dropping

The drop restrictions are relaxed by RFC 1440 (#33156), which is implemented, but feature-gated.
However, creating `UnsafeCell` from constants is unstable, so users can just enable the feature gate.
2016-05-08 00:31:40 -07:00
..
codegen Add tests 2016-03-22 09:58:23 +01:00
codegen-units Rollup merge of #33438 - birkenfeld:dup-words, r=steveklabnik 2016-05-07 15:35:19 -04:00
compile-fail Implement RFC 1440 "Allow Drop types in statics/const functions". 2016-05-07 19:14:33 +03:00
compile-fail-fulldeps s/aux/auxiliary, because windows 2016-05-06 16:24:48 -04:00
debuginfo s/aux/auxiliary, because windows 2016-05-06 16:24:48 -04:00
incremental Fix test cases to reflect that #32014...went away 2016-04-06 16:38:29 -04:00
parse-fail Rollup merge of #33336 - birkenfeld:issue-27361, r=sfackler 2016-05-07 15:35:17 -04:00
pretty Fix fallout in tests 2016-03-30 22:00:48 +00:00
run-fail Add #[rustc_no_mir] to make tests pass with -Z orbit. 2016-03-17 22:48:07 +02:00
run-fail-fulldeps Improve error message for let-in-expr-position 2016-01-26 13:55:46 +05:30
run-make Auto merge of #32756 - nikomatsakis:borrowck-snippet, r=nrc 2016-05-02 19:21:56 -07:00
run-pass Auto merge of #33130 - eddyb:mir-const, r=nikomatsakis 2016-05-08 00:31:40 -07:00
run-pass-fulldeps mir: prepare for rvalue promotion support. 2016-05-07 07:19:10 +03:00
run-pass-valgrind Add #[rustc_no_mir] to make tests pass with -Z orbit. 2016-03-17 22:48:07 +02:00
rustdoc s/aux/auxiliary, because windows 2016-05-06 16:24:48 -04:00