about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2023-01-25Move `note_and_explain_type_err` from `rustc_middle` to `rustc_infer`Nilstrieb-633/+6
This way we can properly deal with the types.
2023-01-25Auto merge of #103902 - vincenzopalazzo:macros/obligation_rulesv2, r=oli-obkbors-5/+7
use `LocalDefId` instead of `HirId` in trait resolution to simplify the obligation clause resolution This commit introduces a refactoring suggested by `@lcnr` to simplify the obligation clause resolution. This is just the first PR that introduces a type of refactoring, but others PRs will follow this to introduce name changing to change from the variable name from `body_id` to something else. Fixes https://github.com/rust-lang/rust/issues/104827 Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> `@rustbot` r? `@lcnr`
2023-01-25create and use GlobalAlloc::address_spaceErik Desjardins-1/+12
2023-01-23Thread a ParamEnv down to might_permit_raw_initBen Kimock-4/+11
2023-01-23Add comments and remove unnecessary codeBryan Garza-4/+5
2023-01-23Replace terminator-based const eval limitBryan Garza-1/+7
- 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-6/+2
2023-01-23Create stable metric to measure long computation in Const EvalBryan Garza-3/+15
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-23Point at specific field in struct literal when trait fulfillment failsNathan Fenner-0/+2
2023-01-23Add hint for missing lifetime bound on trait object when type alias is usedyanchen4791-0/+24
2023-01-23Auto merge of #107220 - JohnTitor:rollup-5pvuz0z, r=JohnTitorbors-2/+1
Rollup of 7 pull requests Successful merges: - #106796 (BPF: Disable atomic CAS) - #106886 (Make stage2 rustdoc and proc-macro-srv disableable in x.py install) - #107101 (Filter param-env predicates for errors before calling `to_opt_poly_trait_pred`) - #107109 (ThinBox: Add intra-doc-links for Metadata) - #107148 (remove error code from `E0789`, add UI test/docs) - #107151 (Instantiate dominators algorithm only once) - #107153 (Consistently use dominates instead of is_dominated_by) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-23fix: use LocalDefId instead of HirId in trait resVincenzo Palazzo-5/+7
use LocalDefId instead of HirId in trait resolution to simplify the obligation clause resolution Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-23Make `output_filenames` a real queryOli Scherer-1/+2
2023-01-23Rollup merge of #107153 - tmiasko:dominates, r=oli-obkYuki Okushi-1/+1
Consistently use dominates instead of is_dominated_by There is a number of APIs that answer dominance queries. Previously they were named either "dominates" or "is_dominated_by". Consistently use the "dominates" form. No functional changes.
2023-01-23Rollup merge of #107151 - tmiasko:dominators-no-inline, r=compiler-errorsYuki Okushi-1/+0
Instantiate dominators algorithm only once Remove inline from BasicBlocks::dominators to instantiate the dominator algorithm only once - in the rustc_middle crate.
2023-01-23Auto merge of #107136 - petrochenkov:dochidden, r=cjgillotbors-1/+3
rustc_metadata: Encode `doc(hidden)` flag to metadata To retrieve these flags rustdoc currently has to mass decode full attributes for items in the whole crate tree, so it's better to pre-compute it in advance. This is especially important for short-term performance of https://github.com/rust-lang/rust/pull/107054 because resolver cannot use memoization of query results yet.
2023-01-23Rollup merge of #104926 - spastorino:calculate_diverging_fallback-cleanups, ↵Dylan DPC-1/+1
r=lcnr Move relationships from FulfillmentContext to Inherited r? `@lcnr`
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-112/+110
...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-22Auto merge of #106975 - tmiasko:basic-blocks-cache, r=cjgillotbors-296/+74
Refactor basic blocks control flow caches No functional changes.
2023-01-22Rename relationships to infer_var_infoSantiago Pastorino-1/+1
2023-01-21rustc_metadata: Encode `doc(hidden)` flag to metadataVadim Petrochenkov-1/+3
To retrieve these flags rustdoc currently has to mass decode full attributes for items in the whole crate tree, so it's better to pre-compute it in advance. This is especially for short-term performance of https://github.com/rust-lang/rust/pull/107054 because resolver cannot use memoization of query results yet.
2023-01-21Remove some superfluous type parameters from layout.rs.Michael Benfield-3/+3
Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-01-21Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obkbors-10/+28
Use UnordMap and UnordSet for id collections (DefIdMap, LocalDefIdMap, etc) This PR changes the `rustc_data_structures::define_id_collections!` macro to use `UnordMap` and `UnordSet` instead of `FxHashMap` and `FxHashSet`. This should account for a large portion of hash-maps being used in places where they can cause trouble. The changes required are moderate but non-zero: - In some places the collections are extracted into sorted vecs. - There are a few instances where for-loops have been changed to extends. ~~Let's see what the performance impact is. With a bit more refactoring, we might be able to get rid of some of the additional sorting -- but the change set is already big enough. Unless there's a performance impact, I'd like to do further changes in subsequent PRs.~~ Performance does not seem to be negatively affected ([perf-run here](https://github.com/rust-lang/rust/pull/106977#issuecomment-1396776699)). Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). r? `@ghost`
2023-01-21Consistently use dominates instead of is_dominated_byTomasz Miąsko-1/+1
There is a number of APIs that answer dominance queries. Previously they were named either "dominates" or "is_dominated_by". Consistently use the "dominates" form. No functional changes.
2023-01-21Instantiate dominators algorithm only onceTomasz Miąsko-1/+0
Remove inline from BasicBlocks::dominators to instantiate the dominator algorithm only once - in the rustc_middle crate.
2023-01-21Use strict provenance APIs in ty::tlsNilstrieb-10/+21
2023-01-21Some ty::tls cleanupsNilstrieb-51/+53
Putting the cfged functions into a seperate module and giving them better names.
2023-01-21Move `ty::tls` to seperate fileNilstrieb-172/+171
2023-01-20Auto merge of #107106 - matthiaskrgr:rollup-g7r1ep0, r=matthiaskrgrbors-1/+1
Rollup of 6 pull requests Successful merges: - #106699 ([drop tracking] Visit break expressions ) - #106738 (Fix known-bug annotations) - #106891 (Tweak "borrow closure argument" suggestion) - #106928 (add raw identifier for keyword in suggestion) - #107065 (Clippy: Make sure to include in beta: Move `unchecked_duration_subtraction` to pedantic) - #107068 (autoderive Subdiagnostic for AddtoExternBlockSuggestion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-20Auto merge of #107105 - matthiaskrgr:rollup-rkz9t7r, r=matthiaskrgrbors-0/+5
Rollup of 8 pull requests Successful merges: - #106783 (Recover labels written as identifiers) - #106973 (Don't treat closures from other crates as local) - #106979 (Document how to get the type of a default associated type) - #107053 (signal update string representation for haiku.) - #107058 (Recognise double-equals homoglyph) - #107067 (Custom MIR: Support storage statements) - #107076 (Added const-generic ui test case for issue #106419) - #107091 (Fix broken format strings in `infer.ftl`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-01-20Rollup merge of #106928 - bvanjoi:print-keyword-raw-identifier, r=petrochenkovMatthias Krüger-1/+1
add raw identifier for keyword in suggestion fix https://github.com/rust-lang/rust/issues/106841
2023-01-20Rollup merge of #106979 - Nilstrieb:type-of-default-assoc-type, r=petrochenkovMatthias Krüger-0/+5
Document how to get the type of a default associated type
2023-01-20Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstriebbors-11/+13
Remove some `ref` patterns from the compiler Previous PR: https://github.com/rust-lang/rust/pull/105368 r? `@Nilstrieb`
2023-01-19Auto merge of #107038 - compiler-errors:dont-wfcheck-non-local-rpit, r=oli-obkbors-0/+7
Don't wf-check non-local RPITs We were using `ty::is_impl_trait_defn(..).is_none()` to check if we need to add WF obligations for an opaque type. This is *supposed* to be checking if the type is a TAIT, since RPITs' wfness is implied by wf checking its parent item, but since `is_impl_trait_defn` returns `None` for non-local RPIT and async futures, we unnecessarily consider wf predicates for an RPIT if it is coming from a foreign crate. Fixes #107036 r? `@oli-obk` but feel free to reassign
2023-01-20add raw identifier for keyword in suggestionbohan-1/+1
2023-01-19Encode whether foreign opaques are TAITs or notMichael Goulet-0/+7
2023-01-19Auto merge of #106910 - aliemjay:alias-ty-in-regionck, r=oli-obkbors-3/+18
even more unify Projection/Opaque handling in region outlives code edit: This continues ate the same pace as #106829. New changes are described in https://github.com/rust-lang/rust/pull/106910#issuecomment-1383251254. ~This touches `OutlivesBound`, `Component`, `GenericKind` enums.~ r? `@oli-obk` (because of overlap with #95474)
2023-01-19even more unify Projection/Opaque in outlives codeAli MJ Al-Nasrawy-3/+18
2023-01-19Allow for more efficient sorting when exporting Unord collections.Michael Woerister-4/+3
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-11/+30
2023-01-19Transform async ResumeTy in generator transformArpad Borsos-0/+9
- Eliminates all the `get_context` calls that async lowering created. - Replace all `Local` `ResumeTy` types with `&mut Context<'_>`. The `Local`s that have their types replaced are: - The `resume` argument itself. - The argument to `get_context`. - The yielded value of a `yield`. The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the `get_context` function is being used to convert that back to a `&mut Context<'_>`. Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection, but rather directly use `&mut Context<'_>`, however that would currently lead to higher-kinded lifetime errors. See <https://github.com/rust-lang/rust/issues/105501>. The async lowering step and the type / lifetime inference / checking are still using the `ResumeTy` indirection for the time being, and that indirection is removed here. After this transform, the generator body only knows about `&mut Context<'_>`.
2023-01-18Rollup merge of #107023 - scottmcm:stop-shouting, r=NilstriebMichael Goulet-27/+27
Stop using `BREAK` & `CONTINUE` in compiler Switching them to `Break(())` and `Continue(())` instead. Entirely search-and-replace, though there's one spot where rustfmt insisted on a reformatting too. libs-api would like to remove these constants (https://github.com/rust-lang/rust/pull/102697#issuecomment-1385705202), so stop using them in compiler to make the removal PR later smaller.
2023-01-18Rollup merge of #107004 - compiler-errors:new-solver-new-candidates-2, r=lcnrMichael Goulet-0/+5
Implement some candidates for the new solver (redux) Based on #106718, so the diff is hard to read without it. See [here](https://github.com/rust-lang/rust/compare/98700cf481bce946bff316b56836cfffd885127b...compiler-errors:rust:new-solver-new-candidates-2) for an easier view until that one lands. Of note: * 44af916020fb43c12070125c45b6dee4ec303bbc fixes a bug where we need to make the query response *inside* of a probe, or else we make no inference progress (I think) * 50daad5acd2f163d03e7ffab942534f09bc36e2e implements `consider_assumption` for traits and predicates. I'm not sure if using `sup` here is necessary or if `eq` is fine. * We decided that all of the `instantiate_constituent_tys_for_*` functions are verbose but ok, since they need to be exhaustive and the logic between each of them is not similar enough, right? r? ``@lcnr``
2023-01-18Rollup merge of #106753 - compiler-errors:rpitit-not-suggestable, r=spastorinoMichael Goulet-5/+12
Make sure that RPITITs are not considered suggestable Makes no sense to suggest `where impl Future<Output = ()>: Send`, for example.
2023-01-18Auto merge of #106503 - cjgillot:remap-nofilter, r=oli-obkbors-26/+1
Do not filter substs in `remap_generic_params_to_declaration_params`. The relevant filtering should have been performed by borrowck. Fixes https://github.com/rust-lang/rust/issues/105826 r? types
2023-01-18Auto and alias traitsMichael Goulet-0/+5
2023-01-18Rollup merge of #106718 - lcnr:solver-cycles, r=compiler-errorsDylan DPC-11/+6
finish trait solver skeleton work ### 648d661b4e0fcf55f7082894f577377eb451db4b The previous implementation didn't remove provisional entries which depended on the current goal if we're forced to rerun in case the provisional result of that entry is different from the new result. For reference, see https://rust-lang.github.io/chalk/book/recursive/search_graph.html. We should also treat inductive cycles as overflow, not ordinary ambiguity. ### 219a5de2517cebfe20a2c3417bd302f7c12db70c 6a1912be539dd5a3b3c10be669787c4bf0c1868a These two commits move canonicalization to the start of the queries which simplifies a bunch of stuff. I originally intended to keep stuff canonicalized for a while because I expected us to add a additional caches the trait solver, either for candidate assembly or for projections. We ended up not adding (and expect to not need) any of them so this just ends up being easier to understand. ### d78d5ad0979e965afde6500bccfa119b47063506 adds a special `eq` for the solver which doesn't care about obligations or spans ### 18704e6a78b7703e1bbb3856f015cb76c0a07a06 implements https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/projection.20cache r? `@compiler-errors`
2023-01-17Stop using `BREAK` & `CONTINUE` in compilerScott McMurray-27/+27
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-18remove assembly context and impl a bit morelcnr-0/+6
2023-01-18instantiate canonical vars eagerlylcnr-11/+0