Skip to content

Commit

Permalink
improve error message for when a query isn't supported
Browse files Browse the repository at this point in the history
  • Loading branch information
hanar3 committed Sep 17, 2022
1 parent dddfb7d commit 0405a5d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ macro_rules! define_callbacks {
fn default() -> Self {
Providers {
$($name: |_, key| bug!(
"`tcx.{}({:?})` unsupported for {} crate; \
perhaps the `{}` query was never assigned a provider function. 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.",
"`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,
if key.query_crate_is_local() { "local" } : { "external" } ,
stringify!($name),
),)*
}
Expand Down

0 comments on commit 0405a5d

Please sign in to comment.