From cf2dff2b1e3fa55fa5415d524200070d0d7aacfe Mon Sep 17 00:00:00 2001 From: Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> Date: Thu, 5 Jan 2023 09:13:28 +0100 Subject: Move /src/test to /tests --- .../specialization-trait-item-not-implemented.rs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs (limited to 'tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs') diff --git a/tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs new file mode 100644 index 00000000000..3c5414469fa --- /dev/null +++ b/tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs @@ -0,0 +1,23 @@ +// Tests that default impls do not have to supply all items but regular impls do. + +#![feature(specialization)] //~ WARN the feature `specialization` is incomplete + +trait Foo { + fn foo_one(&self) -> &'static str; + fn foo_two(&self) -> &'static str; +} + +struct MyStruct; + +default impl Foo for T { + fn foo_one(&self) -> &'static str { + "generic" + } +} + +impl Foo for MyStruct {} +//~^ ERROR not all trait items implemented, missing: `foo_two` [E0046] + +fn main() { + println!("{}", MyStruct.foo_one()); +} -- cgit 1.4.1-3-g733a5