Rollup merge of #101958 - hanar3:101666/enhance-error-message, r=oli-obk

Improve error for when query is unsupported by crate

This is an improvement to the error message mentioned on #101666.  It seems like a good idea to also add [this link to the rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/query.html), if explaining the query system in detail is a concern here, but I'm unsure if there is any restrictions on adding links to error messages.
This commit is contained in:
Michael Howell 2022-09-20 10:12:58 -07:00 committed by GitHub
commit 2c893737a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -277,8 +277,9 @@ macro_rules! define_callbacks {
fn default() -> Self {
Providers {
$($name: |_, key| bug!(
"`tcx.{}({:?})` unsupported by its crate; \
perhaps the `{}` query was never assigned a provider function",
"`tcx.{}({:?})` is not supported for external or local crate;\n
hint: Queries can be either made to the local crate, or the external crate. This error means you tried to use it for one that's not supported (likely the local crate).\n
If that's not the case, {} was likely never assigned to a provider function.\n",
stringify!($name),
key,
stringify!($name),