about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2023-02-17Rollup merge of #108154 - scottmcm:start-block-cleanup, r=compiler-errorsMatthias Krüger-1/+1
`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-1/+1
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-1/+1
2023-02-16changes from reviewKyle Matsuda-1/+5
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-4/+4
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-2/+2
2023-02-16Auto merge of #108096 - matthiaskrgr:rollup-ncexzf6, r=matthiaskrgrbors-43/+43
Rollup of 10 pull requests Successful merges: - #107034 (Migrating rustc_infer to session diagnostics (part 4)) - #107972 (Fix unintentional UB in ui tests) - #108010 (Make `InferCtxt::can_eq` and `InferCtxt::can_sub` return booleans) - #108021 (make x look for x.py if shell script does not exist) - #108047 (Use `target` instead of `machine` for mir interpreter integer handling.) - #108049 (Don't suggest `#[doc(hidden)]` trait methods with matching return type) - #108066 (Better names for illegal impl trait positions) - #108076 (rustdoc: Use more let chain) - #108088 (clarify correctness of `black_box`) - #108094 (Demonstrate I/O in File examples) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-15Auto merge of #108012 - compiler-errors:issue-107999, r=oli-obkbors-26/+28
Don't ICE in `might_permit_raw_init` if reference is polymorphic Emitting optimized MIR for a polymorphic function may require computing layout of a type that isn't (yet) known. This happens in the instcombine pass, for example. Let's fail gracefully in that condition. cc `@saethlin` fixes #107999
2023-02-15Rollup merge of #108047 - oli-obk:machine->🞋, r=RalfJungMatthias Krüger-43/+43
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-15Auto merge of #108006 - cjgillot:def-impl, r=oli-obkbors-1/+2
Avoid accessing HIR when it can be avoided Experiment to see if it helps some incremental cases. Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged. r? `@ghost`
2023-02-15Use target instead of machine for mir interpreter integer handling.Oli Scherer-43/+43
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-14Make permit_uninit/zero_init fallibleMichael Goulet-31/+28
2023-02-14Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgrbors-2/+2
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-14Add `of_trait` to DefKind::Impl.Camille GILLOT-1/+2
2023-02-14Rollup merge of #108044 - RalfJung:from-addr-invalid, r=oli-obkMatthias Krüger-2/+2
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-14interpret: rename Pointer::from_addr → from_addr_invalidRalf Jung-2/+2
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-21/+26
2023-02-14Don't ICE in might_permit_raw_init if reference is polymorphicMichael Goulet-2/+7
2023-02-13Make visiting traits generic over the InternerAlan Egerton-1/+1
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-1/+1
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-4/+4
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-10revert #107074lcnr-1/+10
2023-02-09Avoid some `tls::with` calls.Nicholas Nethercote-1/+1
These are in places where a `tcx` is easily obtained.
2023-02-08const_eval: `implies_by` in `rustc_const_unstable`David Wood-7/+22
Extend support for `implies_by` (from `#[stable]` and `#[unstable]`) to `#[rustc_const_stable]` and `#[rustc_const_unstable]`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-08Rollup merge of #107769 - compiler-errors:pointer-like, r=eholkMatthias Krüger-1/+1
Rename `PointerSized` to `PointerLike` The old name was unnecessarily vague. This PR renames a nightly language feature that I added, so I don't think it needs any additional approval, though anyone can feel free to speak up if you dislike the rename. It's still unsatisfying that we don't the user which of {size, alignment} is wrong, but this trait really is just a stepping stone for a more generalized mechanism to create `dyn*`, just meant for nightly testing, so I don't think it really deserves additional diagnostic machinery for now. Fixes #107696, cc ``@RalfJung`` r? ``@eholk``
2023-02-07Auto merge of #107768 - matthiaskrgr:rollup-9u4cal4, r=matthiaskrgrbors-16/+15
Rollup of 8 pull requests Successful merges: - #107719 (Remove `arena_cache` modifier from `upstream_monomorphizations_for`) - #107740 (Avoid locking the global context across the `after_expansion` callback) - #107746 (Split fn_ctxt/adjust_fulfillment_errors from fn_ctxt/checks) - #107749 (allow quick-edit convenience) - #107750 (make more readable) - #107755 (remove binder from query constraints) - #107756 (miri: fix ICE when running out of address space) - #107764 (llvm-16: Use Triple.h from new header location.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-07Rename PointerSized to PointerLikeMichael Goulet-1/+1
2023-02-07Rollup merge of #107756 - RalfJung:miri-out-of-addresses, r=oli-obkMatthias Krüger-16/+15
miri: fix ICE when running out of address space Fixes https://github.com/rust-lang/miri/issues/2769 r? `@oli-obk` I didn't add a test since that requires https://github.com/oli-obk/ui_test/issues/38 (host must be 64bit and target 32bit). Also the test takes ~30s, so I am not sure if we want to have it in the test suite?
2023-02-07Rollup merge of #107555 - edward-shen:edward-shen/dup-trait-suggestion, ↵Matthias Krüger-0/+1
r=compiler-errors Modify existing bounds if they exist Fixes #107335. This implementation is kinda gross but I don't really see a better way to do it. This primarily does two things: Modifies `suggest_constraining_type_param` to accept a new parameter that indicates a span to be replaced instead of added, if presented, and limit the additive suggestions to either suggest a new bound on an existing bound (see newly added unit test) or add the generics argument if a generics argument wasn't found. The former change is required to retain the capability to add an entirely new bounds if it was entirely omitted. r? ``@compiler-errors``
2023-02-07miri: fix ICE when running out of address spaceRalf Jung-16/+15
2023-02-06Modify existing bounds if they existEdward Shen-0/+1
2023-02-06interpret: move discriminant reading and writing to separate fileRalf Jung-234/+245
2023-02-05rustc_const_eval: remove huge error importsest31-37/+35
2023-02-02Introduce write_aggregate.Camille GILLOT-19/+29
2023-02-02Stop deaggegating MIR.Camille GILLOT-79/+0
2023-02-02Stop deaggregating enums in MIR.Camille GILLOT-17/+5
2023-02-02Interpret aggregates.Camille GILLOT-13/+16
2023-02-02Put a DefId in AggregateKind.Camille GILLOT-1/+1
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-7/+6
Improve enum checks Some light refactoring.
2023-01-31Auto merge of #107297 - Mark-Simulacrum:bump-bootstrap, r=pietroalbinibors-9/+9
Bump bootstrap compiler to 1.68 This also changes our stage0.json to include the rustc component for the rustfmt pinned nightly toolchain, which is currently necessary due to rustfmt dynamically linking to that toolchain's librustc_driver and libstd. r? `@pietroalbini`
2023-01-31Download rustc component for rustfmt toolchain as wellMark Rousskov-9/+9
2023-01-30Replace some `_ == _ || _ == _`s with `matches!(_, _ | _)`sMaybe Waffle-1/+1
2023-01-30Use `Mutability::{is_mut, is_not}`Maybe Waffle-2/+2
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-4/+3
2023-01-29Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obkbors-3/+15
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-27Remember where a type was kept in MIR.Camille GILLOT-2/+2
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-1/+5
2023-01-26add method_substs to CallKindKyle Matsuda-1/+2
2023-01-26change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add ↵Kyle Matsuda-2/+2
EarlyBinder to fn_sig in metadata
2023-01-26replace usages of fn_sig query with bound_fn_sigKyle Matsuda-3/+3