about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2021-09-07Rename rustc_mir to rustc_const_eval.Camille GILLOT-56/+0
2021-09-07Move the dataflow framework to its own crate.Camille GILLOT-4/+0
2021-09-07Move monomorphize code to its own crate.Camille GILLOT-4/+0
2021-09-07Move rustc_mir::transform to rustc_mir_transform.Camille GILLOT-5/+0
2021-09-07Move rustc_mir::borrow_check to new crate rustc_borrowck.Camille GILLOT-18/+9
2021-08-18Remove box syntax from rustc_mirest31-1/+0
2021-08-17Auto merge of #86977 - vakaras:body_with_borrowck_facts, r=nikomatsakisbors-0/+3
Enable compiler consumers to obtain mir::Body with Polonius facts. This PR adds a function (``get_body_with_borrowck_facts``) that can be used by compiler consumers to obtain ``mir::Body`` with accompanying borrow checker information. The most important borrow checker information that [our verifier called Prusti](https://github.com/viperproject/prusti-dev) needs is lifetime constraints. I have not found a reasonable way to compute the lifetime constraints on the Prusti side. In the compiler, the constraints are computed during the borrow checking phase and then dropped. This PR adds an additional parameter to the `do_mir_borrowck` function that tells it to return the computed information instead of dropping it. The additionally returned information by `do_mir_borrowck` contains a ``mir::Body`` with non-erased lifetime regions and Polonius facts. I have decided to reuse the Polonius facts because this way I needed fewer changes to the compiler and Polonius facts contains other useful information that we otherwise would need to recompute. Just FYI: up to now, Prusti was obtaining this information by [parsing the compiler logs](https://github.com/viperproject/prusti-dev/blob/b58ced8dfd14ef30582b503d517167ccd771eaff/prusti-interface/src/environment/borrowck/regions.rs#L25-L39). This is not only a hacky approach, but we also reached its limits. r? `@nikomatsakis`
2021-08-07Auto merge of #87408 - kornelski:try_reserve_error, r=yaahcbors-0/+1
Hide allocator details from TryReserveError I think there's [no need for TryReserveError to carry detailed information](https://github.com/rust-lang/rust/issues/48043#issuecomment-825139280), but I wouldn't want that issue to delay stabilization of the `try_reserve` feature. So I'm proposing to stabilize `try_reserve` with a `TryReserveError` as an opaque structure, and if needed, expose error details later. This PR moves the `enum` to an unstable inner `TryReserveErrorKind` that lives under a separate feature flag. `TryReserveErrorKind` could possibly be left as an implementation detail forever, and the `TryReserveError` get methods such as `allocation_size() -> Option<usize>` or `layout() -> Option<Layout>` instead, or the details could be dropped completely to make try-reserve errors just a unit struct, and thus smaller and cheaper.
2021-07-27Auto merge of #85305 - MarcusDunn:master, r=pnkfelixbors-1/+1
Stabilize bindings_after_at attempting to stabilze bindings_after_at [#65490](https://github.com/rust-lang/rust/issues/65490), im pretty new to the whole thing so any pointers are greatly appreciated.
2021-07-24Hide allocator details from TryReserveErrorKornel-0/+1
2021-07-22Enable compiler consumers to obtain Body with Polonius facts.Vytautas Astrauskas-0/+3
2021-06-29Support allocation failures when interperting MIRSmitty-0/+1
Note that this breaks Miri. Closes #79601
2021-06-06Add variance-related information to lifetime error messagesAaron Hill-0/+1
2021-06-04replaced feature-gate use with cfg_attrmarcusdunn-1/+1
2021-05-31Remove unused feature gatesbjorn3-4/+0
2021-05-26Specialize implementationsJacob Pratt-0/+1
Implementations in stdlib are now optimized as they were before.
2021-05-24remove cfg(bootstrap)Pietro Albini-1/+0
2021-05-18CTFE core engine allocation & memory API improvemenetsRalf Jung-0/+2
- make Allocation API offset-based (no more Pointer) - make Memory API higher-level (combine checking for access and getting access into one operation)
2021-04-18fix feature use in rustc libsRalf Jung-1/+0
2021-03-26Use iter::zip in compiler/Josh Stone-0/+1
2021-03-19stabilize or_patternsmark-1/+1
2021-03-18Remove unwrap_none/expect_none from compiler/.Mara Bos-1/+2
2021-03-12Implement valtreeOli Scherer-0/+4
valtree is a version of constants that is inherently safe to be used within types. This is in contrast to ty::Const which can have different representations of the same value. These representation differences can show up in hashing or equality comparisons, breaking type equality of otherwise equal types. valtrees do not have this problem.
2021-03-10Rename Option::get_or_insert_defaultCameron Steffen-1/+1
2021-03-08Use Option::get_or_defaultCameron Steffen-0/+1
2021-02-09Stabilize str_split_onceJacob Pratt-1/+0
2021-01-23Prevent query cycles during inliningoli-0/+2
2020-12-07Dogfood 'str_split_once() with `compiler/`Eric Arellano-0/+1
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{mir,privacy,traits,typeck}LeSeulArtichaut-0/+1
2020-09-26Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddybbors-0/+4
Fully destructure constants into patterns r? `@varkor` as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924 we should probably crater it once reviewed
2020-09-20Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJungbors-3/+2
Rollup of 15 pull requests Successful merges: - #76722 (Test and fix Send and Sync traits of BTreeMap artefacts) - #76766 (Extract some intrinsics out of rustc_codegen_llvm) - #76800 (Don't generate bootstrap usage unless it's needed) - #76809 (simplfy condition in ItemLowerer::with_trait_impl_ref()) - #76815 (Fix wording in mir doc) - #76818 (Don't compile regex at every function call.) - #76821 (Remove redundant nightly features) - #76823 (black_box: silence unused_mut warning when building with cfg(miri)) - #76825 (use `array_windows` instead of `windows` in the compiler) - #76827 (fix array_windows docs) - #76828 (use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip)) - #76840 (Move to intra doc links in core/src/future) - #76845 (Use intra docs links in core::{ascii, option, str, pattern, hash::map}) - #76853 (Use intra-doc links in library/core/src/task/wake.rs) - #76871 (support panic=abort in Miri) Failed merges: r? `@ghost`
2020-09-20Add a query for dereferencing constants of reference typeOliver Scherer-0/+4
2020-09-20Rollup merge of #76825 - lcnr:array-windows-apply, r=varkorRalf Jung-0/+1
use `array_windows` instead of `windows` in the compiler I do think these changes are beautiful, but do have to admit that using type inference for the window length can easily be confusing. This seems like a general issue with const generics, where inferring constants adds an additional complexity which users have to learn and keep in mind.
2020-09-20Rollup merge of #76821 - est31:remove_redundant_nightly_features, ↵Ralf Jung-3/+0
r=oli-obk,Mark-Simulacrum Remove redundant nightly features Removes a bunch of redundant/outdated nightly features. The first commit removes a `core_intrinsics` use for which a stable wrapper has been provided since. The second commit replaces the `const_generics` feature with `min_const_generics` which might get stabilized this year. The third commit is the result of a trial/error run of removing every single feature and then adding it back if compile failed. A bunch of unused features are the result that the third commit removes.
2020-09-20Rollup merge of #76818 - hbina:dont_compile_regex_all_the_time, r=ecstatic-morseRalf Jung-0/+1
Don't compile regex at every function call. Use `SyncOnceCell` to only compile it once. I believe this still adds some kind of locking mechanism? Related issue: https://github.com/rust-lang/rust/issues/76817
2020-09-20Auto merge of #74949 - oli-obk:validate_const_eval_raw, r=RalfJungbors-2/+2
Validate constants during `const_eval_raw` This PR implements the groundwork for https://github.com/rust-lang/rust/issues/72396 * constants are now validated during `const_eval_raw` * to prevent cycle errors, we do not validate references to statics anymore beyond the fact that they are not dangling * the `const_eval` query ICEs if used on `static` items * as a side effect promoteds are now evaluated to `ConstValue::Scalar` again (since they are just a reference to the actual promoted allocation in most cases).
2020-09-20use `array_windows` instead of `windows` in the compilerBastian Kauschke-0/+1
2020-09-19Reflect the "do not call this query directly" mentality in its nameOliver Scherer-1/+1
2020-09-19Unify the names of const eval queries and their return typesOliver Scherer-2/+2
2020-09-19Rename const eval queries to reflect the validation changesOliver Scherer-2/+2
2020-09-18Implement a destination propagation passJonas Schievink-0/+1
2020-09-17Remove redundant #![feature(...)] 's from compiler/est31-3/+0
2020-09-17Don't compile regex at every function call.Hanif Bin Ariffin-0/+1
Use `SyncOnceCell` to only compile it once. I believe this still adds some kind of locking mechanism?
2020-08-30Extend dataflow framework to support arbitrary latticesDylan MacKenzie-0/+1
2020-08-30mv compiler to compiler/mark-0/+61