about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2024-07-04Auto merge of #127288 - lqd:typelen-cache, r=compiler-errorsbors-3/+16
cache type sizes in type-size limit visitor This is basically https://github.com/rust-lang/rust/pull/125507#issuecomment-2206813779 as lcnr can't open the PR now. Locally it reduces the `itertools` regression by quite a bit, to "only +50%" compared to nightly (that includes overhead from the local lack of artifact post-processing, and is just a data point to compare to the 10-20x timings without the cache). ```console Benchmark 1: cargo +stage1 build --release Time (mean ± σ): 2.721 s ± 0.009 s [User: 2.446 s, System: 0.325 s] Range (min … max): 2.710 s … 2.738 s 10 runs Benchmark 2: cargo +nightly build --release Time (mean ± σ): 1.784 s ± 0.005 s [User: 1.540 s, System: 0.279 s] Range (min … max): 1.778 s … 1.792 s 10 runs Summary cargo +nightly build --release ran 1.52 ± 0.01 times faster than cargo +stage1 build --release ``` On master, it's from 34s to the 2.7s above. r? compiler-errors
2024-07-04Align the changes to the lang decisionMaybe Lapkin-0/+8
2024-07-03Rollup merge of #127294 - ldm0:ldm_coroutine2, r=lcnrMatthias Krüger-1/+5
Less magic number for corountine
2024-07-04Less magic number for corountineLiu Dingming-1/+5
2024-07-03cache type sizes in type-size limit visitorRémy Rakic-3/+16
2024-07-03Add `constness` to `TraitDef`Deadbeef-1/+9
2024-07-03Rollup merge of #127145 - compiler-errors:as_lang_item, r=lcnrMatthias Krüger-45/+64
Add `as_lang_item` to `LanguageItems`, new trait solver Add `as_lang_item` which turns `DefId` into a `TraitSolverLangItem` in the new trait solver, so we can turn the large chain of if statements in `assemble_builtin_impl_candidates` into a match instead. r? lcnr
2024-07-03Auto merge of #125507 - compiler-errors:type-length-limit, r=lcnrbors-74/+193
Re-implement a type-size based limit r? lcnr This PR reintroduces the type length limit added in #37789, which was accidentally made practically useless by the caching changes to `Ty::walk` in #72412, which caused the `walk` function to no longer walk over identical elements. Hitting this length limit is not fatal unless we are in codegen -- so it shouldn't affect passes like the mir inliner which creates potentially very large types (which we observed, for example, when the new trait solver compiles `itertools` in `--release` mode). This also increases the type length limit from `1048576 == 2 ** 20` to `2 ** 24`, which covers all of the code that can be reached with craterbot-check. Individual crates can increase the length limit further if desired. Perf regression is mild and I think we should accept it -- reinstating this limit is important for the new trait solver and to make sure we don't accidentally hit more type-size related regressions in the future. Fixes #125460
2024-07-02Instance::resolve -> Instance::try_resolve, and other nitsMichael Goulet-5/+17
2024-07-02Make fn traits into first-class TraitSolverLangItems to avoid needing ↵Michael Goulet-9/+7
fn_trait_kind_from_def_id
2024-07-02add TyCtxt::as_lang_item, use in new solverMichael Goulet-37/+58
2024-07-02Fix spansMichael Goulet-7/+14
2024-07-02Re-implement a type-size based limitMichael Goulet-10/+104
2024-07-02Give Instance::expect_resolve a spanMichael Goulet-5/+7
2024-07-02Miscellaneous renamingMichael Goulet-58/+62
2024-07-02Miri function identity hack: account for possible inliningRalf Jung-2/+2
2024-07-02Rollup merge of #127230 - hattizai:patch01, r=saethlinMatthias Krüger-1/+1
chore: remove duplicate words remove duplicate words in comments to improve readability.
2024-07-02Rollup merge of #127224 - tgross35:pretty-print-exhaustive, r=RalfJungMatthias Krüger-16/+18
Make `FloatTy` checks exhaustive in pretty print This should prevent the default fallback if we add more float types in the future.
2024-07-02Rollup merge of #127146 - compiler-errors:fast-reject, r=lcnrMatthias Krüger-388/+4
Uplift fast rejection to new solver Self explanatory. r? lcnr
2024-07-02chore: remove duplicate wordshattizai-1/+1
2024-07-01Make `FloatTy` checks exhaustive in pretty printTrevor Gross-16/+18
This should prevent the default fallback if we add more float types in the future.
2024-06-30Uplift fast rejection to new solverMichael Goulet-388/+4
2024-06-29Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obkbors-4/+22
Implement new effects desugaring cc `@rust-lang/project-const-traits.` Will write down notes once I have finished. * [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>` * [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>` * [ ] add types and traits to minicore test * [ ] update rustc-dev-guide Fixes #119717 Fixes #123664 Fixes #124857 Fixes #126148
2024-06-28address review commentsDeadbeef-2/+2
2024-06-28Implement `Min` trait in new solverDeadbeef-0/+5
2024-06-28implement new effects desugaringDeadbeef-4/+17
2024-06-27supertrait_def_ids was already implemented in middleMichael Goulet-37/+3
2024-06-27supertrait_def_idsMichael Goulet-3/+2
2024-06-27Make queries more explicitMichael Goulet-4/+7
2024-06-26Auto merge of #126844 - scottmcm:more-ptr-cast-gvn, r=saethlinbors-0/+28
Remove more `PtrToPtr` casts in GVN This addresses two things I noticed in MIR: 1. `NonNull::<T>::eq` does `(a as *mut T) == (b as *mut T)`, but it could just compare the `*const T`s, so this removes `PtrToPtr` casts that are on both sides of a pointer comparison, so long as they're not fat-to-thin casts. 2. `NonNull::<T>::addr` does `transmute::<_, usize>(p as *const ())`, but so long as `T: Thin` that cast doesn't do anything, and thus we can directly transmute the `*const T` instead. r? mir-opt
2024-06-25Auto merge of #125740 - RalfJung:transmute-size-check, r=oli-obkbors-8/+17
transmute size check: properly account for alignment Fixes another place where ZST alignment was ignored when checking whether something is a newtype. I wonder how many more of these there are... Fixes https://github.com/rust-lang/rust/issues/101084
2024-06-24Replace Deref bounds on Interner in favor of a SliceLike traitMichael Goulet-0/+14
2024-06-24Split out IntoIterator and non-Iterator constructors for ↵Michael Goulet-9/+14
AliasTy/AliasTerm/TraitRef/projection
2024-06-23Replace `f16` and `f128` pattern matching stubs with real implementationsTrevor Gross-1/+3
This section of code depends on `rustc_apfloat` rather than our internal types, so this is one potential ICE that we should be able to melt now. This also fixes some missing range and match handling in `rustc_middle`.
2024-06-22Add a `pointee_metadata_ty_or_projection` helperScott McMurray-0/+28
2024-06-21Rename a bunch of thingsMichael Goulet-22/+22
2024-06-20Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgrbors-0/+1
Rollup of 7 pull requests Successful merges: - #126380 (Add std Xtensa targets support) - #126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s ) - #126659 (More status-quo tests for the `#[coverage(..)]` attribute) - #126711 (Make Option::as_[mut_]slice const) - #126717 (Clean up some comments near `use` declarations) - #126719 (Fix assertion failure for some `Expect` diagnostics.) - #126730 (Add opaque type corner case test) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-20Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jieyouxuMatthias Krüger-0/+1
Clean up some comments near `use` declarations #125443 will reformat all `use` declarations in the repository. There are a few edge cases involving comments on `use` declarations that require care. This PR cleans up some clumsy comment cases, taking us a step closer to #125443 being able to merge. r? ``@lqd``
2024-06-20Auto merge of #116088 - nbdd0121:unwind, r=Amanieu,RalfJungbors-35/+1
Stabilise `c_unwind` Fix #74990 Fix #115285 (that's also where FCP is happening) Marking as draft PR for now due to `compiler_builtins` issues r? `@Amanieu`
2024-06-20Auto merge of #126409 - pacak:incr-uplorry, r=michaelwoeristerbors-11/+3
Trying to address an incremental compilation issues This pull request contains two independent changes, one makes it so when `try_force_from_dep_node` fails to recover a query - it marks the node as "red" instead of "green" and the second one makes Debug impl for `DepNode` less panicky if it encounters something from the previous compilation that doesn't map to anything in the current one. I'm not 100% confident that this is the correct approach, but so far I managed to find a bunch of comments suggesting that some things are allowed to fail in a certain way and changes I made are allowing for those things to fail this way and it fixes all the small reproducers I managed to find. Compilation panic this pull request avoids is caused by an automatically generated code on an associated type and it is not happening if something else marks it as outdated first (or close like that, but scenario is quite obscure). Fixes https://github.com/rust-lang/rust/issues/107226 Fixes https://github.com/rust-lang/rust/issues/125367
2024-06-20Add blank lines after module-level `//!` comments.Nicholas Nethercote-0/+1
Most modules have such a blank line, but some don't. Inserting the blank line makes it clearer that the `//!` comments are describing the entire module, rather than the `use` declaration(s) that immediately follows.
2024-06-19Stabilise c_unwindGary Guo-35/+1
2024-06-19local_def_path_hash_to_def_id can failMichael Baikov-11/+3
local_def_path_hash_to_def_id is used by Debug impl for DepNode and it looks for DefPathHash inside the current compilation. During incremental compilation we are going through nodes that belong to a previous compilation and might not be present and a simple attempt to print such node with tracing::debug (try_mark_parent_green does it for example) results in a otherwise avoidable panic Panic was added in https://github.com/rust-lang/rust/pull/82183, specifically in 2b60338ee9, with a comment "We only use this mapping for cases where we know that it must succeed.", but I'm not sure if this property holds when we traverse nodes from the old compilation in order to figure out if they are valid or not
2024-06-19Rollup merge of #126654 - tgross35:f16-f128-pretty-print, r=jackh726León Orell Valerian Liehr-1/+9
Make pretty printing for `f16` and `f128` consistent Currently the docs show e.g. {transmute(0xfffeffffffffffffffffffffffffffff): f128} for f128 constants. This should fix that to instead use apfloat for printing, as is done for `f32` and `f64`.
2024-06-19Rollup merge of #126594 - zetanumbers:fix-cross-crate-async-drop-glue, r=oli-obkLeón Orell Valerian Liehr-7/+16
Make async drop code more consistent with regular drop code Fixes #126573 Relates to #126482 r? ````@petrochenkov````
2024-06-18Make pretty printing for `f16` and `f128` consistentTrevor Gross-1/+9
Currently the docs show e.g. {transmute(0xfffeffffffffffffffffffffffffffff): f128} for f128 constants. This should fix that to instead use apfloat for printing, as is done for `f32` and `f64`.
2024-06-18Auto merge of #126614 - compiler-errors:uplift-next-trait-solver, r=lcnrbors-74/+432
Uplift next trait solver to `rustc_next_trait_solver` 🎉 There's so many FIXMEs! Sorry! Ideally this merges with the FIXMEs and we track and squash them over the near future. Also, this still doesn't build on anything other than rustc. I still need to fix `feature = "nightly"` in `rustc_type_ir`, and remove and fix all the nightly feature usage in the new trait solver (notably: let-chains). Also, sorry `@lcnr` I know you asked for me to separate the commit where we `mv rustc_trait_selection/solve/... rustc_next_trait_solver/solve/...`, but I had already done all the work by that point. Luckily, `git` understands the file moves so it should still be relatively reviewable. If this is still very difficult to review, then I can do some rebasing magic to try to separate this out. Please let me know! r? lcnr
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-4/+6
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18Fix transmute goalMichael Goulet-0/+4
2024-06-18Uplift the new trait solverMichael Goulet-84/+417