]> git.proxmox.com Git - rustc.git/blame - src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / specialization / defaultimpl / specialization-trait-item-not-implemented.rs
CommitLineData
0531ce1d 1// Tests that default impls do not have to supply all items but regular impls do.
7cac9316 2
f035d41b 3#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
7cac9316
XL
4
5trait Foo {
0531ce1d
XL
6 fn foo_one(&self) -> &'static str;
7 fn foo_two(&self) -> &'static str;
b039eaaf 8}
85aaf69f 9
0531ce1d 10struct MyStruct;
b039eaaf 11
0531ce1d
XL
12default impl<T> Foo for T {
13 fn foo_one(&self) -> &'static str {
14 "generic"
7cac9316 15 }
b039eaaf 16}
223e47cc 17
0531ce1d
XL
18impl Foo for MyStruct {}
19//~^ ERROR not all trait items implemented, missing: `foo_two` [E0046]
7cac9316 20
0531ce1d
XL
21fn main() {
22 println!("{}", MyStruct.foo_one());
c34b1796 23}