about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2025-08-19Auto merge of #145600 - jieyouxu:rollup-jw0bpnt, r=jieyouxubors-1/+1
Rollup of 15 pull requests Successful merges: - rust-lang/rust#145338 (actually provide the correct args to coroutine witnesses) - rust-lang/rust#145429 (Couple of codegen_fn_attrs improvements) - rust-lang/rust#145452 (Do not strip binaries in bootstrap everytime if they are unchanged) - rust-lang/rust#145464 (Stabilize `const_pathbuf_osstring_new` feature) - rust-lang/rust#145474 (Properly recover from parenthesized use-bounds (precise capturing lists) plus small cleanups) - rust-lang/rust#145486 (Fix `unicode_data.rs` mention message) - rust-lang/rust#145490 (Trace some basic I/O operations in bootstrap) - rust-lang/rust#145493 (remove `should_render` in `PrintAttribute` derive) - rust-lang/rust#145500 (Port must_use to the new target checking) - rust-lang/rust#145505 (Simplify span caches) - rust-lang/rust#145510 (Visit and print async_fut local for async drop.) - rust-lang/rust#145511 (Rust build fails on OpenBSD after using file_lock feature) - rust-lang/rust#145532 (resolve: debug for block module) - rust-lang/rust#145533 (Reorder `lto` options from most to least optimizing) - rust-lang/rust#145537 (Do not consider a `T: !Sized` candidate to satisfy a `T: !MetaSized` obligation.) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-15Detect missing `derive` on unresolved attribute even when not importedEsteban Küber-0/+21
``` 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-15Merge link_name and export_namebjorn3-1/+1
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-09Rollup merge of #145103 - fee1-dead-contrib:push-plompruwywvk, r=compiler-errorsStuart Cook-87/+1
rustc_metadata: remove unused private trait impls These are impls for non-reachable traits that don't appear to be used. Please let me know if there is value in keeping some of them for now. cc `@cjgillot`
2025-08-08rustc_metadata: remove unused private trait implsDeadbeef-87/+1
2025-08-08Add target_env = "macabi" and target_env = "sim"Mads Marquart-1/+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-15/+17
2025-07-31Move `rustc_middle::parameterized` to `rustc_metadata`.Nicholas Nethercote-32/+170
It's only used there.
2025-07-28Support multiple crate versions in --extern-html-root-urlKornel-0/+8
2025-07-28Save names of used extern cratesKornel-0/+20
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-28Avoid redundant lookup in CrateLoader::existing_matchKornel-1/+1
2025-07-28Auto merge of #144469 - Kivooeo:chains-cleanup, r=SparrowLiibors-9/+8
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-9/+8
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-24generate elf symbol version in raw-dylibusamoi-1/+21
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