Skip to content

Commit 2c89373

Browse files
authored
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.
2 parents 3f377d3 + 0405a5d commit 2c89373

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_middle/src/ty/query.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ macro_rules! define_callbacks {
277277
fn default() -> Self {
278278
Providers {
279279
$($name: |_, key| bug!(
280-
"`tcx.{}({:?})` unsupported by its crate; \
281-
perhaps the `{}` query was never assigned a provider function",
280+
"`tcx.{}({:?})` is not supported for external or local crate;\n
281+
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
282+
If that's not the case, {} was likely never assigned to a provider function.\n",
282283
stringify!($name),
283284
key,
284285
stringify!($name),

0 commit comments

Comments
 (0)