about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2023-03-01Remove last instances of HashSet in query result types.Michael Woerister-2/+2
2023-02-28Make zeroed return an OptionRune Tynan-13/+8
2023-02-27Update MIR doc.Camille GILLOT-4/+0
2023-02-24Use `List::empty()` instead of `mk_substs(&[])`.Nicholas Nethercote-1/+1
2023-02-24Rename many interner functions.Nicholas Nethercote-7/+10
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-22Remove type-traversal trait aliasesAlan Egerton-10/+25
2023-02-20Minimal changes to make miri workRune Tynan-14/+4
2023-02-20Remove unused lifetimeRune Tynan-1/+1
2023-02-20Add mentioned from_raw_bytes constructorRune Tynan-0/+17
2023-02-20Allow non-`Box` allocations in preparation for aligned const allocations for ↵Rune Tynan-28/+84
miri. Credit to emarteca for the code.
2023-02-19collect region contexts during mir renumberingb-naber-1/+1
2023-02-18Update compiler/rustc_middle/src/mir/syntax.rsCamille Gillot-1/+2
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-02-18Remove exception from MIR doc.Camille GILLOT-4/+0
2023-02-18Correct comment.Camille GILLOT-2/+4
2023-02-18Add comment.Camille GILLOT-0/+3
2023-02-18Auto merge of #108112 - nnethercote:clarify-iterator-interners, ↵bors-7/+5
r=oli-obk,compiler-errors Clarify iterator interners I found the iterator interners very confusing. This PR clarifies things. r? `@compiler-errors`
2023-02-17Rollup merge of #108154 - scottmcm:start-block-cleanup, r=compiler-errorsMatthias Krüger-3/+3
`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-7/+5
There are several `mk_foo`/`intern_foo` pairs, where the former takes an iterator and the latter takes a slice. (This naming convention is bad, but that's a fix for another PR.) This commit changes several `mk_foo` occurrences into `intern_foo`, avoiding the need for some `.iter()`/`.into_iter()` calls. Affected cases: - mk_type_list - mk_tup - mk_substs - mk_const_list
2023-02-16`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]Scott McMurray-3/+3
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-5/+3
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-2/+2
2023-02-16Replace some `then`s with some `then_some`sMaybe Waffle-1/+1
2023-02-15Rollup merge of #108047 - oli-obk:machine->🞋, r=RalfJungMatthias Krüger-18/+18
Use `target` instead of `machine` for mir interpreter integer handling. The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform. As per https://github.com/rust-lang/rust/pull/108029#issuecomment-1429791015 r? `@RalfJung`
2023-02-15Use target instead of machine for mir interpreter integer handling.Oli Scherer-18/+18
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-15Rollup merge of #107411 - cjgillot:dataflow-discriminant, r=oli-obkDylan DPC-0/+8
Handle discriminant in DataflowConstProp cc ``@jachris`` r? ``@JakobDegen`` This PR attempts to extend the DataflowConstProp pass to handle propagation of discriminants. We handle this by adding 2 new variants to `TrackElem`: `TrackElem::Variant` for enum variants and `TrackElem::Discriminant` for the enum discriminant pseudo-place. The difficulty is that the enum discriminant and enum variants may alias each another. This is the issue of the `Option<NonZeroUsize>` test, which is the equivalent of https://github.com/rust-lang/unsafe-code-guidelines/issues/84 with a direct write. To handle that, we generalize the flood process to flood all the potentially aliasing places. In particular: - any write to `(PLACE as Variant)`, either direct or through a projection, floods `(PLACE as OtherVariant)` for all other variants and `discriminant(PLACE)`; - `SetDiscriminant(PLACE)` floods `(PLACE as Variant)` for each variant. This implies that flooding is not hierarchical any more, and that an assignment to a non-tracked place may need to flood a tracked place. This is handled by `for_each_aliasing_place` which generalizes `preorder_invoke`. As we deaggregate enums by putting `SetDiscriminant` last, this allows to propagate the value of the discriminant. This refactor will allow to make https://github.com/rust-lang/rust/pull/107009 able to handle discriminants too.
2023-02-14Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgrbors-21/+8
Rollup of 9 pull requests Successful merges: - #107573 (Update the minimum external LLVM to 14) - #107626 (Fix `x fix` on the standard library itself) - #107673 (update ICU4X to 1.1.0) - #107733 (Store metrics from `metrics.json` to CI PGO timer) - #108007 (Use `is_str` instead of string kind comparison) - #108033 (add an unstable `#[rustc_coinductive]` attribute) - #108039 (Refactor refcounted structural_impls via functors) - #108040 (Use derive attributes for uninteresting traversals) - #108044 (interpret: rename Pointer::from_addr → from_addr_invalid) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-14Rollup merge of #108044 - RalfJung:from-addr-invalid, r=oli-obkMatthias Krüger-4/+6
interpret: rename Pointer::from_addr → from_addr_invalid This function corresponds to `ptr::invalid` in the standard library; the previous name was not clear enough IMO.
2023-02-14Use derive attributes for uninteresting traversalsAlan Egerton-17/+2
2023-02-14interpret: rename Pointer::from_addr → from_addr_invalidRalf Jung-4/+6
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-3/+7
2023-02-13Make atomic structural impls generic over InternerAlan Egerton-1/+5
2023-02-13Make folding traits generic over the InternerAlan Egerton-5/+5
2023-02-13Make visiting traits generic over the InternerAlan Egerton-2/+2
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-4/+4
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-1/+1
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-07miri: fix ICE when running out of address spaceRalf Jung-1/+6
2023-02-06Complete for_each_aliasing_place.Camille GILLOT-0/+8
2023-02-02Put a DefId in AggregateKind.Camille GILLOT-12/+19
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-8/+7
Improve enum checks Some light refactoring.
2023-01-31Review changesMaybe Waffle-2/+2
2023-01-30Use `Mutability::{is_mut, is_not}`Maybe Waffle-7/+3
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-1/+4
2023-01-30use a more descriptive nameTshepang Mbambo-3/+6
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-0/+9
Use stable metric for const eval limit instead of current terminator-based logic This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only. The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made). Also see: #103877
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-2/+2
2023-01-27Restrict amount of ignored locals.Camille GILLOT-2/+4
2023-01-27Remember where a type was kept in MIR.Camille GILLOT-1/+10
2023-01-26Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obkMatthias Krüger-1/+12
abi: add AddressSpace field to Primitive::Pointer ...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string (and various other changes), which will be done in a followup. (That is, if it's actually worth it to support multiple different pointer sizes. There is a lot of code that would be affected by that.) Fixes #106367 r? ``@oli-obk`` cc ``@Patryk27``
2023-01-25create and use GlobalAlloc::address_spaceErik Desjardins-1/+12
2023-01-23Add comments and remove unnecessary codeBryan Garza-4/+5