about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query/keys.rs
AgeCommit message (Collapse)AuthorLines
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-13Rename ty_def_id so people will stop using it by accidentMichael Goulet-5/+6
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-0/+8
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-12/+0
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-1/+13
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-0/+9
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-2/+1
Stop reexporting ReprOptions from middle::ty
2024-10-17move `defining_opaque_types` out of `Canonical`lcnr-2/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-07-29Reformat `use` declarations.Nicholas Nethercote-7/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-2/+2
2024-06-14Only compute vtable information during codegenMichael Goulet-0/+8
2024-04-11Auto merge of #122213 - estebank:issue-50195, r=oli-obk,estebankbors-0/+13
Provide suggestion to dereference closure tail if appropriate When encoutnering a case like ```rust use std::collections::HashMap; fn main() { let vs = vec![0, 0, 1, 1, 3, 4, 5, 6, 3, 3, 3]; let mut counts = HashMap::new(); for num in vs { let count = counts.entry(num).or_insert(0); *count += 1; } let _ = counts.iter().max_by_key(|(_, v)| v); ``` produce the following suggestion ``` error: lifetime may not live long enough --> $DIR/return-value-lifetime-error.rs:13:47 | LL | let _ = counts.iter().max_by_key(|(_, v)| v); | ------- ^ returning this value requires that `'1` must outlive `'2` | | | | | return type of closure is &'2 &i32 | has type `&'1 (&i32, &i32)` | help: dereference the return value | LL | let _ = counts.iter().max_by_key(|(_, v)| **v); | ++ ``` Fix #50195.
2024-04-05Provide suggestion to dereference closure tail if appropriateEsteban Küber-0/+13
When encoutnering a case like ```rust //@ run-rustfix use std::collections::HashMap; fn main() { let vs = vec![0, 0, 1, 1, 3, 4, 5, 6, 3, 3, 3]; let mut counts = HashMap::new(); for num in vs { let count = counts.entry(num).or_insert(0); *count += 1; } let _ = counts.iter().max_by_key(|(_, v)| v); ``` produce the following suggestion ``` error: lifetime may not live long enough --> $DIR/return-value-lifetime-error.rs:13:47 | LL | let _ = counts.iter().max_by_key(|(_, v)| v); | ------- ^ returning this value requires that `'1` must outlive `'2` | | | | | return type of closure is &'2 &i32 | has type `&'1 (&i32, &i32)` | help: dereference the return value | LL | let _ = counts.iter().max_by_key(|(_, v)| **v); | ++ ``` Fix #50195.
2024-04-04cache type info for ParamEnvLukas Markeffsky-1/+1
2024-03-26Remove `CacheSelector` trait now that we can use GATsOli Scherer-55/+54
2024-03-22Add `tag_for_variant` queryJack Wrenn-0/+9
This query allows for sharing code between `rustc_const_eval` and `rustc_transmutability`. Also moves `DummyMachine` to `rustc_const_eval`.
2024-01-15Cache local DefId-keyed queries without hashingMark Rousskov-1/+2
Foreign maps are used to cache external DefIds, typically backed by metadata decoding. In the future we might skip caching `V` there (since loading from metadata usually is already cheap enough), but for now this cuts down on the impact to memory usage and time to None-init a bunch of memory. Foreign data is usually much sparser, since we're not usually loading *all* entries from the foreign crate(s).
2024-01-08Don't check for recursion in generator witness fieldsMichael Goulet-4/+9
2023-10-02remove another unused Key implRalf Jung-9/+0
2023-10-02remove Key impls for types that involve an AllocIdRalf Jung-24/+0
2023-09-21rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::ConstRalf Jung-1/+1
2023-09-19move ConstValue into mirRalf Jung-3/+2
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-08-14Use `{Local}ModDefId` in many queriesNilstrieb-1/+36
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-5/+5
2023-07-06get rid of a bit more calls to poly_selectMichael Goulet-2/+2
2023-07-05Specialize `try_destructure_mir_constant` for its sole userOli Scherer-0/+9
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-1/+1
2023-04-20Remove WithOptconstParam.Camille GILLOT-9/+1
2023-04-12Rollup merge of #110153 - DaniPopes:compiler-typos, r=NilstriebMatthias Krüger-1/+1
Fix typos in compiler I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory. Refs #110150
2023-04-11Split super_predicates_that_define_assoc_type query from super_predicates_ofMichael Goulet-1/+1
2023-04-10Fix typos in compilerDaniPopes-1/+1
2023-03-28Move `mir::Field` → `abi::FieldIdx`Scott McMurray-1/+2
The first PR for https://github.com/rust-lang/compiler-team/issues/606 This is just the move-and-rename, because it's plenty big-and-bitrotty already. Future PRs will start using `FieldIdx` more broadly, and concomitantly removing `FieldIdx::new`s.
2023-03-21LocalCrate keyMichael Goulet-2/+6
2023-03-21AsLocalKey traitMichael Goulet-304/+43
2023-03-21Use LocalDefId in ItemCtxtMichael Goulet-3/+3
2023-03-21Use local key in providersMichael Goulet-109/+202
2023-03-14Use `unused_generic_params` from crate metadataMichael Goulet-2/+2
2023-02-27Unify all validity check intrinsicsNilstrieb-2/+2
Also merges the inhabitedness check into the query to further unify the code paths.
2023-02-23Unify validity checks into a single queryNilstrieb-1/+23
Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern. I am planning on adding a further initness to check, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one.
2023-02-11Create a single value cache for the () query keyJohn Kåre Alsaker-2/+2
2022-12-16Add a comment warning against using associated type defaults <3Maybe Waffle-0/+8
2022-12-09Help rust-analyzer normalize query return typesMaybe Waffle-1/+97
2022-11-01Use Key impl to select cache.Camille GILLOT-1/+10
2022-11-01Move keys module.Camille GILLOT-0/+585