summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/deny-builtin-object-impl.rs
blob: dce03a43b682a0596c2eb416d0c872546b9fc9a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next

#![feature(rustc_attrs)]

#[rustc_deny_explicit_impl(implement_via_object = true)]
trait YesObject {}

#[rustc_deny_explicit_impl(implement_via_object = false)]
trait NotObject {}

fn test_yes_object<T: YesObject + ?Sized>() {}

fn test_not_object<T: NotObject + ?Sized>() {}

fn main() {
    test_yes_object::<dyn YesObject>();
    test_not_object::<dyn NotObject>();
    //~^ ERROR the trait bound `dyn NotObject: NotObject` is not satisfied
}