about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2023-01-26Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgrbors-6/+1
Rollup of 9 pull requests Successful merges: - #97373 (impl DispatchFromDyn for Cell and UnsafeCell) - #106625 (Remove backwards compat for LLVM 12 coverage format) - #106779 (Avoid __cxa_thread_atexit_impl on Emscripten) - #106811 (Append .dwp to the binary filename instead of replacing the existing extension.) - #106836 (Remove optimistic spinning from `mpsc::SyncSender`) - #106946 (implement Hash for proc_macro::LineColumn) - #107074 (remove unnecessary check for opaque types) - #107287 (Improve fn pointer notes) - #107304 (Use `can_eq` to compare types for default assoc type error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-26Rollup merge of #107074 - lcnr:validate-dont-skip-opaque, r=compiler-errorsMatthias Krüger-6/+1
remove unnecessary check for opaque types this isn't needed and may hide some errors. after analysis there are no opaque types so it's a noop anyways before analysis there are opaque types but due to `Reveal::UserFacing` we don't reveal them. `is_subtype` simply discards the opaque type constraints as these will get checked again during mir borrowck. r? types want to land this after the beta-cutoff as mir validator changes are apparently pretty scary
2023-01-26Auto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgrbors-3/+3
Rollup of 11 pull requests Successful merges: - #106407 (Improve proc macro attribute diagnostics) - #106960 (Teach parser to understand fake anonymous enum syntax) - #107085 (Custom MIR: Support binary and unary operations) - #107086 (Print PID holding bootstrap build lock on Linux) - #107175 (Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`) - #107204 (suggest qualifying bare associated constants) - #107248 (abi: add AddressSpace field to Primitive::Pointer ) - #107272 (Implement ObjectSafe and WF in the new solver) - #107285 (Implement `Generator` and `Future` in the new solver) - #107286 (ICE in new solver if we see an inference variable) - #107313 (Add Style Team Triagebot config) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-26Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obkMatthias Krüger-3/+3
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-26Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillotbors-6/+12
InstCombine away intrinsic validity assertions This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.
2023-01-23Thread a ParamEnv down to might_permit_raw_initBen Kimock-6/+12
2023-01-23Add comments and remove unnecessary codeBryan Garza-5/+0
2023-01-23Add back Machine::before_terminator(...) methodBryan Garza-0/+13
Added it back because it's used by Miri, but in the compiler itself, it will not do anything (just return `Ok(())`.
2023-01-23Replace terminator-based const eval limitBryan Garza-24/+6
- Remove logic that limits const eval based on terminators, and use the stable metric instead (back edges + fn calls) - Add unstable flag `tiny-const-eval-limit` to add UI tests that do not have to go up to the regular 2M step limit
2023-01-23Remove debugging-related codeBryan Garza-5/+0
2023-01-23Create stable metric to measure long computation in Const EvalBryan Garza-0/+27
This patch adds a `MirPass` that tracks the number of back-edges and function calls in the CFG, adds a new MIR instruction to increment a counter every time they are encountered during Const Eval, and emit a warning if a configured limit is breached.
2023-01-23fix: use LocalDefId instead of HirId in trait resVincenzo Palazzo-4/+1
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-3/+3
...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, which will be done in a followup.
2023-01-20Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstriebbors-95/+89
Remove some `ref` patterns from the compiler Previous PR: https://github.com/rust-lang/rust/pull/105368 r? `@Nilstrieb`
2023-01-19remove unnecessary check for opaque typeslcnr-6/+1
2023-01-18Also remove `#![feature(control_flow_enum)]` where possibleScott McMurray-1/+0
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-6/+6
Switching them to `Break(())` and `Continue(())` instead. libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-26/+26
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-26/+26
2023-01-17Self review suggestionsMaybe Waffle-26/+33
- add back accidentally removed new lines - try to deref in patterns, rather than in expressions (maybe this was the reason of perf regression?...)
2023-01-17Review suggestionsMaybe Waffle-3/+3
2023-01-17Undo questionable changesMaybe Waffle-24/+25
2023-01-17tidyWaffle Maybe-1/+1
rustfmt, pleaaaaase, start supporting rust Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-01-17`rustc_const_eval`: remove `ref` patterns (+some pattern matching imps)Maybe Waffle-144/+130
2023-01-16Avoid trivial checks on cleanup control flow in MIR validatorJakob Degen-4/+11
2023-01-16Add cycle checking to cleanup control flow validationJakob Degen-18/+47
2023-01-16Document wf constraints on control flow in cleanup blocksJakob Degen-5/+57
Also fixes a bug in dominator computation
2023-01-12fix fmt and blessDeadbeef-1/+1
2023-01-12fix fn_sig iceDeadbeef-2/+13
2023-01-12attempt to make a minimal example workDeadbeef-0/+16
2023-01-12suggest adding const_trait_impl if error because of thatDeadbeef-1/+13
2023-01-11Rollup merge of #106648 - Nilstrieb:poly-cleanup, r=compiler-errorsnils-2/+1
Polymorphization cleanup Split out of #106233 Use a newtype instead of a bitset directly. This makes the code way easier to read and easier to adapt for future changes.
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-1/+1
2023-01-09Assert defining anchor is set in take_opaque_typesMichael Goulet-1/+1
2023-01-09Use newtype for unused generic parametersNilstrieb-2/+1
2023-01-04rename find_parent_node to opt_parent_idMichael Goulet-1/+1
2022-12-24Auto merge of #105085 - oli-obk:stop_promoting_all_the_things, r=RalfJungbors-8/+6
Stop promoting all the things fixes #91009 r? `@RalfJung`
2022-12-22Auto merge of #106054 - matthiaskrgr:rollup-38epsfh, r=matthiaskrgrbors-2/+4
Rollup of 6 pull requests Successful merges: - #105567 (KCFI test: Also support LLVM 16 output) - #105847 (Ensure param-env is const before calling `eval_to_valtree`) - #105983 (Add a missing early return in drop tracking `handle_uninhabited_return`) - #106027 (rustdoc: simplify CSS and DOM for more-scraped-examples) - #106035 (Migrate search tab title color to CSS variable) - #106037 (Add regression test for #94293) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-22Rollup merge of #105847 - compiler-errors:issue-104396, r=oli-obkMatthias Krüger-2/+4
Ensure param-env is const before calling `eval_to_valtree` Other queries call `ParamEnv::with_const` *inside* of the query itself (e.g. `const_eval_global_id_for_typeck`), so this could alternatively be moved into the provider of `eval_to_valtree` instead. I don't have a particularly strong opinion, though *theoretically* caching is better if we make the query keys more constrained. I'm not exactly sure how this is an effect of the `-Zmir-opt-level=3` flag. Maybe something about the inliner causes us to inline an unevaluated const into a body where it can be evaluated, but where it has not yet been normalized. This seems likely, since we're inlining `from_fn_1::<{ N / 2 }, _>` in `from_fn_2`, which means that we will need to evaluate that constant during the const prop pass after inlining. Fixes #104396
2022-12-22Auto merge of #103957 - JakobDegen:drop-retag, r=RalfJungbors-3/+12
Retag as FnEntry on `drop_in_place` This commit changes the mir drop shim to always retag its argument as if it were a `&mut`. cc rust-lang/unsafe-code-guidelines#373
2022-12-22Auto merge of #106025 - matthiaskrgr:rollup-vz5rqah, r=matthiaskrgrbors-3/+6
Rollup of 6 pull requests Successful merges: - #105837 (Don't ICE in `check_must_not_suspend_ty` for mismatched tuple arity) - #105932 (Correct branch-protection ModFlagBehavior for Aarch64 on LLVM-15) - #105960 (Various cleanups) - #105985 (Method chain nitpicks) - #105996 (Test that async blocks are `UnwindSafe`) - #106012 (Clarify that raw retags are not permitted in Mir) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-22Auto merge of #106023 - JohnTitor:rollup-k8mettz, r=JohnTitorbors-6/+17
Rollup of 8 pull requests Successful merges: - #105584 (add assert messages if chunks/windows are length 0) - #105602 (interpret: add read_machine_[ui]size convenience methods) - #105824 (str.lines() docstring: clarify that line endings are not returned) - #105980 (Refer to "Waker" rather than "RawWaker" in `drop` comment) - #105986 (Fix typo in reading_half_a_pointer.rs) - #105995 (Add regression test for #96530) - #106008 (Sort lint_groups in no_lint_suggestion) - #106014 (Add comment explaining what the scrape-examples-toggle.goml GUI test is about) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-12-21Don't run `Drop` terminators on types that do not have drop glue in const evalJakob Degen-3/+12
2022-12-22Rollup merge of #105602 - RalfJung:read-convenience, r=oli-obkYuki Okushi-6/+17
interpret: add read_machine_[ui]size convenience methods We have `read_pointer`, so it felt inconsistent to not also have these. r? ```@oli-obk```
2022-12-21Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJungbors-2/+4
Rename `assert_uninit_valid` intrinsic It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that. This is actually not fully correct though, as it does still panic for all uninit with `-Zstrict-init-checks`. I'm not sure what the best way is to deal with that not causing confusion. I guess we could just remove the flag? I don't think having it makes a lot of sense anymore with the direction that we have chose to go. It could be relevant again if #100423 lands so removing it may be a bit over eager. r? `@RalfJung`
2022-12-21Forbid `RetagKind::TwoPhase` as wellJakob Degen-2/+2
2022-12-21Clarify that raw retags are not permitted in MirJakob Degen-3/+6
2022-12-18Rollup merge of #105875 - matthiaskrgr:needless_borrowed_reference, r=oli-obkMatthias Krüger-1/+1
don't destuct references just to reborrow
2022-12-18don't restuct references just to reborrowMatthias Krüger-1/+1
2022-12-18avoid .into() conversion to identical typesMatthias Krüger-9/+6