about summary refs log tree commit diff
path: root/src/librustc_middle/mir/interpret/value.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-720/+0
2020-08-29New pass to optimize `if`conditions on integrals to switches on the integerSimon Vandel Sillesen-0/+10
Fixes #75144
2020-08-14Rework `rustc_serialize`Matthew Jasper-3/+3
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-08-08Miri: Renamed "undef" to "uninit"Philippe Nadon-1/+1
Renamed remaining references to "undef" to "uninit" when referring to Miri. Impacted directories are: - src/librustc_codegen_llvm/consts.rs - src/librustc_middle/mir/interpret/ - src/librustc_middle/ty/print/pretty.rs - src/librustc_mir/ - src/tools/clippy/clippy_lints/src/consts.rs Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project. Related issue #71193
2020-08-04Completes support for coverage in external cratesRich Kadel-0/+9
The prior PR corrected for errors encountered when trying to generate the coverage map on source code inlined from external crates (including macros and generics) by avoiding adding external DefIds to the coverage map. This made it possible to generate a coverage report including external crates, but the external crate coverage was incomplete (did not include coverage for the DefIds that were eliminated. The root issue was that the coverage map was converting Span locations to source file and locations, using the SourceMap for the current crate, and this would not work for spans from external crates (compliled with a different SourceMap). The solution was to convert the Spans to filename and location during MIR generation instead, so precompiled external crates would already have the correct source code locations embedded in their MIR, when imported into another crate.
2020-07-31Auto merge of #65989 - Aaron1011:fix/normalize-param-env, r=nikomatsakisbors-1/+1
Normalize all opaque types when converting ParamEnv to Reveal::All When we normalize a type using a ParamEnv with a reveal mode of RevealMode::All, we will normalize opaque types to their underlying types (e.g. `type MyOpaque = impl Foo` -> `StructThatImplsFoo`). However, the ParamEnv may still have predicates referring to the un-normalized opaque type (e.g. `<T as MyTrait<MyOpaque>>`). This can cause trait projection to fail, since a type containing normalized opaque types will not match up with the un-normalized type in the `ParamEnv`. To fix this, we now explicitly normalize all opaque types in caller_bounds of a `ParamEnv` when changing its mode to `RevealMode::All`. This ensures that all predicatse will refer to the underlying types of any opaque types involved, allowing them to be matched up properly during projection. To reflect the fact that normalization is occuring, `ParamEnv::with_reveal_all` is renamed to `ParamEnv::with_reveal_all_normalized` Fixes #65918
2020-07-22renamed ScalarMaybeUninit::not_undef to check_initPhilippe Nadon-15/+15
Renamed the function ScalarMaybeUninit::not_undef to ScalarMaybeUninit::check_init in the file src/librustc_middle/mir/interpret/value.rs, to reflect changes in terminology used. Related issue rust-lang#71193
2020-07-22Normalize opaque types when converting `ParamEnv` to `Reveal::All`Aaron Hill-1/+1
Fixes #65918
2020-07-15s/try_to_usize/try_to_machine_usize/Oliver Scherer-1/+1
2020-07-15Reduce the amount of interning and `layout_of` calls in const eval.Oliver Scherer-0/+12
2020-05-07Renamed "undef" stuff to "uninit"Hanif Bin Ariffin-19/+19
1. InvalidUndefBytes -> InvalidUninitBytes 2. ScalarMaybeUndef -> ScalarMaybeUninit 3. UndefMask -> InitMask Related issue #71193
2020-05-01remove AllocId generalization of PointerRalf Jung-6/+6
2020-04-30Rollup merge of #71590 - RalfJung:mir-dump-pointers, r=oli-obkTyler Mandry-5/+9
MIR dump: print pointers consistently with Miri output This makes MIR allocation dump pointer printing consistent with Miri output: both use hexadecimal offsets with a `0x` prefix. To save some space, MIR dump replaces the `alloc` prefix by `a` when necessary. I also made AllocId/Pointer printing more consistent in their Debug/Display handling, and adjusted Display printing for Scalar a bit to avoid using decimal printing when we do not know the sign with which to interpret the value (IMO using decimal then is misleading).
2020-04-27keep 'pointer' terminology aroundRalf Jung-1/+4
2020-04-26organize Debug/Display impls a bit more; avoid sign-ignorant decimal displayRalf Jung-7/+8
2020-04-26Rename ArgumentSizeMismatch to ScalarSizeMismatchSamrat Man Singh-2/+2
2020-04-26[miri] Throw UB if target size and data size don't matchSamrat Man Singh-1/+6
If an extern C function is defined as ``` extern "C" { fn malloc(size: u32) -> *mut std::ffi::c_void; } ``` on a 64-bit machine(ie. pointer sizes don't match), throw an undefined behaviour.
2020-04-23add back Scalar::null_ptrRalf Jung-0/+5
2020-04-20Remove null placesJonas Schievink-5/+0
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-5/+2
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-0/+683