diff options
| author | varkor <github@varkor.com> | 2019-07-30 00:11:58 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-08-02 02:44:35 +0100 |
| commit | fc48541ab19cdd68a2b0228004e64d3cbb7a1ecb (patch) | |
| tree | ff9235de7c50ac6795502f5079d1523cde9161cf /src/test/ui/impl-trait | |
| parent | 87738fe83401ee2a7d2556df8db0df4dec7cd58d (diff) | |
| download | rust-fc48541ab19cdd68a2b0228004e64d3cbb7a1ecb.tar.gz rust-fc48541ab19cdd68a2b0228004e64d3cbb7a1ecb.zip | |
Update syntax in existing tests
Diffstat (limited to 'src/test/ui/impl-trait')
18 files changed, 85 insertions, 65 deletions
diff --git a/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs b/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs index 130de9ccf62..6c7c46b0e3d 100644 --- a/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs +++ b/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs @@ -1,4 +1,4 @@ -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] // build-pass (FIXME(62277): could be check-pass?) trait Bar {} @@ -11,7 +11,7 @@ trait Foo<T> { } impl<W> Foo<W> for i32 { - existential type Assoc: Bar; + type Assoc = impl Bar; fn foo(w: W) -> Self::Assoc { Dummy(w) } @@ -21,7 +21,7 @@ struct NonGeneric; impl Bar for NonGeneric {} impl<W> Foo<W> for u32 { - existential type Assoc: Bar; + type Assoc = impl Bar; fn foo(_: W) -> Self::Assoc { NonGeneric } diff --git a/src/test/ui/impl-trait/associated-existential-type-trivial.rs b/src/test/ui/impl-trait/associated-existential-type-trivial.rs index 0e83b4084b6..cdda341cad8 100644 --- a/src/test/ui/impl-trait/associated-existential-type-trivial.rs +++ b/src/test/ui/impl-trait/associated-existential-type-trivial.rs @@ -1,4 +1,4 @@ -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] // build-pass (FIXME(62277): could be check-pass?) trait Bar {} @@ -11,7 +11,7 @@ trait Foo { } impl Foo for i32 { - existential type Assoc: Bar; + type Assoc = impl Bar; fn foo() -> Self::Assoc { Dummy } diff --git a/src/test/ui/impl-trait/associated-existential-type.rs b/src/test/ui/impl-trait/associated-existential-type.rs index 58966aefe1c..d0661d66f4b 100644 --- a/src/test/ui/impl-trait/associated-existential-type.rs +++ b/src/test/ui/impl-trait/associated-existential-type.rs @@ -1,4 +1,4 @@ -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] // build-pass (FIXME(62277): could be check-pass?) trait Bar {} @@ -12,7 +12,7 @@ trait Foo { } impl Foo for i32 { - existential type Assoc: Bar; + type Assoc = impl Bar; fn foo() -> Self::Assoc { Dummy } diff --git a/src/test/ui/impl-trait/bound-normalization-fail.rs b/src/test/ui/impl-trait/bound-normalization-fail.rs index 476ae62fa0f..c33261bfd09 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.rs +++ b/src/test/ui/impl-trait/bound-normalization-fail.rs @@ -2,7 +2,6 @@ // edition:2018 #![feature(async_await)] -#![feature(existential_type)] #![feature(impl_trait_in_bindings)] //~^ WARNING the feature `impl_trait_in_bindings` is incomplete diff --git a/src/test/ui/impl-trait/bound-normalization-fail.stderr b/src/test/ui/impl-trait/bound-normalization-fail.stderr index 24a687491e5..aa306a7e08a 100644 --- a/src/test/ui/impl-trait/bound-normalization-fail.stderr +++ b/src/test/ui/impl-trait/bound-normalization-fail.stderr @@ -1,5 +1,5 @@ warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash - --> $DIR/bound-normalization-fail.rs:6:12 + --> $DIR/bound-normalization-fail.rs:5:12 | LL | #![feature(impl_trait_in_bindings)] | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #![feature(impl_trait_in_bindings)] = note: `#[warn(incomplete_features)]` on by default error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as impl_trait::Trait>::Assoc` - --> $DIR/bound-normalization-fail.rs:30:32 + --> $DIR/bound-normalization-fail.rs:29:32 | LL | fn foo_fail<T: Trait>() -> impl FooLike<Output=T::Assoc> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found associated type @@ -17,7 +17,7 @@ LL | fn foo_fail<T: Trait>() -> impl FooLike<Output=T::Assoc> { = note: the return type of a function must have a statically known size error[E0271]: type mismatch resolving `<Foo<()> as FooLike>::Output == <T as lifetimes::Trait<'static>>::Assoc` - --> $DIR/bound-normalization-fail.rs:47:41 + --> $DIR/bound-normalization-fail.rs:46:41 | LL | fn foo2_fail<'a, T: Trait<'a>>() -> impl FooLike<Output=T::Assoc> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found associated type diff --git a/src/test/ui/impl-trait/bound-normalization-pass.rs b/src/test/ui/impl-trait/bound-normalization-pass.rs index 3fdd7c0ecb6..33348340bce 100644 --- a/src/test/ui/impl-trait/bound-normalization-pass.rs +++ b/src/test/ui/impl-trait/bound-normalization-pass.rs @@ -2,7 +2,7 @@ // edition:2018 #![feature(async_await)] -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] #![feature(impl_trait_in_bindings)] //~^ WARNING the feature `impl_trait_in_bindings` is incomplete @@ -99,7 +99,7 @@ mod existential_types { type Out = u8; } - existential type Ex: Trait<Out = <() as Implemented>::Assoc>; + type Ex = impl Trait<Out = <() as Implemented>::Assoc>; fn define() -> Ex { () diff --git a/src/test/ui/impl-trait/existential_type_in_fn_body.rs b/src/test/ui/impl-trait/existential_type_in_fn_body.rs index 32fc4a97ef4..91be4efd56a 100644 --- a/src/test/ui/impl-trait/existential_type_in_fn_body.rs +++ b/src/test/ui/impl-trait/existential_type_in_fn_body.rs @@ -1,11 +1,11 @@ // build-pass (FIXME(62277): could be check-pass?) -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] use std::fmt::Debug; fn main() { - existential type Existential: Debug; + type Existential = impl Debug; fn f() -> Existential {} println!("{:?}", f()); diff --git a/src/test/ui/impl-trait/issue-55872-1.rs b/src/test/ui/impl-trait/issue-55872-1.rs index 5095b26f8a4..c127e4cef49 100644 --- a/src/test/ui/impl-trait/issue-55872-1.rs +++ b/src/test/ui/impl-trait/issue-55872-1.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] pub trait Bar { @@ -9,7 +9,7 @@ pub trait Bar } impl<S: Default> Bar for S { - existential type E: Copy; + type E = impl Copy; //~^ ERROR the trait bound `S: std::marker::Copy` is not satisfied in `(S, T)` [E0277] //~^^ ERROR the trait bound `T: std::marker::Copy` is not satisfied in `(S, T)` [E0277] diff --git a/src/test/ui/impl-trait/issue-55872-1.stderr b/src/test/ui/impl-trait/issue-55872-1.stderr index 04b4d2d4a50..8a429626a5b 100644 --- a/src/test/ui/impl-trait/issue-55872-1.stderr +++ b/src/test/ui/impl-trait/issue-55872-1.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `S: std::marker::Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:12:5 | -LL | existential type E: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `S` +LL | type E = impl Copy; + | ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `S` | = help: consider adding a `where S: std::marker::Copy` bound = note: required because it appears within the type `(S, T)` @@ -11,8 +11,8 @@ LL | existential type E: Copy; error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied in `(S, T)` --> $DIR/issue-55872-1.rs:12:5 | -LL | existential type E: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `T` +LL | type E = impl Copy; + | ^^^^^^^^^^^^^^^^^^^ within `(S, T)`, the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound = note: required because it appears within the type `(S, T)` diff --git a/src/test/ui/impl-trait/issue-55872-2.rs b/src/test/ui/impl-trait/issue-55872-2.rs index 2bdeb14bdc3..d7432bda839 100644 --- a/src/test/ui/impl-trait/issue-55872-2.rs +++ b/src/test/ui/impl-trait/issue-55872-2.rs @@ -1,6 +1,6 @@ // edition:2018 // ignore-tidy-linelength -#![feature(async_await, existential_type)] +#![feature(async_await, type_alias_impl_trait)] pub trait Bar { type E: Copy; @@ -9,7 +9,7 @@ pub trait Bar { } impl<S> Bar for S { - existential type E: Copy; + type E = impl Copy; //~^ ERROR the trait bound `impl std::future::Future: std::marker::Copy` is not satisfied [E0277] fn foo<T>() -> Self::E { //~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for existential type diff --git a/src/test/ui/impl-trait/issue-55872-2.stderr b/src/test/ui/impl-trait/issue-55872-2.stderr index 2505a82ee23..c9cc178d3f8 100644 --- a/src/test/ui/impl-trait/issue-55872-2.stderr +++ b/src/test/ui/impl-trait/issue-55872-2.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `impl std::future::Future: std::marker::Copy` is not satisfied --> $DIR/issue-55872-2.rs:12:5 | -LL | existential type E: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `impl std::future::Future` +LL | type E = impl Copy; + | ^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `impl std::future::Future` | = note: the return type of a function must have a statically known size diff --git a/src/test/ui/impl-trait/issue-55872.rs b/src/test/ui/impl-trait/issue-55872.rs index 95604545c37..bf2c5c82208 100644 --- a/src/test/ui/impl-trait/issue-55872.rs +++ b/src/test/ui/impl-trait/issue-55872.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] pub trait Bar { type E: Copy; @@ -8,7 +8,7 @@ pub trait Bar { } impl<S> Bar for S { - existential type E: Copy; + type E = impl Copy; fn foo<T>() -> Self::E { //~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for existential type diff --git a/src/test/ui/impl-trait/issues/issue-53457.rs b/src/test/ui/impl-trait/issues/issue-53457.rs index 3f6a4fb2787..de8c579743f 100644 --- a/src/test/ui/impl-trait/issues/issue-53457.rs +++ b/src/test/ui/impl-trait/issues/issue-53457.rs @@ -1,8 +1,8 @@ // run-pass -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] -existential type X: Clone; +type X = impl Clone; fn bar<F: Fn(&i32) + Clone>(f: F) -> F { f diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs index 61e858ee02d..b226cf058aa 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs @@ -1,14 +1,14 @@ // compile-flags:-Zborrowck=mir #![feature(member_constraints)] -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] #[derive(Clone)] struct CopyIfEq<T, U>(T, U); impl<T: Copy> Copy for CopyIfEq<T, T> {} -existential type E<'a, 'b>: Sized; +type E<'a, 'b> = impl Sized; fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { //~^ ERROR lifetime may not live long enough diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr index b59dfbe9f2a..f27e6ff44a6 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { | -- lifetime `'a` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'static` help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a constraint | -LL | existential type E<'a, 'b>: Sized; + 'a +LL | type E<'a, 'b> = impl Sized; + 'a | error: aborting due to previous error diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs index 43915e05e88..ae44b371f4f 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs @@ -4,7 +4,7 @@ //[mir]compile-flags: -Z borrowck=mir #![feature(member_constraints)] -#![feature(existential_type)] +#![feature(type_alias_impl_trait)] trait Trait<'a, 'b> { } impl<T> Trait<'_, '_> for T { } @@ -12,7 +12,7 @@ impl<T> Trait<'_, '_> for T { } // Here we wind up selecting `'a` and `'b` in the hidden type because // those are the types that appear in the original values. -existential type Foo<'a, 'b>: Trait<'a, 'b>; +type Foo<'a, 'b> = impl Trait<'a, 'b>; fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> Foo<'a, 'b> { // In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like diff --git a/src/test/ui/impl-trait/where-allowed.rs b/src/test/ui/impl-trait/where-allowed.rs index 31bc9f449a0..5b6105421fe 100644 --- a/src/test/ui/impl-trait/where-allowed.rs +++ b/src/test/ui/impl-trait/where-allowed.rs @@ -120,7 +120,8 @@ trait DummyTrait { } impl DummyTrait for () { type Out = impl Debug; - //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types + //~^ ERROR existential types are unstable + //~^^ ERROR could not find defining uses fn in_trait_impl_parameter(_: impl Debug) { } // Allowed @@ -155,7 +156,8 @@ extern "C" fn in_extern_fn_return() -> impl Debug { } type InTypeAlias<R> = impl Debug; -//~^ ERROR `impl Trait` not allowed outside of function and inherent method return types +//~^ ERROR existential types are unstable +//~^^ ERROR could not find defining uses type InReturnInTypeAlias<R> = fn() -> impl Debug; //~^ ERROR `impl Trait` not allowed outside of function and inherent method return types diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index 9895b028a4e..08f456199e9 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -16,6 +16,24 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic | | nested `impl Trait` here | outer `impl Trait` +error[E0658]: existential types are unstable + --> $DIR/where-allowed.rs:122:5 + | +LL | type Out = impl Debug; + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/63063 + = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable + +error[E0658]: existential types are unstable + --> $DIR/where-allowed.rs:158:1 + | +LL | type InTypeAlias<R> = impl Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: for more information, see https://github.com/rust-lang/rust/issues/63063 + = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable + error[E0562]: `impl Trait` not allowed outside of function and inherent method return types --> $DIR/where-allowed.rs:18:40 | @@ -137,97 +155,85 @@ LL | fn in_return() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:122:16 - | -LL | type Out = impl Debug; - | ^^^^^^^^^^ - -error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:128:34 + --> $DIR/where-allowed.rs:129:34 | LL | fn in_trait_impl_return() -> impl Debug { () } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:141:33 + --> $DIR/where-allowed.rs:142:33 | LL | fn in_foreign_parameters(_: impl Debug); | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:144:31 + --> $DIR/where-allowed.rs:145:31 | LL | fn in_foreign_return() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:157:23 - | -LL | type InTypeAlias<R> = impl Debug; - | ^^^^^^^^^^ - -error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:160:39 + --> $DIR/where-allowed.rs:162:39 | LL | type InReturnInTypeAlias<R> = fn() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:164:16 + --> $DIR/where-allowed.rs:166:16 | LL | impl PartialEq<impl Debug> for () { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:169:24 + --> $DIR/where-allowed.rs:171:24 | LL | impl PartialEq<()> for impl Debug { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:174:6 + --> $DIR/where-allowed.rs:176:6 | LL | impl impl Debug { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:180:24 + --> $DIR/where-allowed.rs:182:24 | LL | impl InInherentImplAdt<impl Debug> { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:186:11 + --> $DIR/where-allowed.rs:188:11 | LL | where impl Debug: Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:193:15 + --> $DIR/where-allowed.rs:195:15 | LL | where Vec<impl Debug>: Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:200:24 + --> $DIR/where-allowed.rs:202:24 | LL | where T: PartialEq<impl Debug> | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:207:17 + --> $DIR/where-allowed.rs:209:17 | LL | where T: Fn(impl Debug) | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:214:22 + --> $DIR/where-allowed.rs:216:22 | LL | where T: Fn() -> impl Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:220:29 + --> $DIR/where-allowed.rs:222:29 | LL | let _in_local_variable: impl Fn() = || {}; | ^^^^^^^^^ @@ -235,11 +241,24 @@ LL | let _in_local_variable: impl Fn() = || {}; = help: add `#![feature(impl_trait_in_bindings)]` to the crate attributes to enable error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:222:46 + --> $DIR/where-allowed.rs:224:46 | LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; | ^^^^^^^^^ -error: aborting due to 39 previous errors +error: could not find defining uses + --> $DIR/where-allowed.rs:158:1 + | +LL | type InTypeAlias<R> = impl Debug; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: could not find defining uses + --> $DIR/where-allowed.rs:122:5 + | +LL | type Out = impl Debug; + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 41 previous errors -For more information about this error, try `rustc --explain E0562`. +Some errors have detailed explanations: E0562, E0658. +For more information about an error, try `rustc --explain E0562`. |
