about summary refs log tree commit diff
path: root/tests/codegen-units
AgeCommit message (Collapse)AuthorLines
2025-09-01pub async fn implementation coroutine (func::{closure#0}) is monomorphized, ↵Andrew Zhogin-0/+99
when func itself is monomorphized
2025-06-27Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obkbors-5/+0
Stop collecting unmentioned constants This avoids generating useless dead LLVM IR. This appears to have regressed and/or been introduced in rust-lang/rust#53821 (unfortunately a very large PR - I don't see any direct discussion there of this particular change), but as far as I can tell is at least no longer necessary -- or we lack test coverage -- because none of our UI tests indicate diagnostics regressions. The adjusted codegen-units test has comments explicitly noting that these items should *not* be collected ("These are not referenced, so they do not produce mono-items"). I noticed this while looking at libcore LLVM IR we generate, which contained dead code references to the NOOP Waker item, which is never used inside libcore. Producing LLVM IR for it during libcore's compilation, only for that IR to get deleted by LLVM as unused, isn't useful. Note that the IR is generally all marked internal, too.
2025-06-22Stop collecting unmentioned constantsMark Rousskov-5/+0
This avoids generating useless dead LLVM IR.
2025-06-22Fix tests to drop now-skipped codegenMark Rousskov-11/+44
2025-06-21Skip collecting no-op DropGlue in vtablesMark Rousskov-0/+23
Since 122662 this no longer gets used in vtables, so we're safe to fully drop generating these empty functions. Those are eventually cleaned up by LLVM, but it's wasteful to produce them in the first place. This also adds a missing test for fn-ptr casts, which do still need to generate no-op drop glue. It's possible a future optimization could point all of those at the same drop glue (e.g., for *mut ()) rather than for each separate type, but that would require extra work for CFI and isn't particularly easy to do anyway.
2025-06-16tests: `{Meta,Pointee}Sized` in non-minicore testsDavid Wood-1/+7
As before, add `MetaSized` and `PointeeSized` traits to all of the non-minicore `no_core` tests so that they don't fail for lack of language items.
2025-05-09Remove mono item collection strategy override from -Zprint-mono-itemsTomasz Miąsko-65/+57
Previously `-Zprint-mono-items` would override the mono item collection strategy. When debugging one doesn't want to change the behaviour, so this was counter productive. Additionally, the produced behaviour was artificial and might never arise without using the option in the first place (`-Zprint-mono-items=eager` without `-Clink-dead-code`). Finally, the option was incorrectly marked as `UNTRACKED`. Resolve those issues, by turning `-Zprint-mono-items` into a boolean flag that prints results of mono item collection without changing the behaviour of mono item collection. For codegen-units test incorporate `-Zprint-mono-items` flag directly into compiletest tool. Test changes are mechanical. `-Zprint-mono-items=lazy` was removed without additional changes, and `-Zprint-mono-items=eager` was turned into `-Clink-dead-code`. Linking dead code disables internalization, so tests have been updated accordingly.
2025-01-27Remove -Zinline-in-all-cgus and clean up CGU partitioning testsBen Kimock-228/+183
2025-01-21remove support for the #[start] attributeRalf Jung-78/+81
2025-01-15Make sure we actually use the right trivial lifetime substs when eagerly ↵Michael Goulet-0/+13
monomorphizing drop for structs
2025-01-14Auto merge of #135496 - matthiaskrgr:rollup-ps0cjzn, r=matthiaskrgrbors-0/+6
Rollup of 7 pull requests Successful merges: - #134216 (Enable "jump to def" feature on patterns) - #134880 (Made `Path::name` only have item name rather than full name) - #135466 (Leak check in `impossible_predicates` to avoid monomorphizing impossible instances) - #135476 (Remove remnant of asmjs) - #135479 (mir borrowck: cleanup late-bound region handling) - #135493 (Fix legacy symbol mangling of closures) - #135495 (Add missing closing backtick in commit hook message 🐸) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-14Auto merge of #135313 - compiler-errors:needs-mono, r=BoxyUwUbors-0/+43
Eagerly mono drop for structs with lifetimes That is, use `!generics.requires_monomorphization()` rather than `generics.is_empty()` like the rest of the mono collector code.
2025-01-14Fix legacy symbol mangling of closuresMichael Goulet-0/+6
2025-01-10Eagerly collect mono items for non-generic closuresMichael Goulet-3/+16
2025-01-10Eagerly mono drop for structs with lifetimesMichael Goulet-0/+43
2024-12-17Use field init shorthand where possibleJosh Triplett-1/+1
Field init shorthand allows writing initializers like `tcx: tcx` as `tcx`. The compiler already uses it extensively. Fix the last few places where it isn't yet used.
2024-12-06Remove polymorphizationBen Kimock-334/+4
2024-11-28Share inline(never) generics across cratesMark Rousskov-0/+11
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-08-10Fix and enable disabled codegen-units testsBen Kimock-57/+38
2024-08-03Revert "Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix"Michael Goulet-17/+17
This reverts commit 13314df21b0bb0cdd02c6760581d1b9f1052fa7e, reversing changes made to 6e534c73c35f569492ed5fb5f349075d58ed8b7e.
2024-07-01Avoid MIR bloat in inliningScott McMurray-0/+1
In 126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later.
2024-06-05Detect pub structs never constructed and unused associated constants in traitsr0cky-17/+17
2024-05-31Run rustfmt on `tests/codegen-units/`.Nicholas Nethercote-228/+208
2024-05-27Omit non-needs_drop drop_in_place in vtablesMark Rousskov-18/+25
This replaces the drop_in_place reference with null in vtables. On librustc_driver.so, this drops about ~17k dynamic relocations from the output, since many vtables can now be placed in read-only memory, rather than having a relocated pointer included. This makes a tradeoff by adding a null check at vtable call sites. That's hard to avoid without changing the vtable format (e.g., to use a pc-relative relocation instead of an absolute address, and avoid the dynamic relocation that way). But it seems likely that the check is cheap at runtime.
2024-05-11Fix some minor issues from the ui-test auto-portingBen Kimock-38/+13
2024-03-22Codegen const panic messages as function callsMark Rousskov-3/+11
This skips emitting extra arguments at every callsite (of which there can be many). For a librustc_driver build with overflow checks enabled, this cuts 0.7MB from the resulting binary.
2024-02-22[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives许杰友 Jieyou Xu (Joe)-103/+103
2024-02-07Update testsr0cky-1/+8
2024-01-02Adjust compiler tests for unused_tuple_struct_fields -> dead_codeJake Goulding-8/+8
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-2/+8
2023-04-07Turn off inlining for codegen-unit testsBen Kimock-9/+7
2023-03-14Use `unused_generic_params` from crate metadataMichael Goulet-0/+15
2023-01-11Move /src/test to /testsAlbert Larsan-0/+2518