split up #[rustc_deny_explicit_impl] attribute
This commit splits the `#[rustc_deny_explicit_impl(implement_via_object = ...)]` attribute into two attributes `#[rustc_deny_explicit_impl]` and `#[rustc_do_not_implement_via_object]`. This allows us to have special traits that can have user-defined impls but do not have the automatic trait impl for trait objects (`impl Trait for dyn Trait`).
This commit is contained in:
@@ -206,7 +206,9 @@ fn check_object_overlap<'tcx>(
|
||||
// so this is valid.
|
||||
} else {
|
||||
let mut supertrait_def_ids = tcx.supertrait_def_ids(component_def_id);
|
||||
if supertrait_def_ids.any(|d| d == trait_def_id) {
|
||||
if supertrait_def_ids
|
||||
.any(|d| d == trait_def_id && tcx.trait_def(d).implement_via_object)
|
||||
{
|
||||
let span = tcx.def_span(impl_def_id);
|
||||
return Err(struct_span_code_err!(
|
||||
tcx.dcx(),
|
||||
|
||||
Reference in New Issue
Block a user