Skip to content

Commit c22dfab

Browse files
committed
Add assertion to ensure the query doesn't get called before type infererence is done.
1 parent e1e0989 commit c22dfab

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+2
-2
lines changed

compiler/rustc_trait_selection/src/traits/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -765,8 +765,8 @@ pub fn vtable_trait_upcasting_coercion_new_vptr_slot(
765765
),
766766
) -> Option<usize> {
767767
let (source, target) = key;
768-
debug_assert!(matches!(&source.kind(), &ty::Dynamic(..)));
769-
debug_assert!(matches!(&target.kind(), &ty::Dynamic(..)));
768+
assert!(matches!(&source.kind(), &ty::Dynamic(..)) && !source.needs_infer());
769+
assert!(matches!(&target.kind(), &ty::Dynamic(..)) && !target.needs_infer());
770770

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

0 commit comments

Comments
 (0)