about summary refs log tree commit diff
path: root/compiler/rustc_infer/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-24 10:21:23 +0000
committerbors <bors@rust-lang.org>2021-07-24 10:21:23 +0000
commitf9b95f92c8af07a24a870e5f6117aa5dfcee5f17 (patch)
treedb71445130307ccf0e6f2ff04581852b430dccb4 /compiler/rustc_infer/src
parent1c66d11a34047be1eb6c50703f8ba6689a15e716 (diff)
parentfbb353ae2b5cef75c7d97be4f3c2283a63e0fd7f (diff)
downloadrust-f9b95f92c8af07a24a870e5f6117aa5dfcee5f17.tar.gz
rust-f9b95f92c8af07a24a870e5f6117aa5dfcee5f17.zip
Auto merge of #86461 - crlf0710:rich_vtable, r=nikomatsakis
Refactor vtable format for upcoming trait_upcasting feature.

This modifies vtable format:
1. reordering occurrence order of methods coming from different traits
2. include `VPtr`s for supertraits where this vtable cannot be directly reused during trait upcasting.
Also, during codegen, the vtables corresponding to these newly included `VPtr` will be requested and generated.

For the cases where this vtable can directly used, now the super trait vtable has exactly the same content to some prefix of this one.

r? `@bjorn3`
cc `@RalfJung`
cc `@rust-lang/wg-traits`
Diffstat (limited to 'compiler/rustc_infer/src')
-rw-r--r--compiler/rustc_infer/src/traits/util.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs
index 1cde4802a40..ce1445f8a47 100644
--- a/compiler/rustc_infer/src/traits/util.rs
+++ b/compiler/rustc_infer/src/traits/util.rs
@@ -14,17 +14,17 @@ pub fn anonymize_predicate<'tcx>(
     tcx.reuse_or_mk_predicate(pred, new)
 }
 
-struct PredicateSet<'tcx> {
+pub struct PredicateSet<'tcx> {
     tcx: TyCtxt<'tcx>,
     set: FxHashSet<ty::Predicate<'tcx>>,
 }
 
 impl PredicateSet<'tcx> {
-    fn new(tcx: TyCtxt<'tcx>) -> Self {
+    pub fn new(tcx: TyCtxt<'tcx>) -> Self {
         Self { tcx, set: Default::default() }
     }
 
-    fn insert(&mut self, pred: ty::Predicate<'tcx>) -> bool {
+    pub fn insert(&mut self, pred: ty::Predicate<'tcx>) -> bool {
         // We have to be careful here because we want
         //
         //    for<'a> Foo<&'a i32>