-
Notifications
You must be signed in to change notification settings - Fork 13.4k
rustc: Use tcx.used_crates(())
more
#124976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1860,13 +1860,22 @@ rustc_queries! { | |
eval_always | ||
desc { "calculating the stability index for the local crate" } | ||
} | ||
query crates(_: ()) -> &'tcx [CrateNum] { | ||
/// All loaded crates, including those loaded purely for doc links or diagnostics. | ||
/// (Diagnostics include lints, so speculatively loaded crates may occur in successful | ||
/// compilation even without doc links.) | ||
/// Should be used when encoding crate metadata (and therefore when generating crate hash, | ||
/// depinfo and similar things), to avoid dangling crate references in other encoded data, | ||
/// like source maps. | ||
/// May also be used for diagnostics - if we are loading a crate anyway we can suggest some | ||
/// items from it as well. | ||
/// But otherwise, `used_crates` should generally be used. | ||
query crates_including_speculative(_: ()) -> &'tcx [CrateNum] { | ||
eval_always | ||
desc { "fetching all foreign CrateNum instances" } | ||
} | ||
// Crates that are loaded non-speculatively (not for diagnostics or doc links). | ||
// FIXME: This is currently only used for collecting lang items, but should be used instead of | ||
// `crates` in most other cases too. | ||
/// Crates that are loaded non-speculatively (not for diagnostics or doc links). | ||
/// 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "used" kind of sounds like if I add a crate as a dependency but don't use it, it doesn't show up. Maybe Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ideally I'd turn the enum WhatCrateIsLoadedFor {
ForRealThings,
// Need to be encoded into metadata in any case
ForDocLinksAndDiagnosticsOnly,
// It may be possible to drop these ones from metadata, if we clean their traces from source map somehow
ForDiagnosticsOnly,
} Maybe even merge it with existing Let's keep its pre-existing naming for now. |
||
eval_always | ||
desc { "fetching `CrateNum`s for all crates loaded non-speculatively" } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
error: extern location for std does not exist: | ||
|
||
error: `#[panic_handler]` function required, but not found | ||
|
||
error: unwinding panics are not supported without std | ||
| | ||
= help: using nightly cargo, use -Zbuild-std with panic="abort" to avoid unwinding | ||
= note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem | ||
|
||
error: requires `sized` lang_item | ||
|
||
error: aborting due to 4 previous errors | ||
error: aborting due to 2 previous errors | ||
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this diagnostics change expected? (I'm analyzing the regressions caused by this PR) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I see libcore is loaded speculatively in this test ( |
||
|
Uh oh!
There was an error while loading. Please reload this page.