summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
AgeCommit message (Collapse)AuthorLines
2021-03-18Rollup merge of #83080 - tmiasko:inline-coverage, r=wesleywiserDylan DPC-0/+8
Make source-based code coverage compatible with MIR inlining When codegenning code coverage use the instance that coverage data was originally generated for, to ensure basic level of compatibility with MIR inlining. Fixes #83061
2021-03-16Auto merge of #82936 - oli-obk:valtree, r=RalfJung,lcnr,matthewjasperbors-0/+8
Implement (but don't use) valtree and refactor in preparation of use This PR does not cause any functional change. It refactors various things that are needed to make valtrees possible. This refactoring got big enough that I decided I'd want it reviewed as a PR instead of trying to make one huge PR with all the changes. cc `@rust-lang/wg-const-eval` on the following commits: * 2027184 implement valtree * eeecea9 fallible Scalar -> ScalarInt * 042f663 ScalarInt convenience methods cc `@eddyb` on ef04a6d cc `@rust-lang/wg-mir-opt` for cf1700c (`mir::Constant` can now represent either a `ConstValue` or a `ty::Const`, and it is totally possible to have two different representations for the same value)
2021-03-15Functions inlined into reachable functions are reachableTomasz Miąsko-0/+8
Consider functions to be reachable for code coverage purposes, either when they reach the code generation directly, or indirectly as inlined part of another function.
2021-03-15Mark `extern_mod_stmt_cnum` as `eval_always`Aaron Hill-0/+2
This query reads from global untracked state, so it always needs to be evaluated.
2021-03-12Intern valtree field vectorOli Scherer-1/+1
2021-03-12Implement valtreeOli Scherer-0/+8
valtree is a version of constants that is inherently safe to be used within types. This is in contrast to ty::Const which can have different representations of the same value. These representation differences can show up in hashing or equality comparisons, breaking type equality of otherwise equal types. valtrees do not have this problem.
2021-03-09Use BTreeMap to store attributes.Camille GILLOT-1/+1
2021-03-09Collect attributes during HIR lowering.Camille GILLOT-0/+9
2021-02-25Rollup merge of #82510 - jyn514:fix-typo, r=Dylan-DPCAaron Hill-1/+1
Fix typo in `param_env_reveal_all_normalized` This made the generated docs look strange: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.param_env_reveal_all_normalized
2021-02-25Fix typo in `param_env_reveal_all_normalized` #82510Joshua Nelson-1/+1
This made the generated docs look strange: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.param_env_reveal_all_normalized
2021-02-24Auto merge of #82159 - BoxyUwU:uwu, r=varkorbors-0/+10
Use correct param_env in conservative_is_privately_uninhabited cc `@lcnr` r? `@varkor` since this is your FIXME that was removed ^^
2021-02-23yeetEllen-0/+10
2021-02-19Wrap QueryDescription into a macro.Camille GILLOT-25/+0
2021-02-19Make QueryEngine opaque to TyCtxt.Camille GILLOT-1/+1
2021-02-19Wrap TyCtxt inside a QueryCtxt for queries.Camille GILLOT-0/+1
2021-02-19Decouple the on-disk cache from the query engine.Camille GILLOT-6/+1
2021-02-15Trait impls are Items, therefore HIR owners.Camille GILLOT-1/+1
2021-02-09Auto merge of #81905 - Dylan-DPC:rollup-mxpz1j7, r=Dylan-DPCbors-2/+13
Rollup of 11 pull requests Successful merges: - #72209 (Add checking for no_mangle to unsafe_code lint) - #80732 (Allow Trait inheritance with cycles on associated types take 2) - #81697 (Add "every" as a doc alias for "all".) - #81826 (Prefer match over combinators to make some Box methods inlineable) - #81834 (Resolve typedef in HashMap lldb pretty-printer only if possible) - #81841 ([rustbuild] Output rustdoc-json-types docs ) - #81849 (Expand the docs for ops::ControlFlow a bit) - #81876 (parser: Fix panic in 'const impl' recovery) - #81882 (:arrow_up: rust-analyzer) - #81888 (Fix pretty printer macro_rules with semicolon.) - #81896 (Remove outdated comment in windows' mutex.rs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-02-08Switch query descriptions to just StringMark Rousskov-1/+0
In practice we never used the borrowed variant anyway.
2021-02-05Revert "Auto merge of #79637 - spastorino:revert-trait-inheritance-self, ↵Santiago Pastorino-2/+13
r=Mark-Simulacrum" This reverts commit b4def89d76896eec73b4af33642ba7e5eb53c567, reversing changes made to 7dc1e852d43cb8c9e77dc1e53014f0eb85d2ebfb.
2021-01-31Indent the code correctly again after removing the query categories.Julian Wollersberger-1399/+1399
2021-01-31Remove the remains of the query categories.Julian Wollersberger-106/+13
2021-01-25Auto merge of #68828 - oli-obk:inline_cycle, r=wesleywiserbors-0/+21
Prevent query cycles in the MIR inliner r? `@eddyb` `@wesleywiser` cc `@rust-lang/wg-mir-opt` The general design is that we have a new query that is run on the `validated_mir` instead of on the `optimized_mir`. That query is forced before going into the optimization pipeline, so as to not try to read from a stolen MIR. The query should not be cached cross crate, as you should never call it for items from other crates. By its very design calls into other crates can never cause query cycles. This is a pessimistic approach to inlining, since we strictly have more calls in the `validated_mir` than we have in `optimized_mir`, but that's not a problem imo.
2021-01-23Prevent query cycles during inliningoli-0/+21
2021-01-23Iterate to encode def_kind.Camille GILLOT-1/+1
2021-01-17Rollup merge of #80983 - bjorn3:no_dup_is_dllimport_foreign_item, r=nagisaMara Bos-5/+0
Remove is_dllimport_foreign_item definition from cg_ssa It overwrites the definition from rustc_metadata. cc https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/query.20provided.20twice/near/218927806 Marked as draft to test if this breaks anything.
2021-01-16correctly deal with late-bound lifetimes in anon constsBastian Kauschke-1/+1
2021-01-15Auto merge of #80602 - tgnottingham:cratemetadata_you_aint_special, ↵bors-0/+2
r=michaelwoerister Remove DepKind::CrateMetadata and pre-allocation of DepNodes Remove much of the special-case handling around crate metadata dependency tracking by replacing `DepKind::CrateMetadata` and the pre-allocation of corresponding `DepNodes` with on-demand invocation of the `crate_hash` query.
2021-01-13Auto merge of #77524 - Patryk27:fixes/66228, r=estebankbors-0/+9
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924) This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
2021-01-13Remove is_dllimport_foreign_item def from cg_ssabjorn3-5/+0
It overwrites the definition from rustc_metadata
2021-01-12Auto merge of #79670 - Nadrieril:uninhabited-query, r=estebankbors-0/+9
Turn type inhabitedness into a query to fix `exhaustive_patterns` perf We measured in https://github.com/rust-lang/rust/pull/79394 that enabling the [`exhaustive_patterns` feature](https://github.com/rust-lang/rust/issues/51085) causes significant perf degradation. It was conjectured that the culprit is type inhabitedness checking, and [I hypothesized](https://github.com/rust-lang/rust/pull/79394#issuecomment-733861149) that turning this computation into a query would solve most of the problem. This PR turns `tcx.is_ty_uninhabited_from` into a query, and I measured a 25% perf gain on the benchmark that stress-tests `exhaustiveness_patterns`. This more than compensates for the 30% perf hit I measured [when creating it](https://github.com/rust-lang/rustc-perf/pull/801). We'll have to measure enabling the feature again, but I suspect this fixes the perf regression entirely. I'd like a perf run on this PR obviously. I made small atomic commits to help reviewing. The first one is just me discovering the "revisions" feature of the testing framework. I believe there's a push to move things out of `rustc_middle` because it's huge. I guess `inhabitedness/mod.rs` could be moved out, but it's quite small. `DefIdForest` might be movable somewhere too. I don't know what the policy is for that. Ping `@camelid` since you were interested in following along `@rustbot` modify labels: +A-exhaustiveness-checking
2021-01-12Make `DefIdForest` cheaper to cloneNadrieril-1/+1
Since `DefIdForest` contains 0 or 1 elements the large majority of the time, by allocating only in the >1 case we avoid almost all allocations, compared to `Arc<SmallVec<[DefId;1]>>`. This shaves off 0.2% on the benchmark that stresses uninhabitedness checking.
2021-01-12Turn type inhabitedness into a queryNadrieril-0/+9
2021-01-12Prevent potential bug resulting from changing crate_hash query nameTyson Nottingham-0/+2
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-0/+9
2021-01-04Fix wording of query descriptionoli-1/+1
2021-01-04Small comment adjustmentsoli-1/+0
2021-01-04Differentiate between the availability of ctfe MIR and runtime MIRoli-9/+4
2021-01-04Keep an unoptimized duplicate of `const fn` aroundoli-0/+17
This allows CTFE to reliably detect UB, as otherwise optimizations may hide UB.
2020-12-23Add more comments to trait queriesJoshua Nelson-13/+32
This also adds back a comment that was mistakenly removed in ac9dfc3e7785c9bba96ebac4fd51726189e1bf91.
2020-12-03Combination of commitsRich Kadel-0/+15
Fixes multiple issue with counters, with simplification Includes a change to the implicit else span in ast_lowering, so coverage of the implicit else no longer spans the `then` block. Adds coverage for unused closures and async function bodies. Fixes: #78542 Adding unreachable regions for known MIR missing from coverage map Cleaned up PR commits, and removed link-dead-code requirement and tests Coverage no longer depends on Issue #76038 (`-C link-dead-code` is no longer needed or enforced, so MSVC can use the same tests as Linux and MacOS now) Restrict adding unreachable regions to covered files Improved the code that adds coverage for uncalled functions (with MIR but not-codegenned) to avoid generating coverage in files not already included in the files with covered functions. Resolved last known issue requiring --emit llvm-ir workaround Fixed bugs in how unreachable code spans were added.
2020-12-02Revert "Auto merge of #79209 - spastorino:trait-inheritance-self, ↵Santiago Pastorino-13/+2
r=nikomatsakis" This reverts commit 349b3b324dade7ca638091db93ba08bbc443c63d, reversing changes made to b776d1c3e3db8befabb123ebb1e46c3531eaed46.
2020-11-27Remove super_traits_of query, just leave a helper functionSantiago Pastorino-6/+0
2020-11-27Make super_traits_of return Lrc for cheaper cloneSantiago Pastorino-1/+1
2020-11-27Fix super_predicates_that_define_assoc_type API docSantiago Pastorino-6/+4
2020-11-27adjust super_predicates_that_define_assoc_type query descriptionSantiago Pastorino-1/+4
2020-11-27super_traits_of is now a querySantiago Pastorino-1/+7
2020-11-27Allow to self reference associated types in where clausesSantiago Pastorino-0/+10
2020-11-27Allow to use super trait bounds in where clausesSantiago Pastorino-1/+1
2020-11-25Auto merge of #79411 - tmiasko:naked-params, r=Amanieubors-0/+4
Validate use of parameters in naked functions * Reject use of parameters inside naked function body. * Reject use of patterns inside function parameters, to emphasize role of parameters a signature declaration (mirroring existing behaviour for function declarations) and avoid generating code introducing specified bindings. Closes issues below by considering input to be ill-formed. Closes #75922. Closes #77848. Closes #79350.