From ebc4408fc02c5847012a01e30f5ffcf4bc6bfea3 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 13 Nov 2017 14:05:31 -0500 Subject: rename many-cases to where-allowed --- src/test/compile-fail/impl-trait/many-cases.rs | 71 ----------------------- src/test/compile-fail/impl-trait/where-allowed.rs | 71 +++++++++++++++++++++++ 2 files changed, 71 insertions(+), 71 deletions(-) delete mode 100644 src/test/compile-fail/impl-trait/many-cases.rs create mode 100644 src/test/compile-fail/impl-trait/where-allowed.rs (limited to 'src') diff --git a/src/test/compile-fail/impl-trait/many-cases.rs b/src/test/compile-fail/impl-trait/many-cases.rs deleted file mode 100644 index 5c2a8f89bf2..00000000000 --- a/src/test/compile-fail/impl-trait/many-cases.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2017 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! A simple test for testing many permutations of allowedness of -//! impl Trait -#![feature(conservative_impl_trait, universal_impl_trait, dyn_trait)] -use std::fmt::Debug; - -// Allowed -fn simple_universal(_: impl Debug) { panic!() } - -// Allowed -fn simple_existential() -> impl Debug { panic!() } - -// Allowed -fn collection_universal(_: Vec) { panic!() } - -// Allowed -fn collection_existential() -> Vec { panic!() } - -// Disallowed -fn fn_type_universal(_: fn(impl Debug)) { panic!() } -//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types - -// Disallowed -fn fn_type_existential() -> fn(impl Debug) { panic!() } -//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types - -// Allowed -fn dyn_universal(_: &dyn Iterator) { panic!() } - -// Disallowed -fn dyn_fn_trait(_: &dyn Fn(impl Debug)) { panic!() } -//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types - -// Allowed -fn nested_universal(_: impl Iterator) { panic!() } - -// Allowed -fn nested_existential() -> impl IntoIterator { - vec![vec![0; 10], vec![12; 7], vec![8; 3]] -} - -// Disallowed -fn universal_fn_trait(_: impl Fn(impl Debug)) { panic!() } -//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types - -// Disallowed -struct ImplMember { x: impl Debug } -//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types - -// Disallowed -trait Universal { - // FIXME, should error? - fn universal(impl Debug); -} - -// Disallowed -trait Existential { - fn existential() -> impl Debug; - //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types -} - -fn main() {} diff --git a/src/test/compile-fail/impl-trait/where-allowed.rs b/src/test/compile-fail/impl-trait/where-allowed.rs new file mode 100644 index 00000000000..5c2a8f89bf2 --- /dev/null +++ b/src/test/compile-fail/impl-trait/where-allowed.rs @@ -0,0 +1,71 @@ +// Copyright 2017 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! A simple test for testing many permutations of allowedness of +//! impl Trait +#![feature(conservative_impl_trait, universal_impl_trait, dyn_trait)] +use std::fmt::Debug; + +// Allowed +fn simple_universal(_: impl Debug) { panic!() } + +// Allowed +fn simple_existential() -> impl Debug { panic!() } + +// Allowed +fn collection_universal(_: Vec) { panic!() } + +// Allowed +fn collection_existential() -> Vec { panic!() } + +// Disallowed +fn fn_type_universal(_: fn(impl Debug)) { panic!() } +//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + +// Disallowed +fn fn_type_existential() -> fn(impl Debug) { panic!() } +//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + +// Allowed +fn dyn_universal(_: &dyn Iterator) { panic!() } + +// Disallowed +fn dyn_fn_trait(_: &dyn Fn(impl Debug)) { panic!() } +//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + +// Allowed +fn nested_universal(_: impl Iterator) { panic!() } + +// Allowed +fn nested_existential() -> impl IntoIterator { + vec![vec![0; 10], vec![12; 7], vec![8; 3]] +} + +// Disallowed +fn universal_fn_trait(_: impl Fn(impl Debug)) { panic!() } +//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + +// Disallowed +struct ImplMember { x: impl Debug } +//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + +// Disallowed +trait Universal { + // FIXME, should error? + fn universal(impl Debug); +} + +// Disallowed +trait Existential { + fn existential() -> impl Debug; + //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types +} + +fn main() {} -- cgit 1.4.1-3-g733a5