]> git.lizzy.rs Git - rust.git/commitdiff
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)
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.

1  2 
compiler/rustc_macros/src/query.rs

Simple merge