summary refs log tree commit diff
path: root/compiler/rustc_query_impl
AgeCommit message (Collapse)AuthorLines
2022-08-24Simplify the syntax for macros generated by `rustc_queries`Joshua Nelson-2/+2
- Disallow multiple macros callbacks in the same invocation. In practice, this was never used. - Remove the `[]` brackets around the macro name - Require an `ident`, not an arbitrary `tt`
2022-08-23Move most of `make_query` into a generic function, away from the macroJoshua Nelson-42/+56
This should both make the code easier to read and also greatly reduce the amount of codegen the compiler has to do, since it only needs to monomorphize `create_query_frame` for each new key and not for each query.
2022-08-23Get rid of some usages of `query_keys`Joshua Nelson-7/+6
Rustdoc documents these with the name of the type alias instead of normalizing them to the underlying type. Use associated types instead so that the generated docs for nightly-rustc are easier to read.
2022-08-23Remove `$tcx` metavariable from `rustc_query_append`Joshua Nelson-34/+30
It's not actually necessary and it makes the code harder to read.
2022-08-24add `depth_limit` in `QueryVTable`SparrowLii-1/+19
2022-08-20rmeta/query cache: don't write string values of preinterned symbolsklensy-11/+23
2022-08-20Rollup merge of #100723 - 5225225:the-easy-ones, r=compiler-errorsMatthias Krüger-0/+2
Add the diagnostic translation lints to crates that don't emit them Some of these have a note saying that they should build on a stable compiler, does that mean they shouldn't get these lints? Or can we cfg them out on those?
2022-08-18Auto merge of #98851 - klensy:encode_symbols, r=cjgillotbors-1/+57
rustc_metadata: dedupe strings to prevent multiple copies in rmeta/query cache blow file size r? `@cjgillot` Encodes strings in rmeta/query cache so duplicated ones will be encoded as offsets to first strings, reducing file size.
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-17Rollup merge of #100389 - compiler-errors:return-type-suggestion-cycle, ↵Matthias Krüger-0/+21
r=cjgillot Do not report cycle error when inferring return type for suggestion The UI test is a good example of a case where this happens. The cycle is due to needing the value of the return type `-> _` to compute the variances of items in the crate, but then needing the variances of the items in the crate to do typechecking to infer what `-> _`'s real type is. Since we're already gonna emit an error in astconv, just delay the cycle bug as an error.
2022-08-16Do not report cycle error when inferring return type for suggestionMichael Goulet-0/+21
2022-08-15Remove usages of opt_remap_env_constnessMiguel Guarniz-3/+0
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-08-15Remove opt_remap_env_constness from rustc_query_implMiguel Guarniz-11/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-08-15cache strings while encoding/decoding to compiler artifactsklensy-1/+57
2022-07-30Use LocalDefId for closures moreCameron Steffen-0/+10
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-3/+3
2022-07-14Use constant eval to do strict validity checks5225225-1/+11
2022-07-12Move abstract const to rustc_middle::tykadmin-2/+1
2022-07-06Use a dedicated DepKind for the forever-red node.Camille GILLOT-0/+11
2022-07-06Create a forever red node and use it to force side effects.Camille GILLOT-11/+0
2022-07-06Allow to create definitions inside the query system.Camille GILLOT-10/+21
2022-07-06Rollup merge of #98881 - cjgillot:q-def-kind, r=fee1-deadDylan DPC-5/+8
Only compute DefKind through the query.
2022-07-05Clarify the behaviour from inside the query system.Camille GILLOT-5/+8
2022-07-04Only compute DefKind through the query.Camille GILLOT-1/+1
2022-06-29get rid of `tcx` in deadlock handler when parallel compilationSparrowLii-5/+2
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-3/+2
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-16Move `finish` out of the `Encoder` trait.Nicholas Nethercote-68/+27
This simplifies things, but requires making `CacheEncoder` non-generic. (This was previously merged as commit 4 in #94732 and then was reverted in #97905 because it caused a perf regression.)
2022-06-15Rollup merge of #98083 - nnethercote:rename-Encoder, r=bjorn3Yuki Okushi-6/+6
Rename rustc_serialize::opaque::Encoder as MemEncoder. This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports). (This was previously merged as commit 5 in #94732 and then was reverted in #97905 because of a perf regression caused by commit 4 in #94732.) r? ```@bjorn3```
2022-06-15Rollup merge of #98067 - klensy:compiler-deps2, r=Dylan-DPCYuki Okushi-1/+0
compiler: remove unused deps Removed unused dependencies in compiler crates and moves few `libc` under `target.cfg(unix)` .
2022-06-14Separate `source_span` and `expn_that_defined` from `Definitions`.Camille GILLOT-3/+2
2022-06-14Rename rustc_serialize::opaque::Encoder as MemEncoder.Nicholas Nethercote-6/+6
This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports). (This was previously merged as commit 5 in #94732 and then was reverted in #97905 because of a perf regression caused by commit 4 in #94732.)
2022-06-13remove currently unused depsklensy-1/+0
2022-06-13Integrate measureme's hardware performance counter support.Eduard-Mihai Burtescu-0/+3
2022-06-10Revert dc08bc51f2c58a0f5f815a07f9bb3d671153b5a1.Nicholas Nethercote-27/+68
2022-06-10Revert b983e42936feab29f6333e9835913afc6b4a394e.Nicholas Nethercote-6/+6
2022-06-08Rename `rustc_serialize::opaque::Encoder` as `MemEncoder`.Nicholas Nethercote-6/+6
This avoids the name clash with `rustc_serialize::Encoder` (a trait), and allows lots qualifiers to be removed and imports to be simplified (e.g. fewer `as` imports).
2022-06-08Move `finish` out of the `Encoder` trait.Nicholas Nethercote-68/+27
This simplifies things, but requires making `CacheEncoder` non-generic.
2022-06-08Use delayed error handling for `Encodable` and `Encoder` infallible.Nicholas Nethercote-87/+71
There are two impls of the `Encoder` trait: `opaque::Encoder` and `opaque::FileEncoder`. The former encodes into memory and is infallible, the latter writes to file and is fallible. Currently, standard `Result`/`?`/`unwrap` error handling is used, but this is a bit verbose and has non-trivial cost, which is annoying given how rare failures are (especially in the infallible `opaque::Encoder` case). This commit changes how `Encoder` fallibility is handled. All the `emit_*` methods are now infallible. `opaque::Encoder` requires no great changes for this. `opaque::FileEncoder` now implements a delayed error handling strategy. If a failure occurs, it records this via the `res` field, and all subsequent encoding operations are skipped if `res` indicates an error has occurred. Once encoding is complete, the new `finish` method is called, which returns a `Result`. In other words, there is now a single `Result`-producing method instead of many of them. This has very little effect on how any file errors are reported if `opaque::FileEncoder` has any failures. Much of this commit is boring mechanical changes, removing `Result` return values and `?` or `unwrap` from expressions. The more interesting parts are as follows. - serialize.rs: The `Encoder` trait gains an `Ok` associated type. The `into_inner` method is changed into `finish`, which returns `Result<Vec<u8>, !>`. - opaque.rs: The `FileEncoder` adopts the delayed error handling strategy. Its `Ok` type is a `usize`, returning the number of bytes written, replacing previous uses of `FileEncoder::position`. - Various methods that take an encoder now consume it, rather than being passed a mutable reference, e.g. `serialize_query_result_cache`.
2022-06-03Fully stabilize NLLJack Huey-1/+0
2022-06-03Remove emit_unitbjorn3-5/+0
It doesn't do anything for all encoders
2022-06-01Lazify `SourceFile::lines`.Nicholas Nethercote-1/+1
`SourceFile::lines` is a big part of metadata. It's stored in a compressed form (a difference list) to save disk space. Decoding it is a big fraction of compile time for very small crates/programs. This commit introduces a new type `SourceFileLines` which has a `Lines` form and a `Diffs` form. The latter is used when the metadata is first read, and it is only decoded into the `Lines` form when line data is actually needed. This avoids the decoding cost for many files, especially in `std`. It's a performance win of up to 15% for tiny crates/programs where metadata decoding is a high part of compilation costs. A `Lock` is needed because the methods that access lines data (which can trigger decoding) take `&self` rather than `&mut self`. To allow for this, `SourceFile::lines` now takes a `FnMut` that operates on the lines slice rather than returning the lines slice.
2022-05-29Auto merge of #97287 - compiler-errors:type-interner, r=jackh726,oli-obkbors-5/+8
Move things to `rustc_type_ir` Finishes some work proposed in https://github.com/rust-lang/compiler-team/issues/341. r? `@ghost`
2022-05-28Make TyCtxt implement Interner, make HashStable generic and move to ↵Michael Goulet-5/+5
rustc_type_ir
2022-05-28Initial fixes on top of type interner commitMichael Goulet-1/+1
2022-05-28Move things to rustc_type_irWilco Kusee-6/+9
2022-05-27Update to rebased rustc-rayon 0.4Josh Stone-1/+1
2022-05-21Auto merge of #97239 - jhpratt:remove-crate-vis, r=joshtriplettbors-2/+1
Remove `crate` visibility modifier FCP to remove this syntax is just about complete in #53120. Once it completes, this should be merged ASAP to avoid merge conflicts. The first two commits remove usage of the feature in this repository, while the last removes the feature itself.
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-2/+1
2022-05-13Cache more queries on disk.Camille GILLOT-5/+19
2022-05-08Move lint expectation checking into a separate query (RFC 2383)xFrednet-0/+10