summary refs log tree commit diff
path: root/src/librustc_middle/ty/instance.rs
AgeCommit message (Collapse)AuthorLines
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-3/+3
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-08-14Rework `rustc_serialize`Matthew Jasper-2/+2
- 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-09instance: only polymorphize upvar substsDavid Wood-20/+33
This commit restricts the substitution polymorphization added in #75255 to only apply to the tupled upvar substitution, rather than all substitutions, fixing a bunch of regressions when polymorphization is enabled. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: polymorphize `FnDef` substsDavid Wood-0/+8
This commit extends previous polymorphization of substs to polymorphize `FnDef`. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: avoid unnecessary `mk_` callsDavid Wood-2/+10
This commit avoids unnecessary calls to `mk_closure` and `mk_generator` by checking if the polymorphized substs match the original substs. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07ty: add `MAY_POLYMORPHIZE` flagDavid Wood-1/+5
This commit adds a `MAY_POLYMORPHIZE` which checks for closures and generators so that polymorphization of substs does not need to traverse every substs. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: always polymorphize substsDavid Wood-38/+8
By always polymorphizing substitutions, functions which take closures as arguments (e.g. `impl Fn()`) can have fewer mono items when some of the argument closures can be polymorphized. Signed-off-by: David Wood <david@davidtw.co>
2020-08-07instance: polymorphize upvar closures/generatorsDavid Wood-20/+87
This commit modifies how instances are polymorphized so that closures and generators have any closures or generators captured within their upvars also polymorphized - this avoids symbol clashes with the new symbol mangling scheme. Signed-off-by: David Wood <david@davidtw.co>
2020-07-27Auto merge of #74784 - anp:track-vtables, r=eddybbors-1/+1
Fix #[track_caller] shims for trait objects. We were missing an Instance::resolve_for_fn_ptr in resolve_for_vtable. Closes #74764.
2020-07-26Fix #[track_caller] shims for trait objects.Adam Perry-1/+1
We were missing an Instance::resolve_for_fn_ptr in resolve_for_vtable. Closes #74764.
2020-07-20index: introduce and use `FiniteBitSet`David Wood-4/+4
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-20mir: `unused_generic_params` queryDavid Wood-26/+40
This commit implements the `unused_generic_params` query, an initial version of polymorphization which detects when an item does not use generic parameters and is being needlessly monomorphized as a result. Signed-off-by: David Wood <david@davidtw.co>
2020-07-15unify Instance::resolveBastian Kauschke-11/+14
2020-07-15WithOptConstParam::dummy -> WithOptConstParam::unknownBastian Kauschke-2/+2
2020-07-15improve namingBastian Kauschke-5/+5
2020-07-15update const arg queriesBastian Kauschke-1/+8
2020-07-15InstanceDef::ItemBastian Kauschke-13/+28
2020-07-15const_eval_resolveBastian Kauschke-0/+11
2020-06-14Improve `Instance` docsJonas Schievink-11/+41
2020-05-13use `require_lang_item` over `unwrap`.Bastian Kauschke-2/+2
2020-04-22Rollup merge of #70970 - eddyb:trait-vs-impl-mismatch, r=oli-obkDylan DPC-8/+21
Detect mistyped associated consts in `Instance::resolve`. *Based on #71049 to prevent redundant/misleading downstream errors.* Fixes #70942 by refusing to resolve an associated `const` if it doesn't have the same type in the `impl` that it does in the `trait` (which we assume had errored, and `delay_span_bug` guards against bugs).
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-3/+2
2020-04-18Detect mistyped associated consts in `Instance::resolve`.Eduard-Mihai Burtescu-7/+13
2020-04-18ty/instance: use `ParamEnvAnd` in the `resolve_instance` query.Eduard-Mihai Burtescu-1/+8
2020-04-14Rename AssocKind::Method to AssocKind::FnRustin-Liu-1/+1
Rename fn_has_self_argument to fn_has_self_parameter Rename AssocItemKind::Method to AssocItemKind::Fn Refine has_no_input_arg Refine has_no_input_arg Revert has_no_input_arg Refine suggestion_descr Move as_def_kind into AssocKind Signed-off-by: Rustin-Liu <rustin.liu@gmail.com> Fix tidy check issue Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-07fix abuses of tykind::errmark-1/+1
2020-04-05Query-ify Instance::resolveAaron Hill-20/+3
2020-04-02direct imports for langitem stuffMazdak Farrokhzad-1/+1
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-0/+460