| 1 |
// SPDX-License-Identifier: Apache-2.0 OR MIT |
| 2 |
|
| 3 |
#![allow(incomplete_features)] |
| 4 |
#![feature(specialization)] |
| 5 |
|
| 6 |
// See also run-pass/min_specialization.rs. |
| 7 |
|
| 8 |
pub mod default_impl { |
| 9 |
// I don't feel `default impl` is the good feature to combine with ext trait, but test anyway. |
| 10 |
// TODO: `default impl` became syntactically invalid in https://github.com/rust-lang/rust/pull/144386#issuecomment-3133213586 |
| 11 |
|
| 12 |
// https://github.com/rust-lang/rust/blob/1.84.0/tests/ui/specialization/defaultimpl/auxiliary/go_trait.rs |
| 13 |
pub mod go_trait { |
| 14 |
// use easy_ext::ext; |
| 15 |
|
| 16 |
// pub trait Go { |
| 17 |
// fn go(&self, arg: isize); |
| 18 |
// } |
| 19 |
|
| 20 |
// pub fn go<G: Go>(this: &G, arg: isize) { |
| 21 |
// this.go(arg) |
| 22 |
// } |
| 23 |
|
| 24 |
// pub fn go_mut<G: GoMut>(this: &mut G, arg: isize) { |
| 25 |
// this.go_mut(arg) |
| 26 |
// } |
| 27 |
|
| 28 |
// pub fn go_once<G: GoOnce>(this: G, arg: isize) { |
| 29 |
// this.go_once(arg) |
| 30 |
// } |
| 31 |
|
| 32 |
// #[ext(GoMut)] |
| 33 |
// pub default impl<G> G |
| 34 |
// where |
| 35 |
// G: Go, |
| 36 |
// { |
| 37 |
// fn go_mut(&mut self, arg: isize) { |
| 38 |
// go(&*self, arg) |
| 39 |
// } |
| 40 |
// } |
| 41 |
|
| 42 |
// #[ext(GoOnce)] |
| 43 |
// pub default impl<G> G |
| 44 |
// where |
| 45 |
// G: GoMut, |
| 46 |
// { |
| 47 |
// fn go_once(mut self, arg: isize) { |
| 48 |
// go_mut(&mut self, arg) |
| 49 |
// } |
| 50 |
// } |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
fn main() {} |