about summary refs log tree commit diff
path: root/src/librustc/mir
AgeCommit message (Collapse)AuthorLines
2020-01-08- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}Mazdak Farrokhzad-1/+1
- remove syntax::{help!, span_help!, span_note!} - remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!} - lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints - inline syntax::{struct_span_warn!, diagnostic_used!} - stringify_error_code! -> error_code! & use it more. - find_plugin_registrar: de-fatalize an error - de-fatalize metadata errors - move type_error_struct! to rustc_typeck - struct_span_err! -> rustc_errors
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-9/+10
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-1/+1
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-3/+3
2020-01-02Normalize `syntax::source_map` imports.Mazdak Farrokhzad-1/+1
2020-01-01Rename `syntax_pos` to `rustc_span` in source codeVadim Petrochenkov-4/+4
2019-12-30Auto merge of #67658 - spastorino:do-not-copy-zsts, r=oli-obkbors-0/+8
Avoid memory copy logic for zsts r? @oli-obk One of the included commits is work done by @HeroicKatora in #62655
2019-12-30Auto merge of #67631 - oli-obk:polymorphic_promotion, r=wesleywiserbors-1/+1
Work around a resolve bug in const prop r? @wesleywiser @anp This isn't exposed right now, but further changes to rustc may start causing bugs without this.
2019-12-28Avoid copying some undef memory in MIRSantiago Pastorino-0/+8
During MIR interpretation it may happen that a place containing uninitialized bytes is copied. This would read the current representation of these bytes and write it to the destination even though they must, by definition, not matter to the execution. This elides that representation change when no bytes are defined in such a copy, saving some cpu cycles. In such a case, the memory of the target allocation is not touched at all which also means that sometimes no physical page backing the memory allocation of the representation needs to be provided by the OS at all, reducing memory pressure on the system.
2019-12-28Rollup merge of #67604 - christianpoveda:scalar_to_(u|i)64, r=RalfJungOliver Scherer-21/+35
Add Scalar::to_(u|i)16 methods r? @RalfJung
2019-12-27Fix `Instance::resolve()` incorrectly returning specialized instancesWesley Wiser-1/+1
We only want to return specializations when `Reveal::All` is passed, not when `Reveal::UserFacing` is. Resolving this fixes several issues with the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization passes. Fixes #66901
2019-12-26Early abort instead of building up zero sized valuesOliver Scherer-4/+0
2019-12-26Prevent an ICE on invalid transmutesOliver Scherer-0/+6
2019-12-26Retire `to_ptr` which should already have no users but still kept getting ↵Oliver Scherer-7/+2
new ones
2019-12-26Don't ICE on the use of integer addresses for ZST constants in pattern matchingOliver Scherer-0/+4
2019-12-25rewrite scalar to integer methodsChristian Poveda-28/+29
2019-12-25Add Scalar::to_(u|i)16 methodsChristian Poveda-0/+13
2019-12-22Format the worldMark Rousskov-844/+714
2019-12-22Rollup merge of #67299 - christianpoveda:try_immty_from_int, r=RalfJungMazdak Farrokhzad-11/+27
Add `ImmTy::try_from_(u)int` methods r? @RalfJung
2019-12-22Rollup merge of #66877 - skinny121:const-eval-entry-points, r=oli-obkMazdak Farrokhzad-1/+92
Add simpler entry points to const eval for common usages. I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways: - Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc. - Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants. - Evaluates a promoted constant. This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval` is normally used.
2019-12-22Add error message if `Scalar::from_(u)int` failsChristian Poveda-2/+8
2019-12-22Add simpler entry points to const eval for common usages.Ben Lewis-1/+92
2019-12-21Change results to optionsChristian Poveda-6/+6
2019-12-201. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.Mazdak Farrokhzad-23/+8
2. mir::Mutability -> ast::Mutability.
2019-12-18Add Rvalue::AddressOf to MIRMatthew Jasper-0/+41
This operator creates a raw pointer to a Place directly, without first creating a reference. See RFC #2582 for motivation. The Rvalue is currently unused.
2019-12-14add Scalar::try_from_(u)int methodsChristian Poveda-12/+22
2019-12-11Auto merge of #66650 - matthewjasper:nonuniform-array-move, r=pnkfelixbors-11/+24
Remove uniform array move MIR passes This PR fixes a number of bugs caused by limitations of this pass * Projections from constant indexes weren't being canonicalized * Constant indexes from the start weren't being canonicalized (they could have different min_lengths) * It didn't apply to non-moves This PR makes the following changes to support removing this pass: * ConstantIndex of arrays are now generated in a canonical form (from the start, min_length is the actual length). * Subslices are now split when generating move paths and when checking subslices have been moved. Additionally * The parent move path of a projection from an array element is now calculated correctly closes #66502
2019-12-09Rollup merge of #67125 - hashedone:master, r=petrochenkovTyler Mandry-5/+9
Added ExactSizeIterator bound to return types Fixes #66865
2019-12-09Make const index and subslice array projections more usefulMatthew Jasper-11/+24
* `min_length` is now exact for const index elements. * const index elements are always from the start. * make array `Subslice` `PlaceElems` count both `from` and `to` from the start.
2019-12-09Added ExactSizeIterator bound to return typesBartłomiej Kuras-1/+1
This reverts commit d97379a96e594820b9e865ae56cb8d753bf6b06a.
2019-12-08Rollup merge of #66991 - Nashenas88:body_cache_cleanup, r=eddybMazdak Farrokhzad-34/+30
Cleanup BodyCache After this PR: - `BodyCache` is renamed to `BodyAndCache` - `ReadOnlyBodyCache` is renamed to `ReadOnlyBodyAndCache` - `ReadOnlyBodyAndCache::body` fn is removed and all calls to it are replaced by a deref (possible due to fix of its `Deref` imp in #65947) cc @eddyb @oli-obk
2019-12-07Added ExactSizeIterator bound to return typesBartłomiej Kuras-5/+9
in librustc in several places
2019-12-07Auto merge of #66927 - RalfJung:engines-dont-panic, r=oli-obkbors-5/+21
Miri core engine: use throw_ub instead of throw_panic See https://github.com/rust-lang/rust/issues/66902 for context: panicking is not really an "interpreter error", but just part of a normal Rust execution. This is a first step towards removing the `InterpError::Panic` variant: the core Miri engine does not use it any more. ConstProp and ConstEval still use it, though. This will be addressed in future PRs. From what I can tell, all the error messages this removes are actually duplicates. r? @oli-obk @wesleywiser
2019-12-06Fix rebase issuesvarkor-1/+1
2019-12-06Use `to_option` in various placesvarkor-5/+1
2019-12-05rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded ↵Paul Daniel Faria-34/+30
Index impl, remove body fn rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-04Auto merge of #65947 - eddyb:fn-abi, r=oli-obk,nagisabors-10/+2
rustc: split FnAbi's into definitions/direct calls ("of_instance") and indirect calls ("of_fn_ptr"). After this PR: * `InstanceDef::Virtual` is only used for "direct" virtual calls, and shims around those calls use `InstanceDef::ReifyShim` (i.e. for `<dyn Trait as Trait>::f as fn(_)`) * this could easily be done for intrinsics as well, to allow their reification, but I didn't do it * `FnAbi::of_instance` is **always** used for declaring/defining an `fn`, and for direct calls to an `fn` * this is great for e.g. https://github.com/rust-lang/rust/pull/65881 (`#[track_caller]`), which can introduce the "caller location" argument into "codegen signatures" by only changing `FnAbi::of_instance`, after this PR * `FnAbi::of_fn_ptr` is used primarily for indirect calls, i.e. to `fn` pointers * *not* virtual calls (which use `FnAbi::of_instance` with `InstanceDef::Virtual`) * there's also a couple uses where the `rustc_codegen_llvm` needs to declare (i.e. FFI-import) an LLVM function that has no Rust declaration available at all * at least one of them could probably be a "weak lang item" instead As there are many steps, this PR is best reviewed commit by commit - some of which arguably should be in their own PRs, I may have gotten carried away a bit. cc @nagisa @rkruppe @oli-obk @anp
2019-12-03Rollup merge of #66951 - RalfJung:miri-machine-stop, r=oli-obkMazdak Farrokhzad-0/+7
miri: add throw_machine_stop macro r? @oli-obk This helps Miri: https://github.com/rust-lang/miri/pull/1093
2019-12-03rustc: expose the mir::Body reference lifetime from mir::ReadOnlyBodyCache ↵Eduard-Mihai Burtescu-10/+2
(#64736 fallout).
2019-12-02Auto merge of #64736 - Nashenas88:mir_predecessors_cache_cleanup, r=oli-obkbors-115/+290
Remove interior mutability in mir predecessors cache
2019-12-02Use new HashStable proc macroPaul Daniel Faria-6/+1
2019-12-02Fix type errors created during rebasingPaul Daniel Faria-8/+1
2019-12-02Remove unchecked inline attribute, remove unused functions, make chache mod ↵Paul Daniel Faria-48/+26
private again
2019-12-02Remove inline attributes that hadn't been profiled, unexport Cache since it ↵Paul Daniel Faria-17/+1
no longer needs to be public
2019-12-02Compute predecessors in mir_build query and use existing cache for ↵Paul Daniel Faria-10/+0
generating ReadOnlyBodyCache, remove unneeded fns
2019-12-02Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, ↵Paul Daniel Faria-29/+17
rename all body_cache back to body
2019-12-02Remove BodyCache.body and rely on Deref as much as possible for ↵Paul Daniel Faria-17/+17
ReadOnlyBodyCache
2019-12-02Fix tidy errorsPaul Daniel Faria-3/+10
2019-12-02Fix remaining compilation issuesPaul Daniel Faria-7/+35
2019-12-02Simplify BodyCache impl and fix all remaining type errors in librustc_mir ↵Paul Daniel Faria-110/+82
(lifetime errors still exist)