about summary refs log tree commit diff
path: root/src/librustc_middle/ty/query
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-2695/+0
2020-08-18Validate the MIR of all optimizations in the mir-opt directoryOliver Scherer-1/+1
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-4/+2
2020-08-16Use LocalDefId instead of HirId for reachable_set elements.Eduard-Mihai Burtescu-1/+1
2020-08-14Rework `rustc_serialize`Matthew Jasper-201/+162
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-08-13self-profile: Cache more query key strings when doing self-profiling.Michael Woerister-1/+45
2020-08-09rustc_middle: use IndexSet in OnDiskCacheJosh Stone-17/+5
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-8/+4
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-03Use more appropriate `tls::with_*` methods in some places.Nicholas Nethercote-3/+2
2020-08-03Remove `GCX_PTR`.Nicholas Nethercote-5/+8
We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows implicit access to a `GlobalCtxt` and some other things. We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same `GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR` is only used in the parallel compiler's `handle_deadlock()` function. This commit does the following. - It removes `GCX_PTR`. - It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a `GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now equivalent to the old `tls::enter_global()`. - Makes `tls::get_tlv()` public for the parallel compiler, because it's now used in `handle_deadlock()`.
2020-08-03Rollup merge of #75054 - cjgillot:rename-depkind, r=petrochenkovYuki Okushi-6/+6
Rename rustc_middle::cstore::DepKind to CrateDepKind It is ambiguous with DepGraph's own DepKind.
2020-08-02Rename rustc_middle::cstore::DepKind to DependencyKind.Camille GILLOT-6/+6
2020-07-31Auto merge of #65989 - Aaron1011:fix/normalize-param-env, r=nikomatsakisbors-0/+11
Normalize all opaque types when converting ParamEnv to Reveal::All When we normalize a type using a ParamEnv with a reveal mode of RevealMode::All, we will normalize opaque types to their underlying types (e.g. `type MyOpaque = impl Foo` -> `StructThatImplsFoo`). However, the ParamEnv may still have predicates referring to the un-normalized opaque type (e.g. `<T as MyTrait<MyOpaque>>`). This can cause trait projection to fail, since a type containing normalized opaque types will not match up with the un-normalized type in the `ParamEnv`. To fix this, we now explicitly normalize all opaque types in caller_bounds of a `ParamEnv` when changing its mode to `RevealMode::All`. This ensures that all predicatse will refer to the underlying types of any opaque types involved, allowing them to be matched up properly during projection. To reflect the fact that normalization is occuring, `ParamEnv::with_reveal_all` is renamed to `ParamEnv::with_reveal_all_normalized` Fixes #65918
2020-07-26Share serialization optimization between incr and metadataAaron Hill-28/+34
2020-07-26Hygiene serialization implementationAaron Hill-72/+148
2020-07-22Normalize opaque types when converting `ParamEnv` to `Reveal::All`Aaron Hill-0/+11
Fixes #65918
2020-07-20index: introduce and use `FiniteBitSet`David Wood-1/+1
This commit introduces a `FiniteBitSet` type which replaces the manual bit manipulation which was being performed in polymorphization. Signed-off-by: David Wood <david@davidtw.co>
2020-07-17Rename TypeckTables to TypeckResults.Valentin Lazureanu-1/+1
2020-07-17Remove some `Symbol:as_str()` calls.Nicholas Nethercote-3/+4
2020-07-15Auto merge of #74113 - lcnr:type-dependent-consts-2, r=eddybbors-0/+33
Support const args in type dependent paths (Take 2) once more, except it is sound this time :smiling_face_with_three_hearts: previously #71154 ----- ```rust #![feature(const_generics)] struct A; impl A { fn foo<const N: usize>(&self) -> usize { N } } struct B; impl B { fn foo<const N: usize>(&self) -> usize { 42 } } fn main() { let a = A; a.foo::<7>(); } ``` When calling `type_of` for generic const arguments, we now use the `TypeckTables` of the surrounding body to get the expected type. This alone causes cycle errors though, as we now have `typeck_tables_of(main)` -> `...` -> `type_of(main_ANON0 := 7)` -> `typeck_tables_of(main)` :zap: (see https://github.com/rust-lang/rust/issues/68400#issuecomment-611760290) To prevent this we must not call `type_of(const_arg)` during `typeck_tables_of`. This is achieved by calling `type_of(param_def_id)` instead. We have to somehow remember the `DefId` of the param through all of typeck, which is done using the struct `ty::WithOptConstParam<DefId>`, which replaces `DefId` where needed and contains an `Option<DefId>` to be able to store the const parameter in case it exists. Queries which are currently cached on disk are split into two variants: `query_name`(cached) and `query_name_(of|for)_const_arg`(not cached), with `query_name_of_const_arg` taking a pair `(did, param_did): (LocalDefId, DefId)`. For some queries a method `query_name_of_opt_const_arg` is added to `TyCtxt` which takes a `ty::WithOptConstParam` and either calls `query_name` or `query_name_of_const_arg` depending on the value of `const_param_did`. r? @eddyb @varkor
2020-07-15improve namingBastian Kauschke-1/+1
2020-07-15update const arg queriesBastian Kauschke-2/+13
2020-07-15typeck all the tablesBastian Kauschke-0/+11
2020-07-15const_eval_resolveBastian Kauschke-0/+11
2020-07-15Change `SymbolName::name` to a `&str`.Nicholas Nethercote-5/+9
This eliminates a bunch of `Symbol::intern()` and `Symbol::as_str()` calls, which is good, because they require locking the interner. Note that the unsafety in `from_cycle_error()` is identical to the unsafety on other adjacent impls.
2020-07-09Rollup merge of #74079 - nnethercote:session-globals, r=nikomatsakisManish Goregaokar-8/+7
Eliminate confusing "globals" terminology. There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs` r? @Aaron1011
2020-07-09Eliminate confusing "globals" terminology.Nicholas Nethercote-8/+7
There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs`
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-9/+12
2020-07-05Replace early-bound normalization hack with per-query key/value type aliases.Eduard-Mihai Burtescu-2/+21
2020-06-30Switch crate_extern_paths to a query, and tweak wording.Eric Huss-0/+1
2020-06-21Cache decoded predicate shorthandsMatthew Jasper-16/+31
2020-06-15make all uses of ty::Error or ConstKind::Error delay a span bugmark-2/+2
2020-06-10Use min_specialization in the remaining rustc cratesMatthew Jasper-59/+62
2020-06-05Rename traits::Vtable to ImplSource.Ana-Maria Mihalache-1/+1
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-7/+7
2020-05-20Rename some types describing native librariesVadim Petrochenkov-2/+3
NativeLibrary(Kind) -> NativeLib(Kind) NativeStatic -> StaticBundle NativeStaticNobundle -> StaticNoBundle NativeFramework -> Framework NativeRawDylib -> RawDylib NativeUnknown -> Unspecified
2020-05-15implement type_implments_trait querycsmoe-0/+12
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-1/+1
2020-05-07Auto merge of #55617 - oli-obk:stacker, r=nagisa,oli-obkbors-1/+3
Prevent compiler stack overflow for deeply recursive code I was unable to write a test that 1. runs in under 1s 2. overflows on my machine without this patch The following reproduces the issue, but I don't think it's sensible to include a test that takes 30s to compile. We can now easily squash newly appearing overflows by the strategic insertion of calls to `ensure_sufficient_stack`. ```rust // compile-pass #![recursion_limit="1000000"] macro_rules! chain { (EE $e:expr) => {$e.sin()}; (RECURSE $i:ident $e:expr) => {chain!($i chain!($i chain!($i chain!($i $e))))}; (Z $e:expr) => {chain!(RECURSE EE $e)}; (Y $e:expr) => {chain!(RECURSE Z $e)}; (X $e:expr) => {chain!(RECURSE Y $e)}; (A $e:expr) => {chain!(RECURSE X $e)}; (B $e:expr) => {chain!(RECURSE A $e)}; (C $e:expr) => {chain!(RECURSE B $e)}; // causes overflow on x86_64 linux // less than 1 second until overflow on test machine // after overflow has been fixed, takes 30s to compile :/ (D $e:expr) => {chain!(RECURSE C $e)}; (E $e:expr) => {chain!(RECURSE D $e)}; (F $e:expr) => {chain!(RECURSE E $e)}; // more than 10 seconds (G $e:expr) => {chain!(RECURSE F $e)}; (H $e:expr) => {chain!(RECURSE G $e)}; (I $e:expr) => {chain!(RECURSE H $e)}; (J $e:expr) => {chain!(RECURSE I $e)}; (K $e:expr) => {chain!(RECURSE J $e)}; (L $e:expr) => {chain!(RECURSE L $e)}; } fn main() { let x = chain!(D 42.0_f32); } ``` fixes #55471 fixes #41884 fixes #40161 fixes #34844 fixes #32594 cc @alexcrichton @rust-lang/compiler I looked at all code that checks the recursion limit and inserted stack growth calls where appropriate.
2020-05-02Rollup merge of #71772 - cjgillot:ensure, r=petrochenkovDylan DPC-0/+1
Mark query function as must_use. And use the `ensure()` version when the result is not needed.
2020-05-02Move ensure_sufficient_stack to data_structuresSimonas Kazlauskas-1/+1
We anticipate this to have uses in all sorts of crates and keeping it in `rustc_data_structures` enables access to it from more locations without necessarily pulling in the large `librustc` crate.
2020-05-02Prevent stack overflow for deeply recursive codeOliver Scherer-1/+3
2020-05-02Auto merge of #71776 - Dylan-DPC:rollup-k1iuuow, r=Dylan-DPCbors-13/+0
Rollup of 5 pull requests Successful merges: - #71018 (handle ConstValue::ByRef in relate) - #71758 (Remove leftover chalk types) - #71760 (Document unsafety for `*const T` and `*mut T`) - #71761 (doc: reference does not exist, probably a typo) - #71762 (doc: this resulted in a link pointing to a non-existent target) Failed merges: - #71726 (Suggest deref when coercing `ty::Ref` to `ty::RawPtr` with arbitrary mutability) r? @ghost
2020-05-01Remove leftover chalk typesJack Huey-13/+0
2020-05-01Mark query function as must_use.Camille GILLOT-0/+1
2020-05-01Move the DepNode construction to librustc_query_system.Camille GILLOT-7/+1
2020-05-01Monomorphise load_from_disk_and_cache_in_memory.Camille GILLOT-1/+1
2020-04-28Introduce ArenaStorage.Camille GILLOT-1/+1
2020-04-28Allow the QueryCache to specify storage.Camille GILLOT-3/+11
2020-04-27Use `LocalDefId` for `type_param_predicates` querymarmeladema-0/+11