We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6666435 + 2f1b15f commit 383bb66Copy full SHA for 383bb66
src/unsize.rs
@@ -34,7 +34,9 @@ pub(crate) fn unsized_info<'tcx>(
34
{
35
let old_info =
36
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
37
- if data_a.principal_def_id() == data_b.principal_def_id() {
+ let b_principal_def_id = data_b.principal_def_id();
38
+ if data_a.principal_def_id() == b_principal_def_id || b_principal_def_id.is_none() {
39
+ // A NOP cast that doesn't actually change anything, should be allowed even with invalid vtables.
40
debug_assert!(
41
validate_trivial_unsize(fx.tcx, data_a, data_b),
42
"NOP unsize vtable changed principal trait ref: {data_a} -> {data_b}"
0 commit comments