rust/tests/ui/traits/deny-builtin-object-impl.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
571 B
Rust
Raw Normal View History

2023-06-16 18:45:01 -05:00
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
2023-12-14 06:11:28 -06:00
//@[next] compile-flags: -Znext-solver
2023-06-16 18:45:01 -05:00
#![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
}