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