about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/query.rs
AgeCommit message (Collapse)AuthorLines
2021-10-02Prevent macro ambiguity errorsbjorn3-6/+6
The previous macro_rules! parsers failed when an additional modifier was added with ambiguity errors. The error is pretty unclear as to what exactly the cause here is, but this change simplifies the argument parsing code such that the error is avoided.
2021-08-19Rollup merge of #86123 - Aaron1011:query-span, r=cjgillotGuillaume Gomez-48/+56
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.
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-1/+1
2021-06-07Preserve more spans in internal `rustc_queries!` macroAaron Hill-48/+56
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.
2021-02-24replaced some map_or with map_or_elseklensy-1/+1
2021-02-23replaced some unwrap_or with unwrap_or_elseklensy-2/+2
2021-02-19Move the query system to rustc_query_impl.Camille GILLOT-0/+3
2021-02-19Wrap QueryDescription into a macro.Camille GILLOT-4/+4
2021-02-19Make QueryEngine opaque to TyCtxt.Camille GILLOT-7/+5
2021-02-19Wrap TyCtxt inside a QueryCtxt for queries.Camille GILLOT-13/+13
2021-02-19Decouple the on-disk cache from the query engine.Camille GILLOT-2/+2
2021-02-08Switch query descriptions to just StringMark Rousskov-2/+2
In practice we never used the borrowed variant anyway.
2021-01-31Indent the code correctly again after removing the query categories.Julian Wollersberger-54/+52
2021-01-31Remove the remains of the query categories.Julian Wollersberger-23/+4
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-1/+1
2020-12-29Use `desc` as a doc-comment if none exist yetJoshua Nelson-2/+36
- Replace {} with the stringified expr Giant thank you to `@danielhenrymantilla` for figuring out how to make this work :heart: - Note that this is just an approximation and it would be better to add a doc-comment
2020-11-19Only create `OnDiskCache` in incremental compilation modeAaron Hill-1/+1
This lets us skip doing useless work when we're not in incremental compilation mode.
2020-10-22Retire rustc_dep_node_try_load_from_on_disk_cache.Camille GILLOT-26/+0
2020-10-22Retire rustc_dep_node_force.Camille GILLOT-33/+0
2020-10-22Unify query name and node name.Camille GILLOT-1/+1
2020-10-22Remove unused category from macros.Camille GILLOT-6/+5
2020-09-26Remove unused #[allow(...)] statements from compiler/est31-1/+0
2020-09-17Preserve doc-comments when generating queriesJoshua Nelson-10/+19
This also changes some comments into doc-comments.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-1/+1
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-08-30mv compiler to compiler/mark-0/+567