Skip to content

Commit

Permalink
Add assertion to ensure the query doesn't get called before type infe…
Browse files Browse the repository at this point in the history
…rerence is done.
  • Loading branch information
crlf0710 committed Aug 19, 2021
1 parent e1e0989 commit c22dfab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/mod.rs
Expand Up @@ -765,8 +765,8 @@ pub fn vtable_trait_upcasting_coercion_new_vptr_slot(
),
) -> Option<usize> {
let (source, target) = key;
debug_assert!(matches!(&source.kind(), &ty::Dynamic(..)));
debug_assert!(matches!(&target.kind(), &ty::Dynamic(..)));
assert!(matches!(&source.kind(), &ty::Dynamic(..)) && !source.needs_infer());
assert!(matches!(&target.kind(), &ty::Dynamic(..)) && !target.needs_infer());

// this has been typecked-before, so diagnostics is not really needed.
let unsize_trait_did = tcx.require_lang_item(LangItem::Unsize, None);
Expand Down

0 comments on commit c22dfab

Please sign in to comment.