]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #86123 - Aaron1011:query-span, r=cjgillot
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Thu, 19 Aug 2021 17:30:04 +0000 (19:30 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Aug 2021 17:30:04 +0000 (19:30 +0200)
commitdef6393a8b707002aa94ee013cee8d0df1a5f38d
treee4fff35be8e6d7637abb9ecb1f9041abdac08200
parent2451f42c1deb9379d5e8e5fa86b0bf857ae048ec
parent34f116101fa5e1f4a3c9597535357fa32db277af
Rollup merge of #86123 - Aaron1011:query-span, r=cjgillot

Preserve more spans in internal `rustc_queries!` macro

We now preserve the span of the various query modifiers, and
use the span of the query's name for the commas that we
generate to separate the modifiers. This makes debugging issues with the
internal query macro infrastructure much nicer - previously, we
would get errors messages pointing at the entire call site
(the `rustc_queries!` invocation), which isn't very useful.

This should have no effect when compilation succeeds.

A concrete example of an error message produced after this changed:

```
error: local ambiguity: multiple parsing options: built-in NTs tt ('modifiers') or 1 other option.
    --> /home/aaron/repos/rust/compiler/rustc_middle/src/query/mod.rs:23:11
     |
12   | / rustc_queries! {
13   | |     query trigger_delay_span_bug(key: DefId) -> () {
14   | |         desc { "trigger a delay span bug" }
15   | |     }
...    |
23   | |     query hir_crate(key: ()) -> &'tcx Crate<'tcx> {
     | |           ^^^^^^^^^
...    |
1715 | |     }
1716 | | }
     | |_- in this expansion of `rustc_query_append!`
     |
    ::: compiler/rustc_query_impl/src/lib.rs:51:1
     |
51   |   rustc_query_append! { [define_queries!][<'tcx>] }
     |   ------------------------------------------------- in this macro invocation
```

The particular bug shown in this error message will be fixed
in a separate PR.
compiler/rustc_macros/src/query.rs