We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8989165 commit aa9714bCopy full SHA for aa9714b
compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs
@@ -352,6 +352,17 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
352
b.projection_term = replace_dummy_self_with_error(tcx, b.projection_term, guar);
353
}
354
355
+ if let Some(term_ty) = &b.term.as_type() {
356
+ let references_self = term_ty.walk().any(|arg| arg == dummy_self.into());
357
+ if references_self {
358
+ let guar = tcx.dcx().span_delayed_bug(
359
+ span,
360
+ "trait object projection bounds reference `Self`",
361
+ );
362
+ b.term = replace_dummy_self_with_error(tcx, b.term, guar);
363
+ }
364
365
+
366
ty::ExistentialPredicate::Projection(ty::ExistentialProjection::erase_self_ty(
367
tcx, b,
368
))
0 commit comments