about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2021-06-30Simplify memory failure checkingSmitty-6/+0
2021-06-30Rename is_spurious -> is_volatileSmitty-1/+1
2021-06-30simplify explanation commentSmittyvb-9/+2
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-06-29Properly handle const prop failuresSmitty-5/+14
2021-06-29Add comment with reasoning for non-determinismSmitty-0/+9
2021-06-29Simplify allocation creationSmitty-2/+1
2021-06-29Make memory exhaustion a hard errorSmitty-1/+2
2021-06-29Support allocation failures when interperting MIRSmitty-6/+20
Note that this breaks Miri. Closes #79601
2021-06-28double-check mutability inside AllocationRalf Jung-0/+3
2021-06-21Fix unused_unsafe with compiler-generated unsafeCameron Steffen-0/+2
2021-06-18Auto merge of #86194 - RalfJung:const-ub-hard-error, r=oli-obkbors-0/+1
make UB during CTFE a hard error This is a next step for https://github.com/rust-lang/rust/issues/71800. `const_err` has been a future-incompatibility lint for 4 months now since https://github.com/rust-lang/rust/pull/80394 (and err-by-default for many years before that), so I think we could try making it a proper hard error at least in some situations. I didn't yet adjust the tests, since I first want to gauge the fall-out via crater. Cc `@rust-lang/wg-const-eval`
2021-06-18Auto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasperbors-2/+0
Remove some last remants of {push,pop}_unsafe! These macros have already been removed, but there was still some code handling these macros. That code is now removed.
2021-06-18make UB during CTFE a hard errorRalf Jung-0/+1
2021-06-17Rollup merge of #86340 - Smittyvb:ctfe-hard-error-message, r=RalfJungYuki Okushi-0/+10
Use better error message for hard errors in CTFE I noticed this while working on #86255: currently the same message is used for hard errors and soft errors in CTFE. This changes the error messages to make hard errors use a message that indicates the reality of the situation correctly, since usage of the constant is never allowed when there was a hard error evaluating it. This doesn't affect the behaviour of these error messages, only the content. This changes the error logic to check if the error should be hard or soft where it is generated, instead of where it is emitted, to allow this distinction in error messages.
2021-06-16Move some hard error logic to InterpErrorSmitty-0/+10
2021-06-14Improve documentation on `UndefinedBehaviorInfo::ValidationFailure`Rémy Rakic-0/+2
2021-06-13Improve CTFE validation error messageRémy Rakic-4/+10
2021-06-13Auto merge of #86245 - lqd:const-ub-align, r=RalfJungbors-2/+10
Fix ICEs on invalid vtable size/alignment const UB errors The invalid vtable size/alignment errors from `InterpCx::read_size_and_align_from_vtable` were "freeform const UB errors", causing ICEs when reaching validation. This PR turns them into const UB hard errors to catch them during validation and avoid that. Fixes #86193 r? `@RalfJung` (It seemed cleaner to have 2 variants but they can be merged into one variant with a message payload if you prefer that ?)
2021-06-13Turn incorrect vtable size/alignment errors into hard const-UB errorsRémy Rakic-2/+10
They were "freeform const UB" error message, but could reach validation and trigger ICEs there. We now catch them during validation to avoid that.
2021-06-12Auto merge of #86130 - BoxyUwU:abstract_const_as_cast, r=oli-obkbors-2/+3
const_eval_checked: Support as casts in abstract consts
2021-06-09Auto merge of #86118 - spastorino:tait-soundness-bug, r=nikomatsakisbors-2/+3
Create different inference variables for different defining uses of TAITs Fixes #73481 r? `@nikomatsakis` cc `@oli-obk`
2021-06-08Support as casts in abstract constsEllen-2/+3
2021-06-07Remove ResolvedOpaqueTy and just use Ty, SubstsRef is already thereSantiago Pastorino-1/+1
2021-06-07Make OpaqueTypeKey the key of opaque types mapSantiago Pastorino-1/+2
2021-06-07Change concrete opaque type to be a `VecMap`Santiago Pastorino-2/+2
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-8/+5
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-06Remove some last remants of {push,pop}_unsafe!Smitty-2/+0
These macros have already been removed, but there was still some code handling these macros. That code is now removed.
2021-06-02Miscellaneous inlining improvementsTomasz Miąsko-0/+9
2021-05-31Auto merge of #85704 - Aaron1011:const-panic-hard-err, r=RalfJungbors-2/+6
Emit a hard error when a panic occurs during const-eval Previous, a panic during const evaluation would go through the `const_err` lint. This PR ensures that such a panic always causes compilation to fail.
2021-05-30Emit a hard error when a panic occurs during const-evalAaron Hill-2/+6
Previous, a panic during const evaluation would go through the `const_err` lint. This PR ensures that such a panic always causes compilation to fail.
2021-05-30Merge CrateDisambiguator into StableCrateIdbjorn3-5/+8
2021-05-25emit diagnostic after post-monomorphization errorsRémy Rakic-0/+9
Emit a diagnostic when the monomorphized item collector encounters errors during a step of the recursive item collection. These post-monomorphization errors otherwise only show the erroneous expression without a trace, making them very obscure and hard to pinpoint whenever they happen in dependencies.
2021-05-23fix commentRalf Jung-1/+1
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-05-23support creating mutable allocations from byte slicesRalf Jung-4/+8
2021-05-19Auto merge of #85376 - RalfJung:ptrless-allocs, r=oli-obkbors-222/+147
CTFE core engine allocation & memory API improvemenets This is a first step towards https://github.com/rust-lang/miri/issues/841. - make `Allocation` API offset-based (no more making up `Pointer`s just to access an `Allocation`) - make `Memory` API higher-level (combine checking for access and getting access into one operation) The Miri-side PR is at https://github.com/rust-lang/miri/pull/1804. r? `@oli-obk`
2021-05-18add Align::ONE; add methods to access alloc.extraRalf Jung-1/+1
2021-05-18CTFE core engine allocation & memory API improvemenetsRalf Jung-221/+146
- make Allocation API offset-based (no more Pointer) - make Memory API higher-level (combine checking for access and getting access into one operation)
2021-05-18Rollup merge of #85415 - LeSeulArtichaut:no-packed-borrow-unsafeck, r=RalfJungGuillaume Gomez-6/+0
Clean up remnants of BorrowOfPackedField cc #82525 which removed `BorrowOfPackedField` from unsafety-checking r? `@RalfJung`
2021-05-17Remove remnants of BorrowOfPackedFieldLeSeulArtichaut-6/+0
2021-05-17Rollup merge of #85412 - RalfJung:c_str, r=oli-obkRalf Jung-23/+0
remove some functions that were only used by Miri and Miri does not need them any more with https://github.com/rust-lang/miri/pull/1805. r? ``@oli-obk``
2021-05-17remove some functions that were only used by MiriRalf Jung-23/+0
2021-05-17remove size field from AllocationRalf Jung-6/+5
2021-05-17Auto merge of #85178 - cjgillot:local-crate, r=oli-obkbors-1/+1
Remove CrateNum parameter for queries that only work on local crate The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea. Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-12Use () for entry_fn.Camille GILLOT-1/+1
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-1/+4
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-11Split span_to_string into span_to_diagnostic/embeddable_stringAndy Wang-1/+4
2021-05-10Auto merge of #84507 - crlf0710:codegen_nonlocal_main_wrapper, r=nagisabors-1/+11
Add primary marker on codegen unit and generate main wrapper on primary codegen. This is the codegen part of changes extracted from #84062. This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260. cc #28937 I'm not sure who should i ask for review for codegen changes, so feel free to reassign. r? `@nagisa`
2021-05-09Auto merge of #85065 - Mark-Simulacrum:preds-no-alloc, r=jackh726bors-3/+3
Avoid predecessors having Drop impls Should be a simple win - but let's make sure with perf.
2021-05-09Add primary marker on codegen unit to take charge of main_wrapper for ↵Charles Lew-1/+11
non-local cases.
2021-05-07Avoid predecessors having Drop implsMark Rousskov-3/+3