Skip to content

Commit

Permalink
Always encode implied_predicates query for traits
Browse files Browse the repository at this point in the history
With associated type bounds enabled, the implied_predicates and super_predicates
queries may differ for traits, since associated type bounds are also
implied but are not counted as super predicates.
  • Loading branch information
compiler-errors committed Mar 22, 2024
1 parent c855bf6 commit 3361488
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 31 deletions.
13 changes: 1 addition & 12 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Expand Up @@ -211,6 +211,7 @@ provide! { tcx, def_id, other, cdata,
generics_of => { table }
inferred_outlives_of => { table_defaulted_array }
super_predicates_of => { table }
implied_predicates_of => { table }
type_of => { table }
type_alias_is_lazy => { cdata.root.tables.type_alias_is_lazy.get(cdata, def_id.index) }
variances_of => { table }
Expand Down Expand Up @@ -276,18 +277,6 @@ provide! { tcx, def_id, other, cdata,
.map(|lazy| lazy.decode((cdata, tcx)))
.process_decoded(tcx, || panic!("{def_id:?} does not have trait_impl_trait_tys")))
}
implied_predicates_of => {
cdata
.root
.tables
.implied_predicates_of
.get(cdata, def_id.index)
.map(|lazy| lazy.decode((cdata, tcx)))
.unwrap_or_else(|| {
debug_assert_eq!(tcx.def_kind(def_id), DefKind::Trait);
tcx.super_predicates_of(def_id)
})
}

associated_types_for_impl_traits_in_associated_fn => { table_defaulted_array }

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Expand Up @@ -1435,6 +1435,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
if let DefKind::Trait = def_kind {
record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id));
record!(self.tables.super_predicates_of[def_id] <- self.tcx.super_predicates_of(def_id));
record!(self.tables.implied_predicates_of[def_id] <- self.tcx.implied_predicates_of(def_id));

let module_children = self.tcx.module_children_local(local_id);
record_array!(self.tables.module_children_non_reexports[def_id] <-
Expand Down
1 change: 1 addition & 0 deletions tests/ui/associated-type-bounds/implied-predicates.rs
@@ -1,4 +1,5 @@
//@ aux-build:implied-predicates.rs
//@ check-pass

extern crate implied_predicates;
use implied_predicates::Bar;
Expand Down
19 changes: 0 additions & 19 deletions tests/ui/associated-type-bounds/implied-predicates.stderr

This file was deleted.

0 comments on commit 3361488

Please sign in to comment.