Uh oh!
There was an error while loading. Please reload this page.
rustc: Use tcx.used_crates(()) more - #124976
Conversation
rustbot
commented
May 10, 2024
rustbot has assigned @compiler-errors. Use |
rustbot
commented
May 10, 2024
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in src/librustdoc/clean/types.rs cc @camelid Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
| // `crates` in most other cases too. | ||
| // Should be used to maintain observable language behavior, for example when collecting lang | ||
| // items or impls from all crates, or collecting libraries to link. | ||
| query used_crates(_: ()) -> &'tcx [CrateNum] { |
There was a problem hiding this comment.
"used" kind of sounds like if I add a crate as a dependency but don't use it, it doesn't show up.
Maybe required_crates?
Also all_crates could maybe need a more scary name, like crates_including_speculative or so?
There was a problem hiding this comment.
crates_including_speculative looks fine to me.
Not sure about required_crates.
Ideally I'd turn the used bool in crate loader into a 3-variant enum:
enumWhatCrateIsLoadedFor{ForRealThings,// Need to be encoded into metadata in any caseForDocLinksAndDiagnosticsOnly,// It may be possible to drop these ones from metadata, if we clean their traces from source map somehowForDiagnosticsOnly,}Maybe even merge it with existing enum CrateDepKind which is sort of similar.
Let's keep its pre-existing naming for now.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
compiler-errors
commented
May 22, 2024
@rustbot author |
And explain when it should be used.
oli-obk
commented
May 22, 2024
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
May 22, 2024
rustc: Use `tcx.used_crates(())` more And explain when it should be used. Addresses comments from rust-lang#121167.
petrochenkov
commented
May 22, 2024
I was just going to push an updated version. |
compiler-errors
commented
May 22, 2024
If you push, then it'll cancel the try. |
petrochenkov
commented
May 22, 2024
Also, in practice speculative crates are not common, so I don't expect much difference in perf. |
petrochenkov
commented
May 22, 2024
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
bors
commented
May 22, 2024
rustc: Use `tcx.used_crates(())` more And explain when it should be used. Addresses comments from rust-lang#121167.
bors
commented
May 23, 2024
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#124297 (Allow coercing functions whose signature differs in opaque types in their defining scope into a shared function pointer type) - rust-lang#124516 (Allow monomorphization time const eval failures if the cause is a type layout issue) - rust-lang#124976 (rustc: Use `tcx.used_crates(())` more) - rust-lang#125210 (Cleanup: Fix up some diagnostics) - rust-lang#125409 (Rename `FrameworkOnlyWindows` to `RawDylibOnlyWindows`) - rust-lang#125416 (Use correct param-env in `MissingCopyImplementations`) - rust-lang#125421 (Rewrite `core-no-oom-handling`, `issue-24445` and `issue-38237` `run-make` tests to new `rmake.rs` format) - rust-lang#125438 (Remove unneeded string conversion) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124976 - petrochenkov:usedcrates, r=oli-obk rustc: Use `tcx.used_crates(())` more And explain when it should be used. Addresses comments from rust-lang#121167.
| error: requires `sized` lang_item | ||
| error: aborting due to 4 previous errors | ||
| error: aborting due to 2 previous errors |
There was a problem hiding this comment.
Was this diagnostics change expected? (I'm analyzing the regressions caused by this PR)
There was a problem hiding this comment.
Yes, during my review I assumed this is the weak lang item check that now only looks at crates that are actually used, so we aren't speculatively looking at weak lang items of unused crates anymore
There was a problem hiding this comment.
From what I see libcore is loaded speculatively in this test (missing_core in fn resolve_crate) and this error happens due to (weak) lang items in core.
> Please ensure your PR description includes the following: > 1. A description of how your changes improve Kani. > 2. Some context on the problem you are solving. > 3. A list of issues that are resolved by this PR. > 4. If you had to perform any manual test, please describe them. > > **Make sure you remove this list from the final PR description.** Fix usage of `tcx.crates()`: rust-lang/rust#124976. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
lqd
commented
Jun 5, 2024
beta branches in a couple days, and so maybe we should revert this PR before then |
petrochenkov
commented
Jun 5, 2024
I assumed #125493 had already been merged. |
Revert "use `tcx.used_crates(())` more" before it reaches beta There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#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. fixesrust-lang#125474fixesrust-lang#125484fixesrust-lang#125646fixesrust-lang#125707fixesrust-lang#126066fixesrust-lang#125934fixesrust-lang#126021 r? `@petrochenkov` `@bors` p=1
Revert "use `tcx.used_crates(())` more" before it reaches beta There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#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. fixesrust-lang#125474fixesrust-lang#125484fixesrust-lang#125646fixesrust-lang#125707fixesrust-lang#126066fixesrust-lang#125934fixesrust-lang#126021 r? ``@petrochenkov`` ``@bors`` p=1
Revert "use `tcx.used_crates(())` more" before it reaches beta There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#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. fixesrust-lang#125474fixesrust-lang#125484fixesrust-lang#125646fixesrust-lang#125707fixesrust-lang#126066fixesrust-lang#125934fixesrust-lang#126021 r? `@petrochenkov` `@bors` p=1
Revert "use `tcx.used_crates(())` more" before it reaches beta There are more open issues caused by rust-lang#124976 than will be fixed by rust-lang#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. fixesrust-lang#125474fixesrust-lang#125484fixesrust-lang#125646fixesrust-lang#125707fixesrust-lang#126066fixesrust-lang#125934fixesrust-lang#126021 r? `@petrochenkov` `@bors` p=1
And explain when it should be used.
Addresses comments from #121167.