about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/instance.rs
AgeCommit message (Collapse)AuthorLines
2023-03-27Add a builtin `FnPtr` traitlcnr-1/+18
2023-02-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-2/+3
2022-12-24Rename some compare_method functionsMichael Goulet-1/+1
2022-12-12normalize receiver substs and erase the regionsTakayuki Maeda-1/+7
use a smaller example
2022-11-27Rename `fn_trait_kind_from_{from_lang=>def_id}` to better convey meaningMaybe Waffle-1/+1
2022-11-25move 2 candidates into builtin candidatelcnr-2/+0
2022-11-24Avoid `GenFuture` shim when compiling async constructsArpad Borsos-0/+6
Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`. The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim. The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.
2022-10-27Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functionsMaybe Waffle-2/+2
Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions`
2022-10-10Rollup merge of #102786 - compiler-errors:no-tuple-candidate, r=lcnrDylan DPC-2/+1
Remove tuple candidate, nothing special about it r? `@lcnr` you mentioned this during the talk you gave i think
2022-10-07Remove tuple candidate, nothing special about itMichael Goulet-2/+1
2022-10-07Change InferCtxtBuilder from enter to buildCameron Steffen-13/+11
2022-10-06Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnrMatthias Krüger-31/+5
make `compare_const_impl` a query and use it in `instance.rs` Fixes #88365 the bug in #88365 was caused by some `instance.rs` code using the `PartialEq` impl on `Ty` to check that the type of the associated const in an impl is the same as the type of the associated const in the trait definition. This was wrong for two reasons: - the check typeck does is that the impl type is a subtype of the trait definition's type (see `mismatched_impl_ty_2.rs` which [was ICEing](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f6d60ebe6745011f0d52ab2bc712025d) before this PR on stable) - it assumes that if two types are equal then the `PartialEq` impl will reflect that which isnt true for higher ranked types or type level constants when `feature(generic_const_exprs)` is enabled (see `mismatched_impl_ty_3.rs` for higher ranked types which was [ICEing on stable](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d7af131a655ed515b035624626c62c71)) r? `@lcnr`
2022-10-04missing value to delay_span_buglcnr-2/+6
2022-09-30make query take `(LocalDefId, DefId)`Boxy-7/+3
2022-09-30make `compare_const_impl` a query and use it in `instance.rs`Boxy-30/+8
2022-09-27rustc_typeck to rustc_hir_analysislcnr-1/+1
2022-09-12Auto merge of #100251 - compiler-errors:tuple-trait-2, r=jackh726bors-1/+2
Implement `std::marker::Tuple` Split out from #99943 (https://github.com/rust-lang/rust/pull/99943#pullrequestreview-1064459183). Implements part of rust-lang/compiler-team#537 r? `@jackh726`
2022-09-11Apply formatting fixesAndrew Cann-4/+4
2022-09-11implement Copy/Clone for generatorsAndrew Cann-1/+4
2022-09-09rename `codegen_fulfill_obligation`lcnr-4/+2
2022-09-09`resolve_instance`: remove `BoundVarsCollector`lcnr-108/+3
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-2/+0
by module
2022-08-07Built-in implementation of Tuple traitMichael Goulet-1/+2
2022-08-01Store associated item defaultness in impl_defaultness.Camille GILLOT-1/+1
2022-07-22Do not resolve associated const when there is no provided valueMichael Goulet-0/+5
2022-07-06Update TypeVisitor pathsAlan Egerton-1/+1
2022-07-05Relax constrained generics to TypeVisitableAlan Egerton-2/+2
2022-06-30Recover when failing to normalize closure signature.Camille GILLOT-2/+2
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-2/+0
2022-06-08Auto merge of #97860 - Dylan-DPC:rollup-t3vxos8, r=Dylan-DPCbors-5/+9
Rollup of 5 pull requests Successful merges: - #97595 (Remove unwrap from get_vtable) - #97597 (Preserve unused pointer to address casts) - #97819 (Recover `import` instead of `use` in item) - #97823 (Recover missing comma after match arm) - #97851 (Use repr(C) when depending on struct layout in ptr tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-08Folding revamp.Nicholas Nethercote-1/+3
This commit makes type folding more like the way chalk does it. Currently, `TypeFoldable` has `fold_with` and `super_fold_with` methods. - `fold_with` is the standard entry point, and defaults to calling `super_fold_with`. - `super_fold_with` does the actual work of traversing a type. - For a few types of interest (`Ty`, `Region`, etc.) `fold_with` instead calls into a `TypeFolder`, which can then call back into `super_fold_with`. With the new approach, `TypeFoldable` has `fold_with` and `TypeSuperFoldable` has `super_fold_with`. - `fold_with` is still the standard entry point, *and* it does the actual work of traversing a type, for all types except types of interest. - `super_fold_with` is only implemented for the types of interest. Benefits of the new model. - I find it easier to understand. The distinction between types of interest and other types is clearer, and `super_fold_with` doesn't exist for most types. - With the current model is easy to get confused and implement a `super_fold_with` method that should be left defaulted. (Some of the precursor commits fixed such cases.) - With the current model it's easy to call `super_fold_with` within `TypeFolder` impls where `fold_with` should be called. The new approach makes this mistake impossible, and this commit fixes a number of such cases. - It's potentially faster, because it avoids the `fold_with` -> `super_fold_with` call in all cases except types of interest. A lot of the time the compile would inline those away, but not necessarily always.
2022-06-05get_vtable returns opt instd of unwrppingouz-a-5/+9
2022-05-16Add a query for checking whether a function is an intrinsic.Oli Scherer-7/+1
2022-05-11Gracefully fail to resolve associated items instead of `delay_span_bug`.Camille GILLOT-1/+17
2022-03-21Rename `~const Drop` to `~const Destruct`Deadbeef-1/+1
2022-03-16rustc_error: make ErrorReported impossible to constructmark-2/+2
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-7/+7
2022-02-15Overhaul `RegionKind` and `Region`.Nicholas Nethercote-2/+2
Specifically, change `Region` from this: ``` pub type Region<'tcx> = &'tcx RegionKind; ``` to this: ``` pub struct Region<'tcx>(&'tcx Interned<RegionKind>); ``` This now matches `Ty` and `Predicate` more closely. Things to note - Regions have always been interned, but we haven't been using pointer-based `Eq` and `Hash`. This is now happening. - I chose to impl `Deref` for `Region` because it makes pattern matching a lot nicer, and `Region` can be viewed as just a smart wrapper for `RegionKind`. - Various methods are moved from `RegionKind` to `Region`. - There is a lot of tedious sigil changes. - A couple of types like `HighlightBuilder`, `RegionHighlightMode` now have a `'tcx` lifetime because they hold a `Ty<'tcx>`, so they can call `mk_region`. - A couple of test outputs change slightly, I'm not sure why, but the new outputs are a little better.
2022-01-15initial revertEllen-4/+0
2022-01-07Add query to avoid name comparison in `leaf_def`Matthew Jasper-24/+19
2021-11-08impl Copy/Clone for arrays in std, not in compilerbstrie-1/+1
2021-09-09Const drop selection candidatesDeadbeef-1/+2
2021-08-26make unevaluated const substs optionallcnr-2/+3
2021-08-26require a `tcx` for `TypeVisitor`lcnr-0/+3
2021-08-18Fold `vtable_trait_upcasting_coercion_new_vptr_slot` logic into obligation ↵Charles Lew-1/+2
processing.
2021-07-03Simplify `visit_region` implementationYuki Okushi-13/+4
2021-07-03Correct `visit_region` implementationYuki Okushi-1/+26
2021-07-03Use `BoundVarsCollector` for nowYuki Okushi-9/+91