rust/compiler/rustc_metadata/src
bors 704e47f78b Auto merge of #78407 - oli-obk:ub_checkable_ctfe, r=RalfJung,pnkfelix
Make CTFE able to check for UB...

... by not doing any optimizations on the `const fn` MIR used in CTFE. This means we duplicate all `const fn`'s MIR now, once for CTFE, once for runtime. This PR is for checking the perf effect, so we have some data when talking about https://github.com/rust-lang/const-eval/blob/master/rfcs/0000-const-ub.md

To do this, we now have two queries for obtaining mir: `optimized_mir` and `mir_for_ctfe`. It is now illegal to invoke `optimized_mir` to obtain the MIR of a const/static item's initializer, an array length, an inline const expression or an enum discriminant initializer. For `const fn`, both `optimized_mir` and `mir_for_ctfe` work, the former returning the MIR that LLVM should use if the function is called at runtime. Similarly it is illegal to invoke `mir_for_ctfe` on regular functions.

This is all checked via appropriate assertions and I don't think it is easy to get wrong, as there should be no `mir_for_ctfe` calls outside the const evaluator or metadata encoding. Almost all rustc devs should keep using `optimized_mir` (or `instance_mir` for that matter).
2021-01-12 17:26:56 +00:00
..
dynamic_lib mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rmeta Auto merge of #78407 - oli-obk:ub_checkable_ctfe, r=RalfJung,pnkfelix 2021-01-12 17:26:56 +00:00
creader.rs Improve warnings on incompatible options involving -Zinstrument-coverage 2020-12-14 12:55:46 -08:00
dependency_format.rs Collapse all uses of target.options.foo into target.foo 2020-11-08 17:29:13 +03:00
dynamic_lib.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
foreign_modules.rs Remove ForeignMod struct. 2020-11-26 21:32:27 +01:00
lib.rs Stabilise then 2020-11-22 13:45:14 +00:00
link_args.rs Remove ForeignMod struct. 2020-11-26 21:32:27 +01:00
locator.rs Collapse all uses of target.options.foo into target.foo 2020-11-08 17:29:13 +03:00
native_libs.rs reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats) 2021-01-02 20:09:17 +01:00