summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2024-06-20Only compute specializes query if specialization is enabled in the crate of ↵Michael Goulet-0/+4
the specialized impl (cherry picked from commit 4b188d9d667dfcc7ba4caf95e56cbb3a6697f292)
2024-06-06Rollup merge of #126099 - Nilstrieb:crate-loader-cleanups, r=jieyouxuJubilee-20/+15
Crate loader cleanups Minor cleanups I found while trying to understand how all of this works
2024-06-06Auto merge of #126068 - lqd:revert-124976, r=petrochenkovbors-9/+9
Revert "use `tcx.used_crates(())` more" before it reaches beta There are more open issues caused by #124976 than will be fixed by #125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time. fixes https://github.com/rust-lang/rust/issues/125474 fixes https://github.com/rust-lang/rust/issues/125484 fixes https://github.com/rust-lang/rust/issues/125646 fixes https://github.com/rust-lang/rust/issues/125707 fixes #126066 fixes #125934 fixes https://github.com/rust-lang/rust/issues/126021 r? `@petrochenkov` `@bors` p=1
2024-06-06Simplify string operations in crate loaderNilstrieb-6/+12
2024-06-06Remove constant parameter from `CrateLocator::new`Nilstrieb-14/+3
2024-06-06Revert "Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obk"Rémy Rakic-9/+9
This reverts commit eda4a35f365535af72118118a3597edf5a13c12d, reversing changes made to eb6b35b5bcb3c2a594cb29cd478aeb2893f49d30.
2024-06-04Add safe/unsafe to static inside extern blocksSantiago Pastorino-4/+8
2024-05-31Auto merge of #124662 - zetanumbers:needs_async_drop, r=oli-obkbors-0/+4
Implement `needs_async_drop` in rustc and optimize async drop glue This PR expands on #121801 and implements `Ty::needs_async_drop` which works almost exactly the same as `Ty::needs_drop`, which is needed for #123948. Also made compiler's async drop code to look more like compiler's regular drop code, which enabled me to write an optimization where types which do not use `AsyncDrop` can simply forward async drop glue to `drop_in_place`. This made size of the async block from the [async_drop test](https://github.com/zetanumbers/rust/blob/67980dd6fb11917d23d01a19c2cf4cfc3978aac8/tests/ui/async-await/async-drop.rs) to decrease by 12%.
2024-05-29Make `body_owned_by` return the body directly.Oli Scherer-7/+7
Almost all callers want this anyway, and now we can use it to also return fed bodies
2024-05-29Start implementing needs_async_drop and relatedDaria Sukhonina-0/+4
2024-05-26Give EarlyBinder a tcx parameterMichael Goulet-7/+7
We are gonna need it to uplift EarlyBinder
2024-05-23Auto merge of #125434 - nnethercote:rm-more-extern-tracing, r=jackh726bors-3/+6
Remove more `#[macro_use] extern crate tracing` Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via `#[macro_use]`. Continuing the work from #124511 and #124914. r? `@jackh726`
2024-05-23Rollup merge of #125409 - tbu-:pr_raw_dylib_only_windows, r=lcnrMatthias Krüger-3/+3
Rename `FrameworkOnlyWindows` to `RawDylibOnlyWindows` Frameworks are Apple-specific, no idea why it had "framework" in the name before.
2024-05-23Rollup merge of #124976 - petrochenkov:usedcrates, r=oli-obkMatthias Krüger-9/+9
rustc: Use `tcx.used_crates(())` more And explain when it should be used. Addresses comments from https://github.com/rust-lang/rust/pull/121167.
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_metadata`.Nicholas Nethercote-3/+6
2024-05-22Auto merge of #124686 - saethlin:rust-file-footer, r=fmeasebors-8/+32
Add a footer in FileEncoder and check for it in MemDecoder We have a few reports of ICEs due to decoding failures, where the fault does not lie with the compiler. The goal of this PR is to add some very lightweight and on-by-default validation to the compiler's outputs. If validation fails, we emit a fatal error for rmeta files in general that mentions the path that didn't load, and for incremental compilation artifacts we emit a verbose warning that tries to explain the situation and treat the artifacts as outdated. The validation currently implemented here is very crude, and yet I think we have 11 ICE reports currently open (you can find them by searching issues for `1002111927320821928687967599834759150`) which this simple validation would have detected. The structure of the code changes here should permit the addition of further validation code, such as a checksum, if it is merited. I would like to have code to detect corruption such as reported in https://github.com/rust-lang/rust/issues/124719, but I'm not yet sure how to do that efficiently, and this PR is already a good size. The ICE reports I have in mind that this PR would have smoothed over are: https://github.com/rust-lang/rust/issues/124469 https://github.com/rust-lang/rust/issues/123352 https://github.com/rust-lang/rust/issues/123376 [^1] https://github.com/rust-lang/rust/issues/99763 https://github.com/rust-lang/rust/issues/93900. --- [^1]: This one might be a compiler bug, but even if it is I think the workflow described is pushing the envelope of what we can support. This issue is one of the reasons this warning still asks people to file an issue.
2024-05-22rustc: Use `tcx.used_crates(())` moreVadim Petrochenkov-9/+9
And explain when it should be used.
2024-05-22Rename `FrameworkOnlyWindows` to `RawDylibOnlyWindows`Tobias Bucher-3/+3
Frameworks are Apple-specific, no idea why it had "framework" in the name before.
2024-05-21PR feedbackBen Kimock-3/+6
2024-05-21Add a footer in FileEncoder and check for it in MemDecoderBen Kimock-8/+29
2024-05-21Rename buffer_lint_with_diagnostic to buffer_lintXiretza-2/+2
2024-05-21Make early lints translatableXiretza-1/+1
2024-05-21Convert uses of BuiltinLintDiag::Normal to custom variantsXiretza-13/+12
This ensures all diagnostic messages are created at diagnostic emission time, making them translatable.
2024-05-21Reorder some `use` items.Nicholas Nethercote-15/+10
2024-05-21Reorder top-level attributes.Nicholas Nethercote-8/+9
And remove an unnecessary `feature(try_blocks)`.
2024-05-13Remove `extern crate rustc_middle` from `rustc_metadata`.Nicholas Nethercote-3/+6
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-1/+1
2024-05-02Rollup merge of #124582 - RalfJung:std-not-found, r=NilstriebGuillaume Gomez-4/+1
always print nice 'std not found' error when std is not found Fixes https://github.com/rust-lang/miri/issues/3529 Arguably Miri is doing something odd by letting people create no-std sysroots for arbitrary targets -- but equally arguably, there's no good reason for rustc to special-case the host triple here. Being a non-host triple does not imply the target is a no-std target, after all.
2024-05-01Step bootstrap cfgsMark Rousskov-1/+1
2024-05-01always print nice 'std not found error' when std is not foundRalf Jung-4/+1
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-3/+3
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-19/+23
And suggest adding the `#[coroutine]` to the closure
2024-04-23Auto merge of #123126 - oli-obk:feed_crate_num, r=davidtwcobors-33/+26
Enable `CrateNum` query feeding via `TyCtxt` Instead of having a magic function that violates some `TyCtxtFeed` invariants, add a `create_def` equivalent for `CrateNum`s. Note that this still isn't tracked by the query system (unlike `create_def`), and that feeding most `CrateNum` queries for crates other than the local one will likely cause performance regressions. These things should be attempted on their own separately, but this PR should stand on its own
2024-04-23Rollup merge of #124067 - RalfJung:weak-lang-items, r=davidtwcoMatthias Krüger-1/+1
weak lang items are not allowed to be #[track_caller] For instance the panic handler will be called via this import ```rust extern "Rust" { #[lang = "panic_impl"] fn panic_impl(pi: &PanicInfo<'_>) -> !; } ``` A `#[track_caller]` would add an extra argument and thus make this the wrong signature. The 2nd commit is a consistency rename; based on the docs [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html) and [here](https://rustc-dev-guide.rust-lang.org/lang-items.html) I figured "lang item" is more widely used. (In the compiler output, "lang item" and "language item" seem to be pretty even.)
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-04-19Prepare for `CrateNum` query feeding on creationOli Scherer-3/+4
2024-04-19Isolate `CrateNum` creation to `TyCtxt` methodsOli Scherer-12/+8
2024-04-19Move `stable_crate_ids` from `CrateStore` to `Untracked`Oli Scherer-25/+21
This way it's like `Definitions`, which creates `DefId`s by interning `DefPathData`s, but for interning stable crate hashes
2024-04-19Create new `CrateNum` only after knowing it's going to succeedOli Scherer-1/+1
2024-04-17consistency rename: language item -> lang itemRalf Jung-1/+1
2024-04-12linker: Remove laziness and caching from native search directory walksVadim Petrochenkov-12/+6
It shouldn't be necessary for performance now.
2024-04-12Rollup merge of #123827 - petrochenkov:searchdirs, r=NadrierilMatthias Krüger-4/+4
linker: Avoid some allocations in search directory iteration This is more a cleanup than actual optimization.
2024-04-12linker: Avoid some allocations in search directory iterationVadim Petrochenkov-4/+4
2024-04-11remove some things that do not need to beMatthias Krüger-1/+1
2024-04-09Auto merge of #123099 - oli-obk:span_tcx, r=petrochenkovbors-18/+20
Replace some `CrateStore` trait methods with hooks. Just like with the `CrateStore` trait, this avoids the cyclic definition issues with `CStore` being defined after TyCtxt, but needing to be used in TyCtxt.
2024-03-28Replace `RemapFileNameExt::for_codegen` with explicit callsUrgau-11/+5
2024-03-27Make `def_path_hash_to_def_id` a hookOli Scherer-5/+9
2024-03-27Move `CrateStore::expn_hash_to_expn_id` to a hookOli Scherer-11/+5
2024-03-27Start replacing `CStore` trait methods with hooks.Oli Scherer-4/+8
This also avoids the cyclic definition issues with CrateStore being defined after TyCtxt, but needing to be used in TyCtxt.
2024-03-24Rollup merge of #122757 - h1467792822:priv-dep, r=davidtwcoMatthias Krüger-11/+16
Fixed the `private-dependency` bug Fixed the private-dependency bug: If the directly dependent crate is loaded last and is not configured with `--extern`, it may be incorrectly set to `private-dependency` Fixes #122756