about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta
AgeCommit message (Collapse)AuthorLines
2025-09-26Make `def_path_hash_to_def_id` not panic when passed an invalid hashLi-yao Xia-7/+8
2025-09-12Don't store defaultness for inherent impl itemsCameron Steffen-1/+4
2025-09-12Split AssocContainer::{InherentImpl,TraitImpl}Cameron Steffen-38/+14
2025-09-12Rename AssocItemContainer -> AssocContainerCameron Steffen-8/+8
2025-08-15Detect missing `derive` on unresolved attribute even when not importedEsteban Küber-0/+16
``` error: cannot find attribute `sede` in this scope --> $DIR/missing-derive-3.rs:20:7 | LL | #[sede(untagged)] | ^^^^ | help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute | LL | #[serde(untagged)] | + error: cannot find attribute `serde` in this scope --> $DIR/missing-derive-3.rs:14:7 | LL | #[serde(untagged)] | ^^^^^ | note: `serde` is imported here, but it is a crate, not an attribute --> $DIR/missing-derive-3.rs:4:1 | LL | extern crate serde; | ^^^^^^^^^^^^^^^^^^^ help: `serde` is an attribute that can be used by the derive macros `Deserialize` and `Serialize`, you might be missing a `derive` attribute | LL + #[derive(Deserialize, Serialize)] LL | enum B { | ```
2025-08-12Switch to a bitflags `MacroKinds` to support macros with more than one kindJosh Triplett-6/+24
Review everything that uses `MacroKind`, and switch anything that could refer to more than one kind to use `MacroKinds`. Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros, using the concrete `MacroRulesMacroExpander` type, and have it track which kinds it can handle. Eliminate the separate optional `attr_ext`, now that a `SyntaxExtension` can handle multiple macro kinds. This also avoids the need to downcast when calling methods on `MacroRulesMacroExpander`, such as `get_unused_rule`. Integrate macro kind checking into name resolution's `sub_namespace_match`, so that we only find a macro if it's the right type, and eliminate the special-case hack for attributes.
2025-08-10Detect struct construction with private field in field with defaultEsteban Küber-0/+1
When trying to construct a struct that has a public field of a private type, suggest using `..` if that field has a default value. ``` error[E0603]: struct `Priv1` is private --> $DIR/non-exhaustive-ctor.rs:25:39 | LL | let _ = S { field: (), field1: m::Priv1 {} }; | ------ ^^^^^ private struct | | | while setting this field | note: the struct `Priv1` is defined here --> $DIR/non-exhaustive-ctor.rs:14:4 | LL | struct Priv1 {} | ^^^^^^^^^^^^ help: the field `field1` you're trying to set has a default value, you can use `..` to use it | LL | let _ = S { field: (), .. }; | ~~ ```
2025-08-09Auto merge of #145146 - fee1-dead-contrib:push-zmqrkurlzrxy, r=nnethercotebors-1/+1
remove `P` Previous work: rust-lang/rust#141603 MCP: https://github.com/rust-lang/compiler-team/issues/878 cc `@nnethercote`
2025-08-09remove `P`Deadbeef-1/+1
2025-08-08rustc_metadata: remove unused private trait implsDeadbeef-87/+1
2025-08-07Move metadata symbol export from exported_non_generic_symbols to ↵bjorn3-14/+2
exported_symbols The metadata symbol must not be encoded in the crate metadata, and must be exported from proc-macros. Handling the export of the metadata symbol in exported_symbols handles both things at once without requiring manual fixups elsewhere.
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-14/+15
2025-07-31Move `rustc_middle::parameterized` to `rustc_metadata`.Nicholas Nethercote-32/+170
It's only used there.
2025-07-28Save names of used extern cratesKornel-0/+5
Tracks association between `self.sess.opts.externs` (aliases in `--extern alias=rlib`) and resolved `CrateNum` Intended to allow Rustdoc match the aliases in `--extern-html-root-url` Force-injected extern crates aren't included, since they're meant for the linker only
2025-07-28Clarify update_extern_crateKornel-5/+27
2025-07-28Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLiibors-4/+4
Some `let chains` clean-up Not sure if this kind of clean-up is welcoming because of size, but I decided to try out one r? compiler
2025-07-28use let chains in hir, lint, mirKivooeo-4/+4
2025-07-26Use the new attributes throughout the codebaseJonathan Brouwer-11/+6
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-25Limit defaultness to impl of traitCameron Steffen-2/+2
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-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-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-27Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkovMatthias Krüger-4/+0
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-25encode_cross_crate for hir attributesJana Dönszelmann-3/+7
2025-06-24Remove dependency injection for the panic runtimebjorn3-4/+0
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-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-24/+20
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-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-01Auto merge of #141730 - osiewicz:collect-crate-deps-postorder-use-indexset, ↵bors-2/+3
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
2025-05-29cstore: Use IndexSet as backing store for postorder dependenciesPiotr Osiewicz-2/+3
<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.
2025-05-27Do not get proc_macro from the sysroot in rustcbjorn3-1/+1
With the stage0 refactor the proc_macro version found in the sysroot will no longer always match the proc_macro version that proc-macros get compiled with by the rustc executable that uses this proc_macro. This will cause problems as soon as the ABI of the bridge gets changed to implement new features or change the way existing features work. To fix this, this commit changes rustc crates to depend directly on the local version of proc_macro which will also be used in the sysroot that rustc will build.
2025-05-21Introduce `tcx.anon_const_kind` queryBoxy-0/+5
2025-05-19Warning added when dependency crate has async drop types, and the feature is ↵Andrew Zhogin-0/+4
disabled
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-7/+7