about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/util
AgeCommit message (Collapse)AuthorLines
2023-03-02Allow checking whether a type allows being uninitializedNilstrieb-1/+4
This is useful for clippy and for the future `MaybeUninit::assume_init` panics.
2023-02-27Unify all validity check intrinsicsNilstrieb-12/+22
Also merges the inhabitedness check into the query to further unify the code paths.
2023-02-23Unify validity checks into a single queryNilstrieb-3/+3
Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern. I am planning on adding a further initness to check, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one.
2023-02-14Make permit_uninit/zero_init fallibleMichael Goulet-23/+17
2023-02-14Don't ICE in might_permit_raw_init if reference is polymorphicMichael Goulet-2/+7
2023-02-02Stop deaggegating MIR.Camille GILLOT-79/+0
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-0/+1
2023-01-26add method_substs to CallKindKyle Matsuda-1/+2
2023-01-23Thread a ParamEnv down to might_permit_raw_initBen Kimock-1/+2
2023-01-09Assert defining anchor is set in take_opaque_typesMichael Goulet-1/+1
2022-12-15Make alignment checks a future incompat lintOli Scherer-2/+2
2022-12-14Ensure no one constructs `AliasTy`s themselvesOli Scherer-1/+1
2022-12-14Auto merge of #104986 - compiler-errors:opaques, r=oli-obkbors-2/+1
Combine `ty::Projection` and `ty::Opaque` into `ty::Alias` Implements https://github.com/rust-lang/types-team/issues/79. This PR consolidates `ty::Projection` and `ty::Opaque` into a single `ty::Alias`, with an `AliasKind` and `AliasTy` type (renamed from `ty::ProjectionTy`, which is the inner data of `ty::Projection`) defined as so: ``` enum AliasKind { Projection, Opaque, } struct AliasTy<'tcx> { def_id: DefId, substs: SubstsRef<'tcx>, } ``` Since we don't have access to `TyCtxt` in type flags computation, and because repeatedly calling `DefKind` on the def-id is expensive, these two types are distinguished with `ty::AliasKind`, conveniently glob-imported into `ty::{Projection, Opaque}`. For example: ```diff match ty.kind() { - ty::Opaque(..) => + ty::Alias(ty::Opaque, ..) => {} _ => {} } ``` This PR also consolidates match arms that treated `ty::Opaque` and `ty::Projection` identically. r? `@ghost`
2022-12-13Combine identical alias armsMichael Goulet-2/+1
2022-12-13Combine projection and opaque into aliasMichael Goulet-2/+2
2022-12-13squash OpaqueTy and ProjectionTy into AliasTyMichael Goulet-2/+2
2022-12-13ProjectionTy.item_def_id -> ProjectionTy.def_idMichael Goulet-1/+1
2022-12-13Use ty::OpaqueTy everywhereMichael Goulet-1/+1
2022-12-13Clarify what "this" meansOli Scherer-15/+3
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-1/+0
2022-11-28Make ObligationCtxt::normalize take cause by borrowMichael Goulet-2/+2
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-1/+2
2022-11-22Use `tcx.require_lang_item` instead of unwrappingMaybe Waffle-2/+2
2022-11-21Rollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnrMatthias Krüger-1/+1
Add `PolyExistentialPredicate` type alias Wrapping `ExistentialPredicate`s in a binder is very common, and this alias already exists for the `PolyExistential{TraitRef,Projection}` types.
2022-11-19drive-by: PolyExistentialPredicateMichael Goulet-1/+1
2022-11-15use `ocx` type relation routineslcnr-3/+3
2022-11-15add comment about opaque typeslcnr-0/+3
2022-11-15mv utility methods into separate modulelcnr-0/+62
2022-11-01Format dyn Trait better in type_name intrinsicMichael Goulet-10/+2
2022-11-01Rollup merge of #103798 - RalfJung:type_name, r=oli-obkYuki Okushi-0/+199
interpret: move type_name implementation to an interpreter-independent helper file This should avoid pinging rust-lang/miri each time that file changes, which is really not necessary. r? `@oli-obk`
2022-10-31interpret: move type_name implementation to an interpreter-independent ↵Ralf Jung-0/+199
helper file
2022-10-29Simplify lang item groupsCameron Steffen-9/+11
2022-10-05change might_permit_raw_init to fully detect LLVM UB, but not more than thatRalf Jung-0/+153
2022-08-03Auto merge of #100064 - RalfJung:disaligned, r=petrochenkovbors-16/+12
fix is_disaligned logic for nested packed structs https://github.com/rust-lang/rust/pull/83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests. Fixes https://github.com/rust-lang/rust/issues/99838
2022-08-03fix is_disaligned logic for nested packed structsRalf Jung-16/+12
2022-08-01Remove DefId from AssocItemContainer.Camille GILLOT-3/+6
2022-07-01cleanup mir visitor for `rustc::pass_by_value`lcnr-2/+2
2022-05-02rustc: Panic by default in `DefIdTree::parent`Vadim Petrochenkov-3/+3
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root. So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root. Same applies to `local_parent`/`opt_local_parent`.
2022-04-11Add new `Deinit` statement kindJakob Degen-26/+27
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-2/+2
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-02-19rustc_const_eval: adopt let else in more placesest31-6/+3
2022-02-12Handle Fn family trait call errrorDeadbeef-2/+2
2022-02-12Rebased and improved errorsDeadbeef-3/+1
2022-02-12Improve error messages even moreDeadbeef-0/+147
2021-12-22Store a `DefId` instead of an `AdtDef` in `AggregateKind::Adt`Aaron Hill-1/+2
The `AggregateKind` enum ends up in the final mir `Body`. Currently, any changes to `AdtDef` (regardless of how significant they are) will legitimately cause the overall result of `optimized_mir` to change, invalidating any codegen re-use involving that mir. This will get worse once we start hashing the `Span` inside `FieldDef` (which is itself contained in `AdtDef`). To try to reduce these kinds of invalidations, this commit changes `AggregateKind::Adt` to store just the `DefId`, instead of the full `AdtDef`. This allows the result of `optimized_mir` to be unchanged if the `AdtDef` changes in a way that doesn't actually affect any of the MIR we build.
2021-09-07Rename rustc_mir to rustc_const_eval.Camille GILLOT-0/+225