about summary refs log tree commit diff
path: root/compiler/rustc_macros
AgeCommit message (Collapse)AuthorLines
2021-10-10Apply clippy suggestionsClemens Wasser-9/+7
2021-10-05Auto merge of #89266 - cjgillot:session-ich, r=michaelwoeristerbors-2/+2
Move ICH to rustc_query_system Based on https://github.com/rust-lang/rust/pull/89183 The StableHashingContext does not need to be in rustc_middle. This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-03Remove re-export.Camille GILLOT-2/+2
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-09-20Migrate to 2021Mark Rousskov-1/+1
2021-09-13Use a separate interner type for UniqueTypeIdbjorn3-1/+1
Using symbol::Interner makes it very easy to mixup UniqueTypeId symbols with the global interner. In fact the Debug implementation of UniqueTypeId did exactly this. Using a separate interner type also avoids prefilling the interner with unused symbols and allow for optimizing the symbol interner for parallel access without negatively affecting the single threaded module codegen.
2021-09-11don't clone types that are Copy (clippy::clone_on_copy)Matthias Krüger-4/+4
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-08-02Auto merge of #87535 - lf-:authors, r=Mark-Simulacrumbors-1/+0
rfc3052 followup: Remove authors field from Cargo manifests Since RFC 3052 soft deprecated the authors field, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information for contributors, we may as well remove it from crates in this repo.
2021-08-01bump bootstrap compiler to 1.55Pietro Albini-1/+0
2021-07-29rfc3052: Remove authors field from Cargo manifestsJade-1/+0
Since RFC 3052 soft deprecated the authors field anyway, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information, we should remove it from crates in this repo.
2021-07-25clippy::useless_formatMatthias Krüger-1/+1
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-1/+1
2021-07-09Fix default_hash_types to use resolved pathCameron Steffen-1/+1
2021-06-18Lint for unused borrows as part of UNUSED_MUST_USEhi-rustin-2/+2
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-06-01Remove unused functions and arguments from rustc_serializebjorn3-10/+8
2021-03-26Use iter::zip in compiler/Josh Stone-1/+1
2021-03-11Add inlining.Camille GILLOT-0/+2
2021-02-24replaced some map_or with map_or_elseklensy-1/+1
2021-02-23replaced some unwrap_or with unwrap_or_elseklensy-5/+5
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
2021-01-01rustc_serialize: specialize opaque encoding of some u8 sequencesTyson Nottingham-2/+2
2020-12-30Rollup merge of #80509 - matthiaskrgr:ptr_arg, r=varkorYuki Okushi-1/+1
where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)
2020-12-30where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)Matthias Krüger-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-12-17Stop using intermediate macros in definition of symbolsArlie Davis-21/+16
Currently, the rustc_macros::symbols macro generates two `macro_rules!` macros as its output. These two macros are used in rustc_span/src/symbol.rs. This means that each Symbol that we define is represented in the AST of rustc_symbols twice: once in the definition of the `define_symbols!` macro (similarly for the `keywords! macro), and once in the rustc_span::symbols definition. That would be OK if there were only a handful of symbols, but currently we define over 1100 symbols. The definition of the `define_symbols!` macro contains the expanded definition of each symbol, so that's a lot of AST storage wasted on a macro that is used exactly once. This commit removes the `define_symbols` macro, and simply allows the proc macro to directly generate the `rustc_symbols::symbol::sym` module. The benefit is mainly in reducing memory wasted during compilation of rustc itself. It should also reduce memory used by Rust Analyzer. This commit also reduces the size of the AST for symbol definitions, by moving two `#[allow(...)]` attributes from the symbol constants to the `sym` module. This eliminates 2200+ attribute nodes. This commit also eliminates the need for the `digits_array` constant. There's no need to store an array of Symbol values for digits. We can simply define a constant of the base value, and add to that base value.
2020-12-13./x.py fmtArlie Davis-12/+3
2020-12-12Improve error handling in `symbols` proc-macroArlie Davis-54/+213
This improves how the `symbols` proc-macro handles errors. If it finds an error in its input, the macro does not panic. Instead, it still produces an output token stream. That token stream will contain `compile_error!(...)` macro invocations. This will still cause compilation to fail (which is what we want), but it will prevent meaningless errors caused by the output not containing symbols that the macro normally generates. This solves a small (but annoying) problem. When you're editing rustc_span/src/symbol.rs, and you get something wrong (dup symbol name, misordered symbol), you want to get only the errors that are relevant, not a burst of errors that are irrelevant. This change also uses the correct Span when reporting errors, so you get errors that point to the correct place in rustc_span/src/symbol.rs where something is wrong. This also adds several unit tests which test the `symbols` proc-macro. This commit also makes it easy to run the `symbols` proc-macro as an ordinary Cargo test. Just run `cargo test`. This makes it easier to do development on the macro itself, such as running it under a debugger. This commit also uses the `Punctuated` type in `syn` for parsing comma-separated lists, rather than doing it manually. The output of the macro is not changed at all by this commit, so rustc should be completely unchanged. This just improves quality of life during development.
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-11-17Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obkbors-1/+1
Introduce `TypeVisitor::BreakTy` Implements MCP rust-lang/compiler-team#383. r? `@ghost` cc `@lcnr` `@oli-obk` ~~Blocked on FCP in rust-lang/compiler-team#383.~~
2020-11-16compiler: fold by valueBastian Kauschke-8/+8
2020-11-14Introduce `TypeVisitor::BreakTy`LeSeulArtichaut-1/+1
2020-11-07Small cleanup in `TypeFoldable` derive macroLeSeulArtichaut-2/+1
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-1/+1
2020-10-30TypeVisitor: use `std::ops::ControlFlow` instead of `bool`LeSeulArtichaut-3/+8
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-10-21Lift: take self by valueBastian Kauschke-2/+3
2020-09-26Remove unused #[allow(...)] statements from compiler/est31-2/+0