diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-09-06 14:36:26 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-09-06 14:36:26 +0200 |
| commit | 76ceeddb2b6fd4589cf8292d8dafa65a91ace019 (patch) | |
| tree | 11106836a5a37fc73a209a905786431ea0f10117 /src/test/run-pass/specialization/defaultimpl | |
| parent | 20ca02569ae3e1dc29962e92739fbab632abf241 (diff) | |
| download | rust-76ceeddb2b6fd4589cf8292d8dafa65a91ace019.tar.gz rust-76ceeddb2b6fd4589cf8292d8dafa65a91ace019.zip | |
Migrated remaining `src/test/run-pass/` subdirectories to `src/test/ui/run-pass/`.
Diffstat (limited to 'src/test/run-pass/specialization/defaultimpl')
6 files changed, 0 insertions, 235 deletions
diff --git a/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs deleted file mode 100644 index 6b999f38358..00000000000 --- a/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:go_trait.rs - -#![feature(specialization)] - -extern crate go_trait; - -use go_trait::{Go,GoMut}; -use std::fmt::Debug; -use std::default::Default; - -struct MyThingy; - -impl Go for MyThingy { - fn go(&self, arg: isize) { } -} - -impl GoMut for MyThingy { - fn go_mut(&mut self, arg: isize) { } -} - -fn main() { } diff --git a/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs b/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs deleted file mode 100644 index dd060f8ef40..00000000000 --- a/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(specialization)] - -// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. - -pub trait Go { - fn go(&self, arg: isize); -} - -pub fn go<G:Go>(this: &G, arg: isize) { - this.go(arg) -} - -pub trait GoMut { - fn go_mut(&mut self, arg: isize); -} - -pub fn go_mut<G:GoMut>(this: &mut G, arg: isize) { - this.go_mut(arg) -} - -pub trait GoOnce { - fn go_once(self, arg: isize); -} - -pub fn go_once<G:GoOnce>(this: G, arg: isize) { - this.go_once(arg) -} - -default impl<G> GoMut for G - where G : Go -{ - fn go_mut(&mut self, arg: isize) { - go(&*self, arg) - } -} - -default impl<G> GoOnce for G - where G : GoMut -{ - fn go_once(mut self, arg: isize) { - go_mut(&mut self, arg) - } -} diff --git a/src/test/run-pass/specialization/defaultimpl/out-of-order.rs b/src/test/run-pass/specialization/defaultimpl/out-of-order.rs deleted file mode 100644 index f77b88e2f85..00000000000 --- a/src/test/run-pass/specialization/defaultimpl/out-of-order.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that you can list the more specific impl before the more general one. - -#![feature(specialization)] - -trait Foo { - type Out; -} - -impl Foo for bool { - type Out = (); -} - -default impl<T> Foo for T { - type Out = bool; -} - -fn main() {} diff --git a/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs b/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs deleted file mode 100644 index 500cded38c1..00000000000 --- a/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that impls on projected self types can resolve overlap, even when the -// projections involve specialization, so long as the associated type is -// provided by the most specialized impl. - -#![feature(specialization)] - -trait Assoc { - type Output; -} - -default impl<T> Assoc for T { - type Output = bool; -} - -impl Assoc for u8 { type Output = u8; } -impl Assoc for u16 { type Output = u16; } - -trait Foo {} -impl Foo for u32 {} -impl Foo for <u8 as Assoc>::Output {} -impl Foo for <u16 as Assoc>::Output {} - -fn main() {} diff --git a/src/test/run-pass/specialization/defaultimpl/projection.rs b/src/test/run-pass/specialization/defaultimpl/projection.rs deleted file mode 100644 index 6a833ba6760..00000000000 --- a/src/test/run-pass/specialization/defaultimpl/projection.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(specialization)] - -// Make sure we *can* project non-defaulted associated types -// cf compile-fail/specialization-default-projection.rs - -// First, do so without any use of specialization - -trait Foo { - type Assoc; -} - -impl<T> Foo for T { - type Assoc = (); -} - -fn generic_foo<T>() -> <T as Foo>::Assoc { - () -} - -// Next, allow for one layer of specialization - -trait Bar { - type Assoc; -} - -default impl<T> Bar for T { - type Assoc = (); -} - -impl<T: Clone> Bar for T { - type Assoc = u8; -} - -fn generic_bar_clone<T: Clone>() -> <T as Bar>::Assoc { - 0u8 -} - -fn main() { -} diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs deleted file mode 100644 index fc731202005..00000000000 --- a/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Tests that we can combine a default impl that supplies one method with a -// full impl that supplies the other, and they can invoke one another. - -#![feature(specialization)] - -trait Foo { - fn foo_one(&self) -> &'static str; - fn foo_two(&self) -> &'static str; - fn foo_three(&self) -> &'static str; -} - -struct MyStruct; - -default impl<T> Foo for T { - fn foo_one(&self) -> &'static str { - self.foo_three() - } -} - -impl Foo for MyStruct { - fn foo_two(&self) -> &'static str { - self.foo_one() - } - - fn foo_three(&self) -> &'static str { - "generic" - } -} - -fn main() { - assert!(MyStruct.foo_two() == "generic"); -} |
