about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/util.rs
AgeCommit message (Collapse)AuthorLines
2021-10-03Remove re-export.Camille GILLOT-1/+1
2021-09-28More tracing instrumentationOli Scherer-0/+2
2021-09-15Auto merge of #88558 - fee1-dead:const-drop, r=oli-obkbors-4/+4
Const drop The changes are pretty primitive at this point. But at least it works. ^-^ Problems with the current change that I can think of now: - [x] `~const Drop` shouldn't change anything in the non-const world. - [x] types that do not have drop glues shouldn't fail to satisfy `~const Drop` in const contexts. `struct S { a: u8, b: u16 }` This might not fail for `needs_non_const_drop`, but it will fail in `rustc_trait_selection`. - [x] The current change accepts types that have `const Drop` impls but have non-const `Drop` glue. Fixes #88424. Significant Changes: - `~const Drop` is no longer treated as a normal trait bound. In non-const contexts, this bound has no effect, but in const contexts, this restricts the input type and all of its transitive fields to either a) have a `const Drop` impl or b) can be trivially dropped (i.e. no drop glue) - `T: ~const Drop` will not be linted like `T: Drop`. - Instead of recursing and iterating through the type in `rustc_mir::transform::check_consts`, we use the trait system to special case `~const Drop`. See [`rustc_trait_selection::...::candidate_assembly#assemble_const_drop_candidates`](https://github.com/fee1-dead/rust/blob/const-drop/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L817) and others. Changes not related to `const Drop`ping and/or changes that are insignificant: - `Node.constness_for_typeck` no longer returns `hir::Constness::Const` for type aliases in traits. This was previously used to hack how we determine default bound constness for items. But because we now use an explicit opt-in, it is no longer needed. - Removed `is_const_impl_raw` query. We have `impl_constness`, and the only existing use of that query uses `HirId`, which means we can just operate it with hir. - `ty::Destructor` now has a field `constness`, which represents the constness of the destructor. r? `@oli-obk`
2021-09-09Rename `(un)signed` to `(un)signed_int`Andreas Liljeqvist-5/+6
2021-09-09Move `unsigned_max` etc into `Size` againAndreas Liljeqvist-17/+5
2021-09-09Remove the queriesDeadbeef-29/+0
2021-09-09Const droppingDeadbeef-4/+33
2021-08-25Use if-let guards in the codebaseLéo Lanteri Thauvin-6/+4
2021-08-22Fix more “a”/“an” typosFrank Steffahn-1/+1
2021-07-28Bail on any found recursion when expanding opaque typesHans Kratz-1/+5
Fixes #87450. More of a bandaid because it does not fix the exponential complexity of the type folding used for opaque type expansion.
2021-07-05Auto merge of #86674 - Aaron1011:new-querify-limits, r=michaelwoeristerbors-1/+2
Query-ify global limit attribute handling Currently, we read various 'global limits' from inner attributes the crate root (`recursion_limit`, `move_size_limit`, `type_length_limit`, `const_eval_limit`). These limits are then stored in `Sessions`, allowing them to be access from a `TyCtxt` without registering a dependency on the crate root attributes. This PR moves the calculation of these global limits behind queries, so that we properly track dependencies on crate root attributes. During the setup of macro expansion (before we've created a `TyCtxt`), we need to access the recursion limit, which is now done by directly calling into the code shared by the normal query implementations.
2021-07-04Combine individual limit queries into single `limits` queryAaron Hill-1/+1
2021-07-04Auto merge of #86866 - nikomatsakis:issue-84841, r=oli-obkbors-0/+9
Hack: Ignore inference variables in certain queries Fixes #84841 Fixes #86753 Some queries are not built to accept types with inference variables, which can lead to ICEs. These queries probably ought to be converted to canonical form, but as a quick workaround, we can return conservative results in the case that inference variables are found. We should file a follow-up issue (and update the FIXMEs...) to do the proper refactoring. cc `@arora-aman` r? `@oli-obk`
2021-07-04Query-ify global limit attribute handlingAaron Hill-1/+2
2021-07-04tag issues with FIXMENiko Matsakis-1/+1
2021-07-04be conservative in has_significant_dropNiko Matsakis-0/+9
2021-07-03Use `BoundVarsCollector` for nowYuki Okushi-1/+5
2021-05-14add new attribute rustc_insignificant_dtor and a query to check if a type ↵Dhruv Jauhar-0/+33
has a significant drop
2021-04-27move `representability` out of `rustc_middle`lcnr-189/+2
2021-03-31Cleanups and commentsJack Huey-1/+0
2021-03-31Add var to BoundRegion. Add query to get bound vars for applicable items.Jack Huey-4/+4
2021-03-31Track bound varsJack Huey-1/+1
2021-03-31Add tcx lifetime to BinderJack Huey-1/+1
2021-03-29Remove a FIXME resolved by #73578JohnTitor-1/+0
2021-03-26Use iter::zip in compiler/Josh Stone-4/+2
2021-03-21Don't consider !Unpin references as noaliasNikita Popov-0/+40
Such structures may contain self-references, in which case the same location may be accessible through a pointer that is not based-on the noalias pointer. This is still grey area as far as language semantics are concerned, but checking for !Unpin as an indicator for self-referential sturctures seems like a good approach for the meantime.
2021-01-18Use `rustc_type_ir::{IntTy,UintTy,FloatTy} instead of the `rustc_ast` ones ↵LeSeulArtichaut-7/+7
in types
2020-12-18Make BoundRegion have a kind of BoungRegionKindJack Huey-1/+2
2020-12-04check the recursion limit when finding struct tailSNCPlay42-2/+8
2020-11-16wordslcnr-0/+31
2020-11-16compiler: fold by valueBastian Kauschke-1/+1
2020-11-04`u128` truncation and sign extension are not just interpreter relatedoli-6/+5
2020-10-19fix Rvalue::ty for ThreadLocalRefRalf Jung-0/+1
2020-10-19fix static_ptr_ty for foreign statics, and more comments in check_unsafetyRalf Jung-0/+3
2020-10-15mangling: non-monomorphic `#[rustc_symbol_name]`David Wood-16/+2
This commit adjust `#[rustc_symbol_name]` so that it can be applied to non-monomorphic functions without producing an ICE. Signed-off-by: David Wood <david@davidtw.co>
2020-10-14Rollup merge of #77892 - est31:remove_redundant_absolute_paths, r=lcnrYuki Okushi-2/+2
Replace absolute paths with relative ones Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs.
2020-10-13Replace absolute paths with relative onesest31-2/+2
Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs.
2020-10-10Take functions by valueDániel Buga-1/+1
2020-10-09Revert calculate_dtor signature changeDániel Buga-1/+1
2020-10-09Add find_map_relevant_implDániel Buga-4/+4
2020-09-18don't take `TyCtxt` by referenceBastian Kauschke-6/+4
2020-09-04Change ty.kind to a methodLeSeulArtichaut-20/+20
2020-08-30mv compiler to compiler/mark-0/+1168