diff options
| author | Michael Howell <michael@notriddle.com> | 2022-09-20 10:12:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-20 10:12:58 -0700 |
| commit | 2c893737a654776f9f480dbace1bb0d3da45f5bd (patch) | |
| tree | a9896bd3e8a8e0b1ace91dea9105425d8109915d | |
| parent | 3f377d3f9670b28abb8b52b3e69b8d76f2eb2c42 (diff) | |
| parent | 0405a5d4e9aca1f1f22d94abca84c281bf1a97ea (diff) | |
| download | rust-2c893737a654776f9f480dbace1bb0d3da45f5bd.tar.gz rust-2c893737a654776f9f480dbace1bb0d3da45f5bd.zip | |
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.
| -rw-r--r-- | compiler/rustc_middle/src/ty/query.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/query.rs b/compiler/rustc_middle/src/ty/query.rs index 36ea7946e9a..be208a9fc70 100644 --- a/compiler/rustc_middle/src/ty/query.rs +++ b/compiler/rustc_middle/src/ty/query.rs @@ -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), |
