summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2022-10-29Rollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=compiler-errorsGuillaume Gomez-15/+8
Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functions Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions` This allows to remove a lot of useless `.at(DUMMY_SP)`, making the code a bit nicer :3 r? `@compiler-errors`
2022-10-28Auto merge of #102674 - CastilloDel:master, r=oli-obkbors-15/+14
Remove allow(rustc::potential_query_instability) in rustc_const_eval The use of FxHashMap has been replaced with FxIndexMap. Related to #84447
2022-10-27Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functionsMaybe Waffle-15/+8
Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions`
2022-10-26Auto merge of #103572 - Dylan-DPC:rollup-a8bnxrw, r=Dylan-DPCbors-33/+34
Rollup of 6 pull requests Successful merges: - #95710 (Stabilize arbitrary_enum_discriminant, take 2) - #102706 (Support excluding the generation of the standalone docs) - #103428 (Removed verbose printing from the `PrettyPrinter` when printing constants) - #103543 (Update books) - #103546 (interpret: a bit of cast cleanup) - #103554 (rustdoc: add visible focus outline to rustdoc-toggle) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-26Rollup merge of #103546 - RalfJung:cast, r=oli-obkDylan DPC-31/+30
interpret: a bit of cast cleanup r? `@oli-obk`
2022-10-26Rollup merge of #103428 - SarthakSingh31:issue-94187, r=compiler-errorsDylan DPC-2/+4
Removed verbose printing from the `PrettyPrinter` when printing constants Partially solves #94187 by completing the first step described in [this comment](https://github.com/rust-lang/rust/issues/94187#issuecomment-1282339909).
2022-10-26Auto merge of #103284 - compiler-errors:const-sad, r=oli-obkbors-56/+16
Revert "Unify tcx.constness and param env constness checks" Too much of a perf regression https://github.com/rust-lang/rust/pull/102975#issuecomment-1282702513, and an attempt in #103263 didn't fix it except for just a tiny bit. This change isn't really needed (see https://github.com/rust-lang/rust/pull/102830#issuecomment-1272514096), so this should be an easy revert.
2022-10-26Auto merge of #103562 - Dylan-DPC:rollup-sheepp5, r=Dylan-DPCbors-4/+4
Rollup of 10 pull requests Successful merges: - #102951 (suggest type annotation for local statement initialed by ref expression) - #103209 (Diagnostic derives: allow specifying multiple alternative suggestions) - #103287 (Use a faster allocation size check in slice::from_raw_parts) - #103416 (Name the `impl Trait` in region bound suggestions) - #103430 (Workaround unstable stmt_expr_attributes for method receiver expressions) - #103444 (Remove extra type error after missing semicolon error) - #103520 (rustc_middle: Rearrange resolver outputs structures slightly) - #103533 (Use &self instead of &mut self for cast methods) - #103536 (Remove `rustc_driver::set_sigpipe_handler()`) - #103542 (Pinning tests for some `macro_rules!` errors discussed in the lang meeting) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-26Rollup merge of #103533 - jachris:cast-without-mut, r=oli-obkDylan DPC-4/+4
Use &self instead of &mut self for cast methods r? ``@oli-obk``
2022-10-26Auto merge of #103279 - compiler-errors:normalize-hack-back, r=lcnrbors-1/+8
Add eval hack in `super_relate_consts` back Partially reverts 01adb7e98d5656c06497f33dd2747df144e78356. This extra eval call *still* needs to happen, for example, in `normalize_param_env_or_error` when a param-env predicate has an unnormalized constant, since the param-env candidates never get normalized during candidate assembly (everywhere else we can assume that they are normalized fully). r? `@lcnr,` though I feel like I've assigned quite a few PRs to you in the last few days, so feel free to reassign to someone else familiar with this code if you're busy! cc #103243 (fixes the issue, but don't want to auto-close that until a backport is performed).
2022-10-25interpret: a bit of cast cleanupRalf Jung-31/+30
2022-10-25Use &self instead of &mut self for cast methodsJannis Christopher Köhl-4/+4
2022-10-25Auto merge of #102340 - JakobDegen:pass-manager-simplification, r=oli-obkbors-4/+0
Split phase change from `MirPass` The main goal here is to simplify the pass manager logic. `MirPass` no longer contains the `phase_change` method, and `run_passes` instead accepts an `Option<PhaseChange>`. The hope is that this addresses the comments (and maybe perf regression) from #99102 . r? `@oli-obk` cc `@RalfJung`
2022-10-25Rollup merge of #103122 - ouz-a:mir-technical-debt, r=oli-obkDylan DPC-25/+63
Remove misc_cast and validate types when casting Continuing our work in #102675 r? ````@oli-obk````
2022-10-25Added helper to prevent verbose printing from the `PrettyPrinter` when ↵Sarthak Singh-2/+4
printing constants
2022-10-23Split phase change from `MirPass`Jakob Degen-4/+0
2022-10-23Comment why normalization is needed for debug assertionsMichael Goulet-1/+8
2022-10-23remove misc_cast and validate typesouz-a-25/+63
2022-10-23Migrate all diagnosticsNilstrieb-30/+30
2022-10-20Rollup merge of #103315 - RalfJung:interpret-switchint-ice, r=bjorn3Matthias Krüger-1/+0
interpret: remove an incorrect assertion This fixes an ICE in Miri, [reported](https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/SwitchInt.20with.20no.20targets.3F) by `@saethlin.` The faulty assertion was introduced by https://github.com/rust-lang/rust/commit/432535da2b5144d467056efcfa6864d35ba2de0f, when a previously correct assertion checking that the `otherwise` target exists got replaced by this assertion checking that at least one more target beyond `otherwise` exists. Sadly we don't have a small reproducer so I don't think we can easily add a testcase.
2022-10-20interpret: remove an incorrect assertionRalf Jung-1/+0
2022-10-20Revert "Unify tcx.constness and param env constness checks"Michael Goulet-56/+16
This reverts commit bef8681a1837790f2745c1f6a7f8214af2fd7f5d. This reverts commit c646c4d403d8c88cd3450f859fbdc34ec26d5bb5.
2022-10-18Remove allow(rustc::potential_query_instability) in rustc_const_evalCastilloDel-15/+14
The use of FxHashMap has been replaced with FxIndexMap. For more information see https://github.com/rust-lang/rust/issues/84447
2022-10-15Surround type with backticksGimgim-1/+1
2022-10-14Rollup merge of #103018 - Rageking8:more-dupe-word-typos, r=TaKO8KiDylan DPC-2/+2
More dupe word typos I only picked those changes (from the regex search) that I am pretty certain doesn't change meaning and is just a typo fix. Do correct me if any fix is undesirable and I can revert those. Thanks.
2022-10-14more dupe word typosRageking8-2/+2
2022-10-13Delay intrinsic call until after we've determined the callee is a functionMichael Goulet-3/+1
2022-10-12Rollup merge of #102830 - compiler-errors:constness-parity, r=fee1-deadDylan DPC-16/+56
Unify `tcx.constness` query and param env constness checks The checks that we do in the `constness` query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into the `constness` query and call that from the `param_env` query. I'm not sure if this totally makes sense -- is there a case where `tcx.param_env()` would return a const param-env for an item whose `tcx.constness()` is `Constness::NotConst`? Because if not, it seems a bit dangerous that these two differ. Luckily, not many places actually use `tcx.constness()`, and the checks in `tcx.param_env()` seem stricter than the checks in `tcx.constness()` (at least for the types of items we type-check). Also, due to the way that `tcx.param_env()` is implemented, it _never_ used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).
2022-10-12Use `tidy-alphabetical` in the compilerNilstrieb-3/+5
2022-10-12Unify tcx.constness and param env constness checksMichael Goulet-16/+56
2022-10-08Rollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obkMatthias Krüger-11/+11
Remove `mir::CastKind::Misc` As discussed in #97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast. r? ````@oli-obk````
2022-10-07Auto merge of #102091 - RalfJung:const_err, r=oli-obkbors-107/+24
make const_err a hard error This lint has been deny-by-default with future incompat wording since [Rust 1.51](https://github.com/rust-lang/rust/pull/80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;) r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/71800 Fixes https://github.com/rust-lang/rust/issues/100114
2022-10-07make const_err a hard errorRalf Jung-107/+24
2022-10-07Change InferCtxtBuilder from enter to buildCameron Steffen-41/+39
2022-10-07Introduce TypeErrCtxtCameron Steffen-3/+3
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't need to.
2022-10-06Remove `mir::CastKind::Misc`ouz-a-11/+11
2022-10-06Auto merge of #99324 - reez12g:issue-99144, r=jyn514bors-3/+3
Enable doctests in compiler/ crates Helps with https://github.com/rust-lang/rust/issues/99144
2022-10-05change might_permit_raw_init to fully detect LLVM UB, but not more than thatRalf Jung-48/+155
2022-10-04Rollup merge of #102559 - compiler-errors:issue-102553, r=oli-obkDylan DPC-5/+11
Don't ICE when trying to copy unsized value in const prop When we have a trivially false where-clause predicate like `Self: Sized` where `Self = dyn Trait`, we sometimes don't throw an error during typeck for an illegal operation such as copying an unsized type. This, unfortunately, cannot be made into an error (at least not without some migration -- see #95611 for example), but we should at least not ICE, since this function will never actually be reachable from main, for example. r? `@RalfJung` since I think you added these assertions? but feel free to reassign. Fixes #102553
2022-10-02Don't ICE when trying to copy unsized value in const propMichael Goulet-5/+11
2022-10-01Change feature name to is_some_andCameron Steffen-1/+1
2022-10-01Refactor rustc lint APIMaybe Waffle-3/+3
2022-09-29Mark ignore(illustrative) on docs in ↵reez12g-3/+3
compiler/rustc_const_eval/src/interpret/validity.rs
2022-09-26remove cfg(bootstrap)Pietro Albini-4/+1
2022-09-25Rollup merge of #102194 - fee1-dead-contrib:improve-const-drop, r=oli-obkfee1-dead-11/+19
Note the type when unable to drop values in compile time
2022-09-24Note the type when unable to drop values in compile timeDeadbeef-11/+19
2022-09-23Auto merge of #102056 - b-naber:unevaluated, r=lcnrbors-13/+8
Introduce mir::Unevaluated Previously the distinction between unevaluated constants in the type-system and in mir was not explicit and a little confusing. Probably better to introduce its own type for that. r? `@lcnr`
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-2/+3
2022-09-22Rollup merge of #102113 - RalfJung:opty-assert-mem, r=oli-obkMatthias Krüger-1/+1
OpTy: fix a method taking self rather than &self r? `@oli-obk`
2022-09-22introduce mir::Unevaluatedb-naber-13/+7