about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2025-07-18Rollup merge of #144059 - LorrensP-2158466:remove-crate-loader, r=petrochenkovMatthias Krüger-137/+149
Refactor `CrateLoader` into the `CStore` Removes the `CrateLoader` and moves the code to `CStore`. Now, if you want to use the `CrateLoader`, you can just use `CStore`. Should we rename `creader.rs` to `cstore.rs`? r? ``@petrochenkov``
2025-07-18inline CrateLoader inside of CStoreLorrensP-2158466-137/+149
2025-07-17parse `const trait Trait`Deadbeef-1/+1
2025-07-16resolve: Merge `NameBindingKind::Module` into `NameBindingKind::Res`Vadim Petrochenkov-5/+2
2025-07-15Define datastructures for `#[cfg]` attribute, move StrippedCfgItemJonathan Brouwer-1/+1
2025-07-14Rollup merge of #143217 - Periodic1911:link-ordinal, r=jdonszelmannJakub Beránek-7/+3
Port #[link_ordinal] to the new attribute parsing infrastructure Ports link_ordinal to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-07-13Retire hir::ForeignItemRef.Camille GILLOT-1/+1
2025-07-13Port `#[link_ordinal]` to the new attribute parsing infrastructure.Anne Stijns-7/+3
2025-07-12Clean up implementation of RPITIT assoc item loweringMichael Goulet-1/+1
2025-07-13query RPITIT in a trait or implbohan-16/+5
2025-07-04Add comment and move assertion.Camille GILLOT-8/+12
2025-07-04Lighten formatting.Camille GILLOT-5/+4
2025-07-04Reuse metadata file from work products.Camille GILLOT-27/+58
2025-07-04Save metadata among work products.Camille GILLOT-3/+20
2025-07-03Rollup merge of #143369 - bjorn3:cleanup_metadata_loading, r=lcnrGuillaume Gomez-95/+134
Various refactorings to the metadata loader
2025-07-03Make most CrateLocator fields privatebjorn3-27/+29
This ensures they don't get out of sync
2025-07-03Have a separate code path for -Zdual-proc-macrobjorn3-41/+56
This makes it clearer when the locator and when crate_rejections is updated
2025-07-03Pass CrateRejections separately from CrateLocatorbjorn3-63/+87
This allows all CrateLocator methods to take &self.
2025-07-03Deduplicate getting the path of a lib candidatebjorn3-6/+4
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-2/+2
2025-07-01Auto merge of #143013 - bjorn3:split_exported_symbols, r=oli-obkbors-18/+30
Split exported_symbols for generic and non-generic symbols This reduces metadata decoder overhead during the monomorphization collector.
2025-06-30Introduce `ByteSymbol`.Nicholas Nethercote-48/+77
It's like `Symbol` but for byte strings. The interner is now used for both `Symbol` and `ByteSymbol`. E.g. if you intern `"dog"` and `b"dog"` you'll get a `Symbol` and a `ByteSymbol` with the same index and the characters will only be stored once. The motivation for this is to eliminate the `Arc`s in `ast::LitKind`, to make `ast::LitKind` impl `Copy`, and to avoid the need to arena-allocate `ast::LitKind` in HIR. The latter change reduces peak memory by a non-trivial amount on literal-heavy benchmarks such as `deep-vector` and `tuple-stress`. `Encoder`, `Decoder`, `SpanEncoder`, and `SpanDecoder` all get some changes so that they can handle normal strings and byte strings. This change does slow down compilation of programs that use `include_bytes!` on large files, because the contents of those files are now interned (hashed). This makes `include_bytes!` more similar to `include_str!`, though `include_bytes!` contents still aren't escaped, and hashing is still much cheaper than escaping.
2025-06-28Remove unused feature gatesYotam Ofek-1/+0
2025-06-27Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkovMatthias Krüger-96/+18
Reduce special casing for the panic runtime See the individual commits for more info.
2025-06-27Split exported_symbols for generic and non-generic symbolsbjorn3-18/+30
This reduces metadata decoder overhead during the monomorphization collector.
2025-06-25Auto merge of #143026 - jdonszelmann:rollup-z7mkuyt, r=jdonszelmannbors-2/+3
Rollup of 7 pull requests Successful merges: - rust-lang/rust#142146 (Withdraw the claim `extern "C-cmse-nonsecure-*"` always matches `extern "C"`) - rust-lang/rust#142200 (`tests/ui`: A New Order [8/N]) - rust-lang/rust#142724 (Add runtime check to avoid overwrite arg in `Diag`) - rust-lang/rust#142809 (Add PrintTAFn flag for targeted type analysis printing) - rust-lang/rust#142976 (Check CoerceUnsized impl validity before coercing) - rust-lang/rust#142992 (Convert some ABI tests to use `extern "rust-invalid"`) - rust-lang/rust#143000 (Make `Sub`, `Mul`, `Div` and `Rem` `const_traits`) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-25Rollup merge of #142724 - xizheyin:avoid_overwrite_args, r=oli-obkJana Dönszelmann-2/+3
Add runtime check to avoid overwrite arg in `Diag` ## Origin PR description At first, I set up a `debug_assert` check for the arg method to make sure that `args` in `Diag` aren't easily overwritten, and I added the `remove_arg()` method, so that if you do need to overwrite an arg, then you can explicitly call `remove_arg()` to remove it first, then call `arg()` to overwrite it. For the code before the rust-lang/rust#142015 change, it won't compile because it will report an error ``` arg `instance`already exists. ``` This PR also modifies all diagnostics that fail the check to pass the check. There are two cases of check failure: 1. ~~Between *the parent diagnostic and the subdiagnostic*, or *between the subdiagnostics* have the same field between them. In this case, I renamed the conflicting fields.~~ 2. ~~For subdiagnostics stored in `Vec`, the rendering may iteratively write the same arg over and over again. In this case, I changed the auto-generation with `derive(SubDiagnostic)` to manually implementing `SubDiagnostic` and manually rendered it with `eagerly_translate()`, similar to https://github.com/rust-lang/rust/issues/142031#issuecomment-2984812090, and after rendering it I manually deleted useless arg with the newly added `remove_arg` method.~~ ## Final Decision After trying and discussing, we made a final decision. For `#[derive(Subdiagnostic)]`, This PR made two changes: 1. After the subdiagnostic is rendered, remove all args of this subdiagnostic, which allows for usage like `Vec<Subdiag>`. 2. Store `diag.args` before setting arguments, so that you can restore the contents of the main diagnostic after deleting the arguments after subdiagnostic is rendered, to avoid deleting the main diagnostic's arg when they have the same name args.
2025-06-25encode_cross_crate for hir attributesJana Dönszelmann-3/+7
2025-06-25Add runtime check to avoid overwrite arg easily in diag and store and ↵xizheyin-2/+3
restore snapshot when set subdiag arg Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-24Auto merge of #142979 - matthiaskrgr:rollup-szqah4e, r=matthiaskrgrbors-1/+1
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142645 (Also emit suggestions for usages in the `non_upper_case_globals` lint) - rust-lang/rust#142657 (mbe: Clean up code with non-optional `NonterminalKind`) - rust-lang/rust#142799 (rustc_session: Add a structure for keeping both explicit and default sysroots) - rust-lang/rust#142805 (Emit a single error when importing a path with `_`) - rust-lang/rust#142882 (Lazy init diagnostics-only local_names in borrowck) - rust-lang/rust#142883 (Add impl_trait_in_bindings tests from rust-lang/rust#61773) - rust-lang/rust#142943 (Don't include current rustc version string in feature removed help) - rust-lang/rust#142965 ([RTE-497] Ignore `c-link-to-rust-va-list-fn` test on SGX platform) - rust-lang/rust#142972 (Add a missing mailmap entry) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-24Make comment on activate_injected_dep a doc commentbjorn3-9/+9
2025-06-24Stop handling explicit dependencies on the panic runtimebjorn3-14/+7
You shouldn't ever need to explicitly depend on it. And we weren't checking that the panic runtime used the correct panic strategy either.
2025-06-24Remove dependency injection for the panic runtimebjorn3-74/+3
This used to be necessary for a correct linker order, but ever since the introduction of symbols.o adding the symbols in question to symbols.o would work just as well. We do still add dependencies on the panic runtime to the local crate, but not for #![needs_panic_runtime] crates. This also removes the runtime-depends-on-needs-runtime test. inject_dependency_if used to emit this error, but with symbols.o it is no longer important that there is no dependency and in fact it may be nice to have panic_abort and panic_unwind directly depend on libstd in the future for calling std::process::abort().
2025-06-24rustc_session: Add a structure for keeping both explicit and default sysrootsVadim Petrochenkov-1/+1
Also avoid creating and cloning sysroot unnecessarily.
2025-06-24Tweak `-Zinput-stats` and `-Zmeta-stats` output.Nicholas Nethercote-2/+3
To make it match `-Zmacro-stats`, and work better if you have enabled it for multiple crates. - Print each crate's name. - Print a `===` banner at the start and end for separation.
2025-06-24Reverse order of `-Zinput-stats` and `-Zmeta-stats` output.Nicholas Nethercote-0/+1
Currently they have the largest items at the end. I believe the rationale is that it saves you scrolling up through terminal output because the important stuff is at the bottom. But it's also surprising and a bit confusing, and I think the obvious order (big things at the top) is better.
2025-06-24Make stats code nicer.Nicholas Nethercote-11/+24
Taking inspiration from `-Zmacro-stats`: - Use "{prefix}" consistently. - Use names for column widths. - Write output in a single `eprint!` call, in an attempt to minimize interleaving of output from different rustc processes. - Use `repeat` for the long `---` banners.
2025-06-20Use gen blocks in the compiler instead of from_coroutineMichael Goulet-25/+21
2025-06-18Auto merge of #142689 - Urgau:rollup-4ho6835, r=Urgaubors-75/+123
Rollup of 6 pull requests Successful merges: - rust-lang/rust#135656 (Add `-Z hint-mostly-unused` to tell rustc that most of a crate will go unused) - rust-lang/rust#138237 (Get rid of `EscapeDebugInner`.) - rust-lang/rust#141614 (lint direct use of rustc_type_ir ) - rust-lang/rust#142123 (Implement initial support for timing sections (`--json=timings`)) - rust-lang/rust#142377 (Try unremapping compiler sources) - rust-lang/rust#142674 (remove duplicate crash test) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-18Rollup merge of #142377 - Urgau:unremap-rustc-dev, r=jieyouxuUrgau-75/+123
Try unremapping compiler sources See [#t-compiler/help > Span pointing to wrong file location (`rustc-dev` component)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Span.20pointing.20to.20wrong.20file.20location.20.28.60rustc-dev.60.20component.29/with/521087083). This PR is a follow-up to rust-lang/rust#141751 regarding the compiler side. Specifically we now take into account the `CFG_VIRTUAL_RUSTC_DEV_SOURCE_BASE_DIR` env from rust-lang/rust#141751 when trying to unremap sources from `$sysroot/lib/rustlib/rustc-src/rust` (the `rustc-dev` component install directory). Best reviewed commit by commit. cc ``@samueltardieu`` r? ``@jieyouxu``
2025-06-17apply clippy::or_fun_callklensy-3/+7
2025-06-15Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, ↵León Orell Valerian Liehr-29/+17
r=workingjubilee,saethlin Move metadata object generation for dylibs to the linker code This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time. Prerequisite of https://github.com/rust-lang/rust/issues/96708.
2025-06-15Un-remap `rustc-dev` component pathsUrgau-0/+22
2025-06-14Prepare `rustc-dev` component un-remapping in the compilerUrgau-75/+101
2025-06-13Rollup merge of #142069 - nnethercote:Zmacro-stats, r=petrochenkovMatthias Krüger-3/+3
Introduce `-Zmacro-stats` Introduce `-Zmacro-stats`. It collects data about macro expansions and prints them in a table after expansion finishes. It's very useful for detecting macro bloat, especially for proc macros. r? `@petrochenkov`
2025-06-12Overhaul the `thousands` module.Nicholas Nethercote-3/+3
It currently only inserts separators into `usize`s, because that's all that has been needed so far. `-Zmacro-stats` will need `isize` and `f64` handling, so this commit adds that.
2025-06-11Remove useless and wrong std crates special casing when un-remap sysrootUrgau-28/+1
2025-06-08raw dylib: ensure that we have applied standard ABI checksRalf Jung-12/+11
also unify error messages that do not seem to have a good reason to be different
2025-06-03Move metadata object generation for dylibs to the linker codebjorn3-29/+17
This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time.
2025-06-01Auto merge of #141730 - osiewicz:collect-crate-deps-postorder-use-indexset, ↵bors-10/+13
r=nnethercote cstore: Use IndexSet as backing store for postorder dependencies `<rustc_metadata::creader::CStore>::push_dependencies_in_postorder` showed up in new benchmarks from https://github.com/rust-lang/rustc-perf/pull/2143, hence I gave it a shot to remove an obvious O(n) there. r? nnethercote