summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
AgeCommit message (Collapse)AuthorLines
2024-11-21Rollup merge of #133218 - compiler-errors:const-opaque, r=fee1-deadMatthias Krüger-1/+1
Implement `~const` item bounds in RPIT an RPIT in a `const fn` is allowed to be conditionally const itself :) r? fee1-dead or reroll
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-0/+30
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-11-19`InterpCx` store `TypingEnv` instead of a `ParamEnv`lcnr-15/+3
2024-11-19Rename implied_const_bounds to explicit_implied_const_boundsMichael Goulet-1/+1
2024-11-19move `fn is_item_raw` to `TypingEnv`lcnr-4/+4
2024-11-19Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnrbors-3/+4
Improve VecCache under parallel frontend This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (~1%). With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds). try-job: i686-gnu-nopt try-job: dist-x86_64-linux
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-14/+26
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-15Improve VecCache under parallel frontendMark Rousskov-3/+4
This replaces the single Vec allocation with a series of progressively larger buckets. With the cfg for parallel enabled but with -Zthreads=1, this looks like a slight regression in i-count and cycle counts (<0.1%). With the parallel frontend at -Zthreads=4, this is an improvement (-5% wall-time from 5.788 to 5.4688 on libcore) than our current Lock-based approach, likely due to reducing the bouncing of the cache line holding the lock. At -Zthreads=32 it's a huge improvement (-46%: 8.829 -> 4.7319 seconds).
2024-11-12Querify MonoItem collectionBen Kimock-2/+34
2024-11-12Auto merge of #132843 - RalfJung:mono-time-checks, r=lcnrbors-5/+11
move all mono-time checks into their own folder, and their own query The mono item collector currently also drives two mono-time checks: the lint for "large moves", and the check whether function calls are done with all the required target features. Instead of doing this "inside" the collector, this PR refactors things so that we have a new `rustc_monomorphize::mono_checks` module providing a per-instance query that does these checks. We already have a per-instance query for the ABI checks, so this should be "free" for incremental builds. Non-incremental builds might do a bit more work now since we now have two separate MIR visits (in the collector and the mono-time checks) -- but one of them is cached in case the MIR doesn't change, which is nice. This slightly changes behavior of the large-move check since the "move_size_spans" deduplication logic now only works per-instance, not globally across the entire collector. Cc `@saethlin` since you're also doing some work related to queries and caching and monomorphization, though I don't know if there's any interaction here.
2024-11-12Rollup merge of #132627 - adwinwhite:thir_body_cleanup, r=compiler-errorsMatthias Krüger-1/+1
cleanup: Remove outdated comment of `thir_body` When typeck fails, `thir_body` returns `ErrorGuaranteed` rather than empty body. No other code follows this outdated description except `check_unsafety`, which is also cleaned up in this PR.
2024-11-10query/plumbing: adjust comment to realityRalf Jung-1/+1
2024-11-10move all mono-time checks into their own folder, and their own queryRalf Jung-5/+11
2024-11-10Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errorsbors-0/+8
Emit warning when calling/declaring functions with unavailable vectors. On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. Part of #116558 r? RalfJung
2024-11-07Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errorsJubilee-0/+10
[StableMIR] API to retrieve definitions from crates Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, we're still missing items from trait implementation and primitives. r? ````@compiler-errors:```` Do you know what is the best way to retrieve the associated items for primitives and trait implementations for external crates? Thanks!
2024-11-07[StableMIR] API to retrieve definitions from cratesCelina G. Val-0/+10
Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, add a query to retrieve the number of defs in a foreign crate.
2024-11-05Auto merge of #129884 - RalfJung:forbidden-target-features, r=workingjubileebors-2/+3
mark some target features as 'forbidden' so they cannot be (un)set with -Ctarget-feature The context for this is https://github.com/rust-lang/rust/issues/116344: some target features change the way floats are passed between functions. Changing those target features is unsound as code compiled for the same target may now use different ABIs. So this introduces a new concept of "forbidden" target features (on top of the existing "stable " and "unstable" categories), and makes it a hard error to (un)set such a target feature. For now, the x86 and ARM feature `soft-float` is on that list. We'll have to make some effort to collect more relevant features, and similar features from other targets, but that can happen after the basic infrastructure for this landed. (These features are being collected in https://github.com/rust-lang/rust/issues/131799.) I've made this a warning for now to give people some time to speak up if this would break something. MCP: https://github.com/rust-lang/compiler-team/issues/780
2024-11-05cleanup: Remove outdated comment and logic of `thir_body`Adwin White-1/+1
2024-11-04mark some target features as 'forbidden' so they cannot be (un)setRalf Jung-2/+3
For now, this is just a warning, but should become a hard error in the future
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-12/+8
Stop reexporting ReprOptions from middle::ty
2024-11-01Emit warning when calling/declaring functions with unavailable vectors.Luca Versari-0/+8
On some architectures, vector types may have a different ABI depending on whether the relevant target features are enabled. (The ABI when the feature is disabled is often not specified, but LLVM implements some de-facto ABI.) As discussed in rust-lang/lang-team#235, this turns out to very easily lead to unsound code. This commit makes it a post-monomorphization future-incompat warning to declare or call functions using those vector types in a context in which the corresponding target features are disabled, if using an ABI for which the difference is relevant. This ensures that these functions are always called with a consistent ABI. See the [nomination comment](https://github.com/rust-lang/rust/pull/127731#issuecomment-2288558187) for more discussion. Part of #116558
2024-10-31Encode cross-crate opaque type originMichael Goulet-3/+3
2024-10-30Remap impl-trait lifetimes on HIR instead of AST lowering.Camille GILLOT-0/+17
2024-10-29TypingMode :thinking:lcnr-1/+1
2024-10-28fix clippy::clone_on_ref_ptr for compilerklensy-25/+20
2024-10-26Auto merge of #125116 - blyxyas:ignore-allowed-lints-final, r=cjgillotbors-0/+6
(Big performance change) Do not run lints that cannot emit Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had `#![allow]`ed them. This PR changes that. This change would improve both the Rust lint infrastructure and Clippy, but Clippy will see the most benefit, as it has about 900 registered lints (and growing!) So yeah, with this little patch we filter all lints pre-linting, and remove any lint that is either: - Manually `#![allow]`ed in the whole crate, - Allowed in the command line, or - Not manually enabled with `#[warn]` or similar, and its default level is `Allow` As some lints **need** to run, this PR also adds **loadbearing lints**. On a lint declaration, you can use the ``@eval_always` = true` marker to label it as loadbearing. A loadbearing lint will never be filtered (it will always run) Fixes #106983
2024-10-25tcx.is_const_fn doesn't work the way it is described, remove itRalf Jung-4/+3
Then we can rename the _raw functions to drop their suffix, and instead explicitly use is_stable_const_fn for the few cases where that is really what you want.
2024-10-24Implement const effect predicate in new solverMichael Goulet-0/+19
2024-10-24Remove associated type based effects logicMichael Goulet-6/+0
2024-10-19Follow review comments (optimize the filtering)blyxyas-1/+2
2024-10-19Change lints_to_emit to lints_that_actually_runblyxyas-1/+1
2024-10-19Do not run lints that cannot emitblyxyas-0/+5
Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had #![allow]ed them. This PR changes that
2024-10-18Rollup merge of #131802 - compiler-errors:fnonce-coverage, r=Zalathar许杰友 Jieyou Xu (Joe)-0/+1
Dont ICE when computing coverage of synthetic async closure body I'm not totally certain if this is *right*, but at least it doesn't ICE. The issue is that we end up generating two MIR bodies for each async closure, since the `FnOnce` and `Fn`/`FnMut` implementations have different borrowing behavior of their captured variables. They should ideally both contribute to the coverage, since those MIR bodies are (*to the user*) the same code and should have no behavioral differences. This PR at least suppresses the ICEs, and then I guess worst case we can fix this the right way later. r? Zalathar or re-roll Fixes #131190
2024-10-18Dont ICE when computing coverage of synthetic async closure bodyMichael Goulet-0/+1
2024-10-17move `defining_opaque_types` out of `Canonical`lcnr-16/+16
2024-10-17`DropckOutlives` to `rustc_middle`lcnr-6/+7
2024-10-17`ImpliedOutlivesBounds` to `rustc_middle`lcnr-6/+6
2024-10-04Simplify bound var resolution.Camille GILLOT-3/+3
2024-10-04WfCheck opaques.Camille GILLOT-1/+1
2024-10-04Make naming more consistent.Camille GILLOT-10/+10
2024-10-04Make query backtrace more useful.Camille GILLOT-8/+8
2024-09-27Auto merge of #130946 - matthiaskrgr:rollup-ia4mf0y, r=matthiaskrgrbors-6/+6
Rollup of 6 pull requests Successful merges: - #130718 (Cleanup some known-bug issues) - #130730 (Reorganize Test Headers) - #130826 (Compiler: Rename "object safe" to "dyn compatible") - #130915 (fix typo in triagebot.toml) - #130926 (Update cc to 1.1.22 in library/) - #130932 (etc: Add sample rust-analyzer configs for eglot & helix) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-27Rollup merge of #130826 - fmease:compiler-mv-obj-safe-dyn-compat, ↵Matthias Krüger-6/+6
r=compiler-errors Compiler: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Excludes `compiler/rustc_codegen_cranelift` (to be filed separately). Includes Stable MIR. Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-09-26Use `&raw` in the compilerJosh Stone-2/+2
Like #130865 did for the standard library, we can use `&raw` in the compiler now that stage0 supports it. Also like the other issue, I did not make any doc or test changes at this time.
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-6/+6
2024-09-24Separate collection of crate-local inherent impls from error reportingMichael Goulet-4/+16
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-26/+23
2024-09-05Rollup merge of #101339 - the8472:ci-randomize-debug, r=Mark-SimulacrumMatthias Krüger-0/+1
enable -Zrandomize-layout in debug CI builds This builds rustc/libs/tools with `-Zrandomize-layout` on *-debug CI runners. Only a handful of tests and asserts break with that enabled, which is promising. One test was fixable, the rest is dealt with by disabling them through new cargo features or compiletest directives. The config.toml flag `rust.randomize-layout` defaults to false, so it has to be explicitly enabled for now.
2024-09-02Rollup merge of #129877 - Sajjon:sajjon_fix_typos_batch_2, r=fee1-deadMatthias Krüger-1/+1
chore: Fix typos in 'compiler' (batch 2) Batch 2/3: Fixes typos in `compiler` (See [issue](https://github.com/rust-lang/rust/issues/129874) tracking all PRs with typos fixes)
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1