Add assertion to ensure the query doesn't get called before type infererence is done.

This commit is contained in:
Charles Lew 2021-08-20 02:37:00 +08:00
parent e1e0989a0d
commit c22dfab215

View file

@ -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);