summary refs log tree commit diff
path: root/compiler/rustc_mir/src/const_eval
AgeCommit message (Collapse)AuthorLines
2020-09-30References to ZSTs may be at arbitrary aligned addressesOliver Scherer-5/+5
2020-09-28Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obkRalf Jung-6/+0
Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]` `rustc_allow_const_fn_ptr` was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need a bespoke attribute. Now this functionality is gated under `const_fn_fn_ptr_basics` (how concise!), and `#[allow_internal_unstable(const_fn_fn_ptr_basics)]` replaces `#[rustc_allow_const_fn_ptr]`. `const_fn_fn_ptr_basics` allows function pointer types to appear in the arguments and locals of a `const fn` as well as function pointer casts to be performed inside a `const fn`. Both of these were allowed in constants and statics already. Notably, this does **not** allow users to invoke function pointers in a const context. Presumably, we will use a nicer name for that (`const_fn_ptr`?). r? @oli-obk
2020-09-27Remove `rustc_allow_const_fn_ptr`Dylan MacKenzie-6/+0
This was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need the bespoke attribute.
2020-09-27Rollup merge of #77203 - ecstatic-morse:const-stability-attr-checks, r=oli-obkJonas Schievink-1/+1
Check for missing const-stability attributes in `rustc_passes` Currently, this happens as a side effect of `is_min_const_fn`, which is non-obvious. Also adds a test for this case, since we didn't seem to have one before.
2020-09-26Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddybbors-1/+40
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-25Change error in `fn_queries` to `delay_span_bug`Dylan MacKenzie-1/+1
This should be caught by the new check in `rustc_passes`. At some point, this function will be removed entirely.
2020-09-20Implement destructuring for all aggregates and for referencesOliver Scherer-2/+1
2020-09-20Add a query for dereferencing constants of reference typeOliver Scherer-1/+41
2020-09-19Reflect the "do not call this query directly" mentality in its nameOliver Scherer-3/+3
2020-09-19RustfmtOliver Scherer-2/+2
2020-09-19Address review commentsOliver Scherer-5/+5
2020-09-19Unify the names of const eval queries and their return typesOliver Scherer-10/+10
2020-09-19Rename const eval queries to reflect the validation changesOliver Scherer-7/+7
2020-09-19Do not call the `const_eval` query in mir interpretation except for caching ↵Oliver Scherer-1/+1
of nulary intrinsics
2020-09-19Replace `and_then` `map_err` `and_then` chain with a matchOliver Scherer-15/+16
2020-09-19`turn_into_const` is infallibleOliver Scherer-11/+7
2020-09-19Document `op_to_const`'s purposeOliver Scherer-0/+2
2020-09-19Stop using the `const_eval` query for initializers of staticsOliver Scherer-20/+11
As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
2020-09-19Validate constants during `const_eval_raw`Oliver Scherer-16/+35
2020-09-12move guaranteed{ne,eq} implementation to compile-time machineRalf Jung-3/+68
2020-09-04Change ty.kind to a methodLeSeulArtichaut-4/+4
2020-09-02pretty: trim paths of unique symbolsDan Aloni-2/+4
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-30mv compiler to compiler/mark-0/+1212