about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/src/partitioning.rs
AgeCommit message (Collapse)AuthorLines
2025-01-27Change `collect_and_partition_mono_items` tuple return type to a structOli Scherer-9/+8
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-1/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-2/+3
2024-12-06Remove polymorphizationBen Kimock-13/+8
2024-11-28Share inline(never) generics across cratesMark Rousskov-8/+24
This reduces code sizes and better respects programmer intent when marking inline(never). Previously such a marking was essentially ignored for generic functions, as we'd still inline them in remote crates.
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-1/+1
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-12Querify MonoItem collectionBen Kimock-0/+15
2024-10-26Effects cleanupDeadbeef-2/+2
- removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-14Add fast-path when computing the default visibilityUrgau-0/+7
2024-10-01Replace -Z default-hidden-visibility with -Z default-visibilityDavid Lattimore-19/+15
MCP: https://github.com/rust-lang/compiler-team/issues/782 Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2024-09-24Dogfood `feature(file_buffered)`Josh Stone-3/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-4/+8
2024-09-11Simplify some nested if statementsMichael Goulet-4/+2
2024-08-29Add `warn(unreachable_pub)` to `rustc_monomorphize`.Nicholas Nethercote-1/+1
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-2/+0
closures
2024-08-15Rollup merge of #129067 - cuviper:append, r=wesleywiserMatthias Krüger-2/+2
Use `append` instead of `extend(drain(..))` The first commit adds `IndexVec::append` that forwards to `Vec::append`, and uses it in a couple places. The second commit updates `indexmap` for its new `IndexMap::append`, and also uses that in a couple places. These changes are similar to what [`clippy::extend_with_drain`](https://rust-lang.github.io/rust-clippy/master/index.html#/extend_with_drain) would suggest, just for other collection types.
2024-08-13Update `indexmap` and use `IndexMap::append`Josh Stone-2/+2
2024-08-13Use is_lang_item moreMichael Goulet-1/+3
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-15Introduce and provide a hook for `should_codegen_locally`Mohammad Omidvar-1/+3
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-32/+32
2024-06-14Use is_lang_item more aggressivelyMichael Goulet-1/+2
2024-06-03Stabilize order of MonoItems in CGUs and disallow query_instability lint for ↵Michael Woerister-32/+36
rustc_monomorphize
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_monomorphize`.Nicholas Nethercote-0/+1
2024-04-29Remove `extern crate rustc_middle` from numerous crates.Nicholas Nethercote-0/+1
2024-04-17Use non-exhaustive matches for TyKindDaria Sukhonina-1/+2
Also no longer export noop async_drop_in_place_raw
2024-04-16Add simple async drop glue generationzetanumbers-2/+5
Explainer: https://zetanumbers.github.io/book/async-drop-design.html https://github.com/rust-lang/rust/pull/121801
2024-03-20collector: recursively traverse 'mentioned' items to evaluate their constantsRalf Jung-7/+7
2024-03-14Rollup merge of #122287 - RalfJung:simd-static-assert, r=pnkfelixMatthias Krüger-0/+3
add test ensuring simd codegen checks don't run when a static assertion failed stdarch relies on this to ensure that SIMD indices are in bounds. I would love to know why this works, but I can't figure out where codegen decides to not codegen a function if a required-const does not evaluate. `@oli-obk` `@bjorn3` do you have any idea?
2024-03-13coverage: Remove all unstable values of `-Cinstrument-coverage`Zalathar-3/+1
2024-03-10add comments explaining where post-mono const eval errors abort compilationRalf Jung-0/+3
2024-02-14clean up potential_query_instability with FxIndexMap and UnordMapyukang-2/+2
2024-02-06Rollup merge of #120602 - klensy:mono-comment, r=nnethercoteMatthias Krüger-1/+1
rustc_monomorphize: fix outdated comment in partition `max_cgu_count` was removed in https://github.com/rust-lang/rust/commit/51821515b3ccd7dd8f42ffd6a2eee536dcf7ddb0, but not comment (usage in `merge_codegen_units` was removed earlier). r? `@nnethercote`
2024-02-06Fix drop shim for AsyncFnOnce closure, AsyncFnMut shim for AsyncFn closureMichael Goulet-2/+2
2024-02-06Construct body for by-move coroutine closure outputMichael Goulet-1/+3
2024-02-06Build a shim to call async closures with different AsyncFn trait kindsMichael Goulet-0/+2
2024-02-03rustc_monomorphize: fix outdated comment in partitionklensy-1/+1
2024-01-21Rollup merge of #118811 - EbbDrop:is-sorted-by-bool, r=Mark-SimulacrumNadrieril-2/+2
Use `bool` instead of `PartiolOrd` as return value of the comparison closure in `{slice,Iteraotr}::is_sorted_by` Changes the function signature of the closure given to `{slice,Iteraotr}::is_sorted_by` to return a `bool` instead of a `PartiolOrd` as suggested by the libs-api team here: https://github.com/rust-lang/rust/issues/53485#issuecomment-1766411980. This means these functions now return true if the closure returns true for all the pairs of values.
2024-01-20Use bool instead of PartiolOrd in is_sorted_byEbbDrop-2/+2
2024-01-10Rename `{create,emit}_warning` as `{create,emit}_warn`.Nicholas Nethercote-1/+1
For consistency with `warn`/`struct_warn`, and also `{create,emit}_err`, all of which use an abbreviated form.
2023-12-24Remove more `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-1/+1
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-3/+3
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-15Auto merge of #118770 - saethlin:fix-inline-never-uses, r=nnethercotebors-3/+9
Fix cases where std accidentally relied on inline(never) This PR increases the power of `-Zcross-crate-inline-threshold=always` so that it applies through `#[inline(never)]`. Note that though this is called "cross-crate-inlining" in this case especially it is _just_ lazy per-CGU codegen. The MIR inliner and LLVM still respect the attribute as much as they ever have. Trying to bootstrap with the new `-Zcross-crate-inline-threshold=always` change revealed two bugs: We have special intrinsics `assert_inhabited`, `assert_zero_valid`, and `assert_mem_uniniitalized_valid` which codegen backends will lower to nothing or a call to `panic_nounwind`. Since we may not have any call to `panic_nounwind` in MIR but emit one anyway, we need to specially tell `MirUsedCollector` about this situation. `#[lang = "start"]` is special-cased already so that `MirUsedCollector` will collect it, but then when we make it cross-crate-inlinable it is only assigned to a CGU based on whether `MirUsedCollector` saw a call to it, which of course we didn't. --- I started looking into this because https://github.com/rust-lang/rust/pull/118683 revealed a case where we were accidentally relying on a function being `#[inline(never)]`, and cranking up cross-crate-inlinability seems like a way to find other situations like that. r? `@nnethercote` because I don't like what I'm doing to the CGU partitioning code here but I can't come up with something much better
2023-12-14Fix cases where std accidentally relied on inline(never)Ben Kimock-3/+9
2023-12-13Add unstable `-Zdefault-hidden-visibility` cmdline flag for `rustc`.Lukasz Anforowicz-1/+1
The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/656
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-3/+3
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-21coverage: Change query `codegened_and_inlined_items` to a plain functionZalathar-31/+0
This query has a name that sounds general-purpose, but in fact it has coverage-specific semantics, and (fortunately) is only used by coverage code. Because it is only ever called once (from one designated CGU), it doesn't need to be a query, and we can change it to a regular function instead.
2023-09-26subst -> instantiatelcnr-1/+1
2023-09-14treat host effect params as erased generics in codegenDeadbeef-2/+2
This fixes the changes brought to codegen tests when effect params are added to libcore, by not attempting to monomorphize functions that get the host param by being `const fn`.
2023-07-27Rollup merge of #113872 - nnethercote:tweak-cgu-sorting, r=pnkfelixMatthias Krüger-1/+1
Tweak CGU sorting in a couple of places. In `base.rs`, tweak how the CGU size interleaving works. Since #113777, it's much more common to have multiple CGUs with identical sizes. With the existing code these same-sized items ended up in the opposite-to-desired order due to the stable sorting. The code now starts with a reverse sort (like is done in `partitioning.rs`) which gives the behaviour we want. This doesn't matter much for perf, but makes profiles in `samply` look more like what we expect. In `partitioning.rs`, we can use `sort_by_key` instead of `sort_by_cached_key` because `CGU::size_estimate()` is cheap. (There is an identical CGU sort earlier in that function that already uses `sort_by_key`.) r? `@pnkfelix`