about summary refs log tree commit diff
path: root/compiler/rustc_metadata
AgeCommit message (Collapse)AuthorLines
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
2024-03-22Always encode implied_predicates query for traitsMichael Goulet-12/+2
With associated type bounds enabled, the implied_predicates and super_predicates queries may differ for traits, since associated type bounds are also implied but are not counted as super predicates.
2024-03-21Auto merge of #121123 - compiler-errors:item-assumptions, r=oli-obkbors-0/+24
Split an item bounds and an item's super predicates This is the moral equivalent of #107614, but instead for predicates this applies to **item bounds**. This PR splits out the item bounds (i.e. *all* predicates that are assumed to hold for the alias) from the item *super predicates*, which are the subset of item bounds which share the same self type as the alias. ## Why? Much like #107614, there are places in the compiler where we *only* care about super-predicates, and considering predicates that possibly don't have anything to do with the alias is problematic. This includes things like closure signature inference (which is at its core searching for `Self: Fn(..)` style bounds), but also lints like `#[must_use]`, error reporting for aliases, computing type outlives predicates. Even in cases where considering all of the `item_bounds` doesn't lead to bugs, unnecessarily considering irrelevant bounds does lead to a regression (#121121) due to doing extra work in the solver. ## Example 1 - Trait Aliases This is best explored via an example: ``` type TAIT<T> = impl TraitAlias<T>; trait TraitAlias<T> = A + B where T: C; ``` The item bounds list for `Tait<T>` will include: * `Tait<T>: A` * `Tait<T>: B` * `T: C` While `item_super_predicates` query will include just the first two predicates. Side-note: You may wonder why `T: C` is included in the item bounds for `TAIT`? This is because when we elaborate `TraitAlias<T>`, we will also elaborate all the predicates on the trait. ## Example 2 - Associated Type Bounds ``` type TAIT<T> = impl Iterator<Item: A>; ``` The `item_bounds` list for `TAIT<T>` will include: * `Tait<T>: Iterator` * `<Tait<T> as Iterator>::Item: A` But the `item_super_predicates` will just include the first bound, since that's the only bound that is relevant to the *alias* itself. ## So what This leads to some diagnostics duplication just like #107614, but none of it will be user-facing. We only see it in the UI test suite because we explicitly disable diagnostic deduplication. Regarding naming, I went with `super_predicates` kind of arbitrarily; this can easily be changed, but I'd consider better names as long as we don't block this PR in perpetuity.
2024-03-20Split item bounds and item super predicatesMichael Goulet-0/+24
2024-03-20Auto merge of #122359 - Zoxc:missing-static-notes, r=wesleywiserbors-8/+32
Print the crates not available as static This prints out the crates not available to be statically linked when static linking is preferred and we run into an error with duplicated crates.
2024-03-20Fixed the `private-dependency` bug: If the directly dependent crate is ↵h1467792822-11/+16
loaded last and is not configured with `--extern`, it may be incorrectly set to `private-dependency`
2024-03-20Rollup merge of #121543 - onur-ozkan:clippy-args, r=oli-obkMatthias Krüger-1/+1
various clippy fixes We need to keep the order of the given clippy lint rules before passing them. Since clap doesn't offer any useful interface for this purpose out of the box, we have to handle it manually. Additionally, this PR makes `-D` rules work as expected. Previously, lint rules were limited to `-W`. By enabling `-D`, clippy began to complain numerous lines in the tree, all of which have been resolved in this PR as well. Fixes #121481 cc `@matthiaskrgr`
2024-03-20resolve clippy errorsonur-ozkan-1/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-19Rollup merge of #122695 - surechen:make_only_local_explict_argument, r=lcnrMatthias Krüger-2/+2
Change only_local to a enum type. Change only_local to enum type and change the macros to always require a variant of that enum. r? `@lcnr`
2024-03-19Change only_local to enum type and change the macros to always require a ↵surechen-2/+2
variant of that enum.
2024-03-19Remove all checks of `IntrinsicDef::must_be_overridden` except for the ↵Oli Scherer-8/+3
actual overrides in codegen
2024-03-19Make `const_eval_select` a rustc_intrinsicOli Scherer-2/+4
2024-03-18Rollup merge of #122588 - klensy:imported_source_file, r=michaelwoeristerMatthias Krüger-10/+10
less useless filter calls in imported_source_file This reduces calls to `filter` greatly, giving 0.3% instructions win on some tests.
2024-03-16Rollup merge of #122605 - ↵León Orell Valerian Liehr-1/+2
osiewicz:metadata-register-crate-store-crate-name-in-profile, r=Nadrieril rustc-metadata: Store crate name in self-profile of metadata_register_crate When profiling a build of Zed, I found myself in need of names of crates that take the longest to register in downstream crates.
2024-03-16Rollup merge of #117918 - daxpedda:wasm-c-abi-warning, r=workingjubileeLeón Orell Valerian Liehr-1/+43
Add `wasm_c_abi` `future-incompat` lint This is a warning that will tell users to update to `wasm-bindgen` v0.2.88, which supports spec-compliant C ABI. The idea is to prepare for a future where Rust will switch to the spec-compliant C ABI by default; so not to break everyone's world, this warning is introduced. Addresses #71871.
2024-03-16rustc-metadata: Store crate name in self-profile of metadata_register_cratePiotr Osiewicz-1/+2
When profiling a build of Zed, I found myself in need of names of crates that take the longest to register in downstream crates.
2024-03-16Print the crates not available as staticJohn Kåre Alsaker-8/+32
2024-03-16less useless array builds in imported_source_fileklensy-10/+10
2024-03-16Add `wasm_c_abi` `future-incompat` lintdaxpedda-1/+43
2024-03-14hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`Vadim Petrochenkov-2/+2
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`
2024-03-12s/mt/mutability/Oli Scherer-4/+4
2024-03-12Ensure nested allocations in statics do not get deduplicatedOli Scherer-3/+6
2024-03-12Add `nested` bool to `DefKind::Static`.Oli Scherer-2/+4
Will be used in the next commit
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-14/+14
2024-03-11Rename `IntoDiagnostic` as `Diagnostic`.Nicholas Nethercote-7/+7
To match `derive(Diagnostic)`. Also rename `into_diagnostic` as `into_diag`.
2024-03-11Rename `IntoDiagnosticArg` as `IntoDiagArg`.Nicholas Nethercote-3/+3
Also rename `into_diagnostic_arg` as `into_diag_arg`, and `NotIntoDiagnosticArg` as `NotInotDiagArg`.
2024-03-09Rollup merge of #122187 - bjorn3:merge_header_version_checks, r=petrochenkovMatthias Krüger-45/+78
Move metadata header and version checks together This will make it easier to report rustc versions for older metadata formats. Split out of https://github.com/rust-lang/rust/pull/120855
2024-03-09Auto merge of #122010 - oli-obk:intrinsics3.0, r=pnkfelixbors-1/+1
Avoid invoking the `intrinsic` query for DefKinds other than `Fn` or `AssocFn` fixes the perf regression from https://github.com/rust-lang/rust/pull/120675 by only invoking (and thus inserting into the dep graph) the `intrinsic` query if the `DefKind` matches items that can actually be intrinsics
2024-03-08Move metadata header and version checks togetherbjorn3-45/+78
This will make it easier to report rustc versions for older metadata formats.
2024-03-07Rollup merge of #122114 - saethlin:cant-find-crate-spam, r=WaffleLapkinGuillaume Gomez-4/+18
Make not finding core a fatal error Similar to https://github.com/rust-lang/rust/pull/120472, this prevents terminal spam. In particular, it makes the good diagnostic visible when you try to use a target that's not installed.
2024-03-07Apply `EarlyBinder` only to `TraitRef` in `ImplTraitHeader`Yoshitomo Nakanishi-3/+2
2024-03-06Make not finding core a fatal errorBen Kimock-4/+18