Skip to content

Commit

Permalink
Rollup merge of rust-lang#101958 - hanar3:101666/enhance-error-messag…
Browse files Browse the repository at this point in the history
…e, r=oli-obk

Improve error for when query is unsupported by crate

This is an improvement to the error message mentioned on rust-lang#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.
  • Loading branch information
spastorino authored Sep 20, 2022
2 parents 8fd6d03 + 0405a5d commit 805f931
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 805f931

Please sign in to comment.