about summary refs log tree commit diff
path: root/src/librustc_mir/interpret
AgeCommit message (Collapse)AuthorLines
2019-01-30Monomorphize types when not going through `layout_of_local`Oliver Scherer-2/+3
2019-01-30Indent fixupOliver Scherer-2/+2
2019-01-30The return place's layout is only used once per frame, so caching doesn't helpOliver Scherer-1/+1
2019-01-30Can't use `layout_of_local` for the frame currently being createdOliver Scherer-2/+3
2019-01-30Make priroda happy againOliver Scherer-1/+1
2019-01-30Allow `layout_of_local` to also use cached layoutsOliver Scherer-14/+19
2019-01-30Merge `locals` and `local_layouts` fieldsOliver Scherer-39/+68
2019-01-27`ConstValue::ScalarPair` only needs to represent slicesOliver Scherer-2/+2
2019-01-25Rollup merge of #57734 - oli-obk:fixes_and_cleanups, r=pnkfelixMazdak Farrokhzad-5/+5
Fix evaluating trivial drop glue in constants ```rust struct A; impl Drop for A { fn drop(&mut self) {} } const FOO: Option<A> = None; const BAR: () = (FOO, ()).1; ``` was erroring with ``` error: any use of this value will cause an error --> src/lib.rs:9:1 | 9 | const BAR: () = (FOO, ()).1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^-^ | | | calling non-const function `std::ptr::real_drop_in_place::<(std::option::Option<A>, ())> - shim(Some((std::option::Option<A>, ())))` | = note: #[deny(const_err)] on by default error: aborting due to previous error ``` before this PR. According to godbolt this last compiled successfully in 1.27
2019-01-23Follow naming scheme for "frame" methodsOliver Scherer-7/+7
2019-01-22Bail out on overly generic substitutionsOliver Scherer-21/+38
2019-01-22Rollup merge of #57813 - RalfJung:validation-range-printing, r=oli-obkMazdak Farrokhzad-2/+7
fix validation range printing when encountering undef
2019-01-21fix validation range printing when encountering undefRalf Jung-2/+7
2019-01-20const_eval: Predetermine the layout of all locals when pushing a stack frameBjörn Steinbrink-18/+23
Usually the layout of any locals is required at least three times, once when it becomes live, once when it is written to, and once it is read from. By adding a cache for them, we can reduce the number of layout queries speeding up code that is heavy on const_eval.
2019-01-18Manually inline a function that was only used onceOliver Scherer-5/+5
2019-01-05Auto merge of #56837 - arielb1:nonprincipal-trait-objects, r=nikomatsakisbors-5/+10
Add support for trait-objects without a principal The hard-error version of #56481 - should be merged after we do something about the `traitobject` crate. Fixes #33140. Fixes #57057. r? @nikomatsakis
2019-01-04Auto merge of #56723 - oli-obk:lazy_const, r=nikomatsakisbors-8/+11
Don't emit `Unevaluated` from `const_eval` cc @eddyb @RalfJung
2019-01-04add support for principal-less trait object typesAriel Ben-Yehuda-5/+10
should be a pure refactoring.
2019-01-02Add missing 'static bound for the Machine traitMatthew Jasper-1/+1
2019-01-01Add `unwrap_usize` to `LazyConst`, tooOliver Scherer-1/+1
2019-01-01Move the `Unevaluated` constant arm upwards in the type structureOliver Scherer-9/+12
2018-12-26Store `Ident` rather than just `Name` in HIR types `Item` and `ForeignItem`.Alexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-130/+0
2018-12-24Rollup merge of #56985 - oli-obk:const_check_bounds, r=RalfJungMazdak Farrokhzad-19/+27
Allow testing pointers for inboundedness while forbidding dangling pointers r? @RalfJung
2018-12-23Rollup merge of #56981 - RalfJung:miri-infallible-alloc, r=oli-obkkennytm-14/+14
miri: allocation is infallible
2018-12-23Rollup merge of #56973 - RalfJung:miri-trace, r=oli-obkkennytm-7/+7
make basic CTFE tracing available on release builds Debugging things going wrong in miri is currently pretty much impossible with a nightly Rust. r? @oli-obk
2018-12-23Rollup merge of #56919 - oli-obk:null_ref_array_tuple, r=RalfJungkennytm-2/+7
Remove a wrong multiplier on relocation offset computation r? @RalfJung fixes #56800
2018-12-22Reintroduce the original `check_bounds_ptr` checksOliver Scherer-11/+21
2018-12-19Allow testing pointers for inboundedness while forbidding dangling pointersOliver Scherer-8/+6
2018-12-19miri: allocation is infallibleRalf Jung-14/+14
2018-12-19make basic CTFE tracing available on release buildsRalf Jung-7/+7
2018-12-18Explain the mathOliver Scherer-4/+9
2018-12-18treat ref-to-raw cast like a reborrow: do a special kind of retagRalf Jung-30/+10
2018-12-17Remove a wrong multiplier on relocation offset computationOliver Scherer-4/+4
2018-12-14Auto merge of #56536 - alexcrichton:update-master, r=Mark-Simulacrumbors-1/+1
Bump to 1.33.0 * Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations
2018-12-13Auto merge of #56461 - oli-obk:alloc_ids, r=RalfJungbors-16/+16
Some cleanups around `AllocId` management r? @eddyb cc @RalfJung
2018-12-12Bump to 1.33.0Alex Crichton-1/+1
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-12/+12
2018-12-04Mention `alloc` in the name of the interning methodsOliver Scherer-1/+1
2018-12-03s/AllocType/AllocKind/Oliver Scherer-15/+15
2018-12-03provide a way to replace the tag in a Scalar/MemPlaceRalf Jung-0/+20
2018-12-03Retag needs to know whether this is a 2-phase-reborrowRalf Jung-2/+3
2018-12-01Auto merge of #56165 - RalfJung:drop-glue-type, r=eddyb,nikomatsakisbors-12/+24
drop glue takes in mutable references, it should reflect that in its type When drop glue begins, it should retag, like all functions taking references do. But to do that, it needs to take the reference at a proper type: `&mut T`, not `*mut T`. Failing to retag can mean that the memory the reference points to remains frozen, and `EscapeToRaw` on a frozen location is a NOP, meaning later mutations cause a Stacked Borrows violation. Cc @nikomatsakis @Gankro because Stacked Borrows Cc @eddyb for the changes to miri argument passing (the intention is to allow passing `*mut [u8]` when `&mut [u8]` is expected and vice versa)
2018-11-27Auto merge of #56094 - RalfJung:memory-data-revived, r=oli-obkbors-30/+79
miri: Memory data revived, Hooks for stack frame push/pop r? @oli-obk
2018-11-26Auto merge of #56070 - oli-obk:const_let, r=eddybbors-5/+6
Allow assignments in const contexts fixes https://github.com/rust-lang/rust/issues/54098 fixes https://github.com/rust-lang/rust/issues/51251 fixes https://github.com/rust-lang/rust/issues/52613
2018-11-25Rollup merge of #56100 - RalfJung:visiting-generators, r=oli-obkPietro Albini-12/+42
generator fields are not necessarily initialized Looking at the MIR we generate for generators, I think we deliberately leave fields of the generator uninitialized in ways that would be illegal if this was a normal struct (or rather, one would have to use `MaybeUninit`). Consider [this example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=417b4a2950421b726dd7b307e9ee3bec): ```rust #![feature(generators, generator_trait)] fn main() { let generator = || { let mut x = Box::new(5); { let y = &mut *x; *y = 5; yield *y; *y = 10; } *x }; let _gen = generator; } ``` It generates the MIR ``` fn main() -> (){ let mut _0: (); // return place scope 1 { scope 3 { } scope 4 { let _2: [generator@src/main.rs:4:21: 13:6 for<'r> {std::boxed::Box<i32>, i32, &'r mut i32, ()}]; // "_gen" in scope 4 at src/main.rs:14:9: 14:13 } } scope 2 { let _1: [generator@src/main.rs:4:21: 13:6 for<'r> {std::boxed::Box<i32>, i32, &'r mut i32, ()}]; // "generator" in scope 2 at src/main.rs:4:9: 4:18 } bb0: { StorageLive(_1); // bb0[0]: scope 0 at src/main.rs:4:9: 4:18 (_1.0: u32) = const 0u32; // bb0[1]: scope 0 at src/main.rs:4:21: 13:6 // ty::Const // + ty: u32 // + val: Scalar(Bits { size: 4, bits: 0 }) // mir::Constant // + span: src/main.rs:4:21: 13:6 // + ty: u32 // + literal: Const { ty: u32, val: Scalar(Bits { size: 4, bits: 0 }) } StorageLive(_2); // bb0[2]: scope 1 at src/main.rs:14:9: 14:13 _2 = move _1; // bb0[3]: scope 1 at src/main.rs:14:16: 14:25 drop(_2) -> bb1; // bb0[4]: scope 1 at src/main.rs:15:1: 15:2 } bb1: { StorageDead(_2); // bb1[0]: scope 1 at src/main.rs:15:1: 15:2 StorageDead(_1); // bb1[1]: scope 0 at src/main.rs:15:1: 15:2 return; // bb1[2]: scope 0 at src/main.rs:15:2: 15:2 } } ``` Notice how we only initialize the first field of `_1` (even though it contains a `Box`!), and then assign it to `_2`. This violates the rule "on assignment, all data must satisfy the validity invariant", and hence miri complains about this code. What this PR effectively does is to change the validity invariant for generators such that it says nothing about the fields of the generator. We behave as if every field of the generator was wrapped in a `MaybeUninit`. r? @oli-obk Cc @nikomatsakis @eddyb @cramertj @withoutboats @Zoxc
2018-11-25accept undef in raw pointers, for consistency with integersRalf Jung-6/+10
2018-11-25machine hooks for stack push and pop, frame machine dataRalf Jung-7/+29
2018-11-25make memory allocation hook infallibleRalf Jung-1/+1
2018-11-25pass MemoryExtra to find_foreign_static and adjust_static_allocation; they ↵Ralf Jung-10/+14
might have to create allocations