about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-01-27internally change regions to be covariantAli MJ Al-Nasrawy-12/+2
2023-01-26previous thir unpretty output through thir-flatb-naber-0/+7
2023-01-26Make make_identity take CanonicalVarInfosMichael Goulet-27/+25
2023-01-26Intern CanonicalVarValuesMichael Goulet-31/+31
2023-01-26Auto merge of #106812 - oli-obk:output_filenames, r=petrochenkovbors-1/+2
make `output_filenames` a real query part of #105462 This may be a perf regression and is not obviously the right way forward. We may store this information in the resolver after freezing it for example.
2023-01-26Rollup merge of #107150 - Nilstrieb:thread-local-cleanups, r=cjgillotMatthias Krüger-178/+190
`ty::tls` cleanups Pull it out into a separate file, make the conditional compilation more obvious and give the internal functions better names. Pulled out of #106311 r? cjgillot
2023-01-26output tree representation for thir-treeb-naber-3/+885
2023-01-26Auto merge of #107318 - matthiaskrgr:rollup-776kd81, r=matthiaskrgrbors-644/+14
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 #107304 - ↵Matthias Krüger-644/+14
Nilstrieb:ᐸTy as PartialEqᐳ::eq because what else are we gonna use in rustc_middle, r=compiler-errors Use `can_eq` to compare types for default assoc type error This correctly handles inference variables like `{integer}`. I had to move all of this `note_and_explain` code to `rustc_infer`, it made no sense for it to be in `rustc_middle` anyways. The commits are reviewed separately. Fixes #106968
2023-01-26Auto merge of #107314 - matthiaskrgr:rollup-j40lnlj, r=matthiaskrgrbors-113/+122
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-113/+122
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-4/+11
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-25Rollup merge of #105345 - yanchen4791:issue-103582-fix, r=jackh726Matthias Krüger-0/+24
Add hint for missing lifetime bound on trait object when type alias is used Fix issue #103582. The problem: When a type alias is used to specify the return type of the method in a trait impl, the suggestion for fixing the problem of "missing lifetime bound on trait object" of the trait impl will not be created. The issue caused by the code which searches for the return trait objects when constructing the hint suggestion is not able to find the trait objects since they are specified in the type alias path instead of the return path of the trait impl. The solution: Trace the trait objects in the type alias path and provide them along with the alias span to generate the suggestion in case the type alias is used in return type of the method in the trait impl.
2023-01-25Use `can_eq` to compare types for default assoc type errorNilstrieb-11/+8
This works correctly with inference variables.
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