Update syntax in existing tests

This commit is contained in:
varkor 2019-07-30 00:11:58 +01:00
parent 87738fe834
commit fc48541ab1
100 changed files with 343 additions and 328 deletions

View File

@ -3,7 +3,7 @@
// error-pattern:could not find defining uses
#![feature(associated_type_bounds)]
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
#![feature(untagged_unions)]
@ -107,17 +107,17 @@ type TAW2<T> where T: Iterator<Item: Copy, Item: Copy> = T;
type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
//~^ the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified [E0719]
existential type ETAI1<T: Iterator<Item: Copy, Item: Send>>: Copy;
type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
//~^ the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified [E0719]
existential type ETAI2<T: Iterator<Item: Copy, Item: Copy>>: Copy;
type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
//~^ the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified [E0719]
existential type ETAI3<T: Iterator<Item: 'static, Item: 'static>>: Copy;
type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
//~^ the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified [E0719]
existential type ETAI4: Iterator<Item: Copy, Item: Send>;
type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
//~^ the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified [E0719]
existential type ETAI5: Iterator<Item: Copy, Item: Copy>;
type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
//~^ the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified [E0719]
existential type ETAI6: Iterator<Item: 'static, Item: 'static>;
type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
//~^ the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified [E0719]
trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}

View File

@ -369,86 +369,86 @@ LL | type TAW3<T> where T: Iterator<Item: 'static, Item: 'static> = T;
error: could not find defining uses
--> $DIR/duplicate.rs:110:1
|
LL | existential type ETAI1<T: Iterator<Item: Copy, Item: Send>>: Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:110:48
--> $DIR/duplicate.rs:110:36
|
LL | existential type ETAI1<T: Iterator<Item: Copy, Item: Send>>: Copy;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
LL | type ETAI1<T: Iterator<Item: Copy, Item: Send>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:112:1
|
LL | existential type ETAI2<T: Iterator<Item: Copy, Item: Copy>>: Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:112:48
--> $DIR/duplicate.rs:112:36
|
LL | existential type ETAI2<T: Iterator<Item: Copy, Item: Copy>>: Copy;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
LL | type ETAI2<T: Iterator<Item: Copy, Item: Copy>> = impl Copy;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:114:1
|
LL | existential type ETAI3<T: Iterator<Item: 'static, Item: 'static>>: Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:114:51
--> $DIR/duplicate.rs:114:39
|
LL | existential type ETAI3<T: Iterator<Item: 'static, Item: 'static>>: Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
LL | type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:116:1
|
LL | existential type ETAI4: Iterator<Item: Copy, Item: Send>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:116:46
--> $DIR/duplicate.rs:116:40
|
LL | existential type ETAI4: Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
LL | type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:118:1
|
LL | existential type ETAI5: Iterator<Item: Copy, Item: Copy>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:118:46
--> $DIR/duplicate.rs:118:40
|
LL | existential type ETAI5: Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
LL | type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
| ---------- ^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error: could not find defining uses
--> $DIR/duplicate.rs:120:1
|
LL | existential type ETAI6: Iterator<Item: 'static, Item: 'static>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:120:49
--> $DIR/duplicate.rs:120:43
|
LL | existential type ETAI6: Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
LL | type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
| ------------- ^^^^^^^^^^^^^ re-bound here
| |
| `Item` bound here first
error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified
--> $DIR/duplicate.rs:123:36

View File

@ -1,7 +1,6 @@
// run-pass
#![feature(associated_type_bounds)]
#![feature(existential_type)]
use std::ops::Add;

View File

@ -1,7 +1,7 @@
// run-pass
#![feature(associated_type_bounds)]
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::ops::Add;
@ -17,15 +17,15 @@ struct S1;
struct S2;
impl Tr1 for S1 { type As1 = S2; fn mk(self) -> Self::As1 { S2 } }
existential type Et1: Tr1<As1: Copy>;
type Et1 = impl Tr1<As1: Copy>;
fn def_et1() -> Et1 { S1 }
pub fn use_et1() { assert_copy(def_et1().mk()); }
existential type Et2: Tr1<As1: 'static>;
type Et2 = impl Tr1<As1: 'static>;
fn def_et2() -> Et2 { S1 }
pub fn use_et2() { assert_static(def_et2().mk()); }
existential type Et3: Tr1<As1: Clone + Iterator<Item: Add<u8, Output: Into<u8>>>>;
type Et3 = impl Tr1<As1: Clone + Iterator<Item: Add<u8, Output: Into<u8>>>>;
fn def_et3() -> Et3 {
struct A;
impl Tr1 for A {
@ -44,7 +44,7 @@ pub fn use_et3() {
assert_eq!(s, (0..10).map(|x| x + 1).sum());
}
existential type Et4: Tr1<As1: for<'a> Tr2<'a>>;
type Et4 = impl Tr1<As1: for<'a> Tr2<'a>>;
fn def_et4() -> Et4 {
#[derive(Copy, Clone)]
struct A;

View File

@ -3,11 +3,12 @@
// build-pass (FIXME(62277): could be check-pass?)
// edition:2018
#![feature(async_await, existential_type)]
#![feature(async_await)]
#![feature(type_alias_impl_trait)]
use std::future::Future;
pub existential type Func: Sized;
pub type Func = impl Sized;
// Late bound region should be allowed to escape the function, since it's bound
// in the type.
@ -17,7 +18,7 @@ fn null_function_ptr() -> Func {
async fn async_nop(_: &u8) {}
pub existential type ServeFut: Future<Output=()>;
pub type ServeFut = impl Future<Output=()>;
// Late bound regions occur in the generator witness type here.
fn serve() -> ServeFut {

View File

@ -2,9 +2,9 @@
#![crate_type="rlib"]
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
pub existential type Foo: std::fmt::Debug;
pub type Foo = impl std::fmt::Debug;
pub fn foo() -> Foo {
5

View File

@ -2,7 +2,7 @@
#![crate_type="rlib"]
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
pub trait View {
type Tmp: Iterator<Item = u32>;
@ -13,7 +13,7 @@ pub trait View {
pub struct X;
impl View for X {
existential type Tmp: Iterator<Item = u32>;
type Tmp = impl Iterator<Item = u32>;
fn test(&self) -> Self::Tmp {
vec![1,2,3].into_iter()

View File

@ -2,12 +2,12 @@
#![allow(warnings)]
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {
}
existential type Foo<V>: std::fmt::Debug;
type Foo<V> = impl std::fmt::Debug;
trait Trait<U> {}

View File

@ -1,4 +1,4 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {
}
@ -7,7 +7,7 @@ trait TraitWithAssoc {
type Assoc;
}
existential type Foo<V>: Trait<V>;
type Foo<V> = impl Trait<V>;
//~^ ERROR could not find defining uses
trait Trait<U> {}

View File

@ -9,8 +9,8 @@ LL | | }
error: could not find defining uses
--> $DIR/bound_reduction2.rs:10:1
|
LL | existential type Foo<V>: Trait<V>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Foo<V> = impl Trait<V>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -1,6 +1,6 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
// declared but never defined
existential type Bar: std::fmt::Debug; //~ ERROR could not find defining uses
type Bar = impl std::fmt::Debug; //~ ERROR could not find defining uses

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/declared_but_never_defined.rs:6:1
|
LL | existential type Bar: std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Bar = impl std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,10 +1,10 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
mod boo {
// declared in module but not defined inside of it
pub existential type Boo: ::std::fmt::Debug; //~ ERROR could not find defining uses
pub type Boo = impl ::std::fmt::Debug; //~ ERROR could not find defining uses
}
fn bomp() -> boo::Boo {

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/declared_but_not_defined_in_scope.rs:7:5
|
LL | pub existential type Boo: ::std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | pub type Boo = impl ::std::fmt::Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,9 +1,9 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
// two definitions with different types
existential type Foo: std::fmt::Debug;
type Foo = impl std::fmt::Debug;
fn foo() -> Foo {
""

View File

@ -1,9 +1,9 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
// two definitions with different types
existential type Foo: std::fmt::Debug;
type Foo = impl std::fmt::Debug;
fn foo() -> Foo {
""

View File

@ -1,11 +1,11 @@
// build-pass (FIXME(62277): could be check-pass?)
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
// two definitions with different types
existential type Foo: std::fmt::Debug;
type Foo = impl std::fmt::Debug;
fn foo() -> Foo {
""

View File

@ -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 {
fn bar() -> Self::Assoc;
}
existential type Helper: Bar;
type Helper = impl Bar;
impl Foo for i32 {
type Assoc = Helper;

View File

@ -1,6 +1,6 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
existential type Foo: Fn() -> Foo;
type Foo = impl Fn() -> Foo;
//~^ ERROR: could not find defining uses
fn crash(x: Foo) -> Foo {

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/existential-types-with-cycle-error.rs:3:1
|
LL | existential type Foo: Fn() -> Foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Foo = impl Fn() -> Foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,10 +1,10 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
pub trait Bar<T> {
type Item;
}
existential type Foo: Bar<Foo, Item = Foo>;
type Foo = impl Bar<Foo, Item = Foo>;
//~^ ERROR: could not find defining uses
fn crash(x: Foo) -> Foo {

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/existential-types-with-cycle-error2.rs:7:1
|
LL | existential type Foo: Bar<Foo, Item = Foo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Foo = impl Bar<Foo, Item = Foo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,6 +1,6 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
existential type Foo: 'static;
type Foo = impl 'static;
//~^ ERROR: at least one trait must be specified
fn foo() -> Foo {

View File

@ -1,8 +1,8 @@
error: at least one trait must be specified
--> $DIR/existential-types-with-no-traits.rs:3:23
--> $DIR/existential-types-with-no-traits.rs:3:17
|
LL | existential type Foo: 'static;
| ^^^^^^^
LL | type Foo = impl 'static;
| ^^^^^^^
error: at least one trait must be specified
--> $DIR/existential-types-with-no-traits.rs:10:13

View File

@ -3,7 +3,7 @@
#![allow(dead_code)]
#![allow(unused_assignments)]
#![allow(unused_variables)]
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {
assert_eq!(foo().to_string(), "foo");
@ -16,14 +16,14 @@ fn main() {
}
// single definition
existential type Foo: std::fmt::Display;
type Foo = impl std::fmt::Display;
fn foo() -> Foo {
"foo"
}
// two definitions
existential type Bar: std::fmt::Display;
type Bar = impl std::fmt::Display;
fn bar1() -> Bar {
"bar1"
@ -34,7 +34,7 @@ fn bar2() -> Bar {
}
// definition in submodule
existential type Boo: std::fmt::Display;
type Boo = impl std::fmt::Display;
mod boo {
pub fn boo() -> super::Boo {
@ -42,7 +42,7 @@ mod boo {
}
}
existential type MyIter<T>: Iterator<Item = T>;
type MyIter<T> = impl Iterator<Item = T>;
fn my_iter<T>(t: T) -> MyIter<T> {
std::iter::once(t)
@ -63,21 +63,21 @@ fn my_iter4<U, V>(_: U, v: V) -> MyIter<V> {
}
// param names should not have an effect!
existential type MyOtherIter<T>: Iterator<Item = T>;
type MyOtherIter<T> = impl Iterator<Item = T>;
fn my_other_iter<U>(u: U) -> MyOtherIter<U> {
std::iter::once(u)
}
trait Trait {}
existential type GenericBound<'a, T: Trait>: Sized + 'a;
type GenericBound<'a, T: Trait> = impl Sized + 'a;
fn generic_bound<'a, T: Trait + 'a>(t: T) -> GenericBound<'a, T> {
t
}
mod pass_through {
pub existential type Passthrough<T>: Sized + 'static;
pub type Passthrough<T> = impl Sized + 'static;
fn define_passthrough<T: 'static>(t: T) -> Passthrough<T> {
t

View File

@ -1,7 +1,7 @@
// check-pass
#![feature(existential_type)]
// Currently, the `existential_type` feature implicitly
#![feature(type_alias_impl_trait)]
// Currently, the `type_alias_impl_trait` feature implicitly
// depends on `impl_trait_in_bindings` in order to work properly.
// Specifically, this line requires `impl_trait_in_bindings` to be enabled:
// https://github.com/rust-lang/rust/blob/481068a707679257e2a738b40987246e0420e787/src/librustc_typeck/check/mod.rs#L856
@ -12,7 +12,7 @@
use std::fmt::Debug;
pub existential type Foo: Debug;
pub type Foo = impl Debug;
const _FOO: Foo = 5;

View File

@ -1,6 +1,6 @@
// check-pass
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
// Regression test for issue #61863
@ -22,6 +22,6 @@ pub fn bla2() -> TE {
}
existential type TE: MyTrait;
type TE = impl MyTrait;
fn main() {}

View File

@ -1,6 +1,6 @@
// check-pass
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
pub trait MyTrait {}
@ -28,6 +28,6 @@ fn make_foo() -> Foo {
true
}
existential type Foo: MyTrait;
type Foo = impl MyTrait;
fn main() {}

View File

@ -1,8 +1,8 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
existential type MyIter<T>: Iterator<Item = T>;
type MyIter<T> = impl Iterator<Item = T>;
fn my_iter<T>(t: T) -> MyIter<T> {
std::iter::once(t)

View File

@ -1,8 +1,8 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
existential type Two<'a, 'b>: std::fmt::Debug;
type Two<'a, 'b> = impl std::fmt::Debug;
fn one<'a>(t: &'a ()) -> Two<'a, 'a> { //~ ERROR non-defining existential type use
t

View File

@ -7,10 +7,10 @@ LL | | }
| |_^
|
note: lifetime used multiple times
--> $DIR/generic_duplicate_lifetime_param.rs:5:22
--> $DIR/generic_duplicate_lifetime_param.rs:5:10
|
LL | existential type Two<'a, 'b>: std::fmt::Debug;
| ^^ ^^
LL | type Two<'a, 'b> = impl std::fmt::Debug;
| ^^ ^^
error: aborting due to previous error

View File

@ -1,11 +1,11 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
//~^ could not find defining uses
fn one<T: Debug>(t: T) -> Two<T, T> {

View File

@ -10,8 +10,8 @@ LL | | }
error: could not find defining uses
--> $DIR/generic_duplicate_param_use.rs:8:1
|
LL | existential type Two<T, U>: Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Two<T, U> = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -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 Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> {
(t, 4u32)

View File

@ -1,11 +1,11 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn one<T: Debug>(t: T) -> Two<T, T> {
//~^ defining existential type use restricts existential type

View File

@ -1,11 +1,11 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn one<T: Debug>(t: T) -> Two<T, T> {
//~^ defining existential type use restricts existential type

View File

@ -1,11 +1,11 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn one<T: Debug>(t: T) -> Two<T, T> {
//~^ ERROR defining existential type use restricts existential type

View File

@ -1,11 +1,11 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
(t, u)

View File

@ -1,11 +1,11 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
// test that unused generic parameters are ok
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn two<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
(t, t)

View File

@ -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 Two<A, B>: Debug;
type Two<A, B> = impl Debug;
fn two<T: Debug + Copy, U>(t: T, u: U) -> Two<T, U> {
(t, t)

View File

@ -1,10 +1,10 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn two<T: Debug, U: Debug>(t: T, _: U) -> Two<T, U> {
(t, 4u32)

View File

@ -1,10 +1,10 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
existential type Two<A, B>: Debug;
type Two<A, B> = impl Debug;
trait Foo {
type Bar: Debug;

View File

@ -1,10 +1,10 @@
// build-pass (FIXME(62277): could be check-pass?)
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
existential type Region<'a>: std::fmt::Debug;
type Region<'a> = impl std::fmt::Debug;
fn region<'b>(a: &'b ()) -> Region<'b> {
a

View File

@ -1,8 +1,8 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
existential type Cmp<T>: 'static;
type Cmp<T> = impl 'static;
//~^ ERROR could not find defining uses
//~^^ ERROR: at least one trait must be specified

View File

@ -1,8 +1,8 @@
error: at least one trait must be specified
--> $DIR/generic_nondefining_use.rs:5:26
--> $DIR/generic_nondefining_use.rs:5:20
|
LL | existential type Cmp<T>: 'static;
| ^^^^^^^
LL | type Cmp<T> = impl 'static;
| ^^^^^^^
error: defining existential type use does not fully define existential type
--> $DIR/generic_nondefining_use.rs:11:1
@ -15,8 +15,8 @@ LL | | }
error: could not find defining uses
--> $DIR/generic_nondefining_use.rs:5:1
|
LL | existential type Cmp<T>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Cmp<T> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -1,8 +1,8 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
existential type WrongGeneric<T: 'static>: 'static;
type WrongGeneric<T: 'static> = impl 'static;
//~^ ERROR: at least one trait must be specified
fn wrong_generic<U: 'static, V: 'static>(_: U, v: V) -> WrongGeneric<U> {

View File

@ -1,8 +1,8 @@
error: at least one trait must be specified
--> $DIR/generic_not_used.rs:5:44
--> $DIR/generic_not_used.rs:5:38
|
LL | existential type WrongGeneric<T: 'static>: 'static;
| ^^^^^^^
LL | type WrongGeneric<T: 'static> = impl 'static;
| ^^^^^^^
error: type parameter `V` is part of concrete type but not used in parameter list for existential type
--> $DIR/generic_not_used.rs:8:73

View File

@ -1,4 +1,4 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {
let y = 42;
@ -6,7 +6,7 @@ fn main() {
let z: i32 = x; //~ ERROR mismatched types
}
existential type WrongGeneric<T>: 'static;
type WrongGeneric<T> = impl 'static;
//~^ ERROR the parameter type `T` may not live long enough
//~^^ ERROR: at least one trait must be specified

View File

@ -1,8 +1,8 @@
error: at least one trait must be specified
--> $DIR/generic_type_does_not_live_long_enough.rs:9:35
--> $DIR/generic_type_does_not_live_long_enough.rs:9:29
|
LL | existential type WrongGeneric<T>: 'static;
| ^^^^^^^
LL | type WrongGeneric<T> = impl 'static;
| ^^^^^^^
error[E0308]: mismatched types
--> $DIR/generic_type_does_not_live_long_enough.rs:6:18
@ -16,8 +16,8 @@ LL | let z: i32 = x;
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/generic_type_does_not_live_long_enough.rs:9:1
|
LL | existential type WrongGeneric<T>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type WrongGeneric<T> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
| - help: consider adding an explicit lifetime bound `T: 'static`...
@ -25,8 +25,8 @@ LL | fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
note: ...so that the type `T` will meet its required lifetime bounds
--> $DIR/generic_type_does_not_live_long_enough.rs:9:1
|
LL | existential type WrongGeneric<T>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type WrongGeneric<T> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -1,9 +1,9 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
trait Trait {}
existential type Underconstrained<T: Trait>: 'static; //~ ERROR the trait bound `T: Trait`
type Underconstrained<T: Trait> = impl 'static; //~ ERROR the trait bound `T: Trait`
//~^ ERROR: at least one trait must be specified
// no `Trait` bound

View File

@ -1,14 +1,14 @@
error: at least one trait must be specified
--> $DIR/generic_underconstrained.rs:6:46
--> $DIR/generic_underconstrained.rs:6:40
|
LL | existential type Underconstrained<T: Trait>: 'static;
| ^^^^^^^
LL | type Underconstrained<T: Trait> = impl 'static;
| ^^^^^^^
error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/generic_underconstrained.rs:6:1
|
LL | existential type Underconstrained<T: Trait>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
LL | type Underconstrained<T: Trait> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
|
= help: consider adding a `where T: Trait` bound
= note: the return type of a function must have a statically known size

View File

@ -1,8 +1,8 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
existential type Underconstrained<T: std::fmt::Debug>: 'static;
type Underconstrained<T: std::fmt::Debug> = impl 'static;
//~^ ERROR `U` doesn't implement `std::fmt::Debug`
//~^^ ERROR: at least one trait must be specified
@ -11,7 +11,7 @@ fn underconstrained<U>(_: U) -> Underconstrained<U> {
5u32
}
existential type Underconstrained2<T: std::fmt::Debug>: 'static;
type Underconstrained2<T: std::fmt::Debug> = impl 'static;
//~^ ERROR `V` doesn't implement `std::fmt::Debug`
//~^^ ERROR: at least one trait must be specified

View File

@ -1,20 +1,20 @@
error: at least one trait must be specified
--> $DIR/generic_underconstrained2.rs:5:56
--> $DIR/generic_underconstrained2.rs:5:50
|
LL | existential type Underconstrained<T: std::fmt::Debug>: 'static;
| ^^^^^^^
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^
error: at least one trait must be specified
--> $DIR/generic_underconstrained2.rs:14:57
--> $DIR/generic_underconstrained2.rs:14:51
|
LL | existential type Underconstrained2<T: std::fmt::Debug>: 'static;
| ^^^^^^^
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^
error[E0277]: `U` doesn't implement `std::fmt::Debug`
--> $DIR/generic_underconstrained2.rs:5:1
|
LL | existential type Underconstrained<T: std::fmt::Debug>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `U`
= help: consider adding a `where U: std::fmt::Debug` bound
@ -23,8 +23,8 @@ LL | existential type Underconstrained<T: std::fmt::Debug>: 'static;
error[E0277]: `V` doesn't implement `std::fmt::Debug`
--> $DIR/generic_underconstrained2.rs:14:1
|
LL | existential type Underconstrained2<T: std::fmt::Debug>: 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `std::fmt::Debug` is not implemented for `V`
= help: consider adding a `where V: std::fmt::Debug` bound

View File

@ -1,4 +1,4 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
trait UnwrapItemsExt {
type Iter;
@ -10,7 +10,7 @@ where
I: Iterator<Item = Result<T, E>>,
E: std::fmt::Debug,
{
existential type Iter: Iterator<Item = T>;
type Iter = impl Iterator<Item = T>;
//~^ ERROR: could not find defining uses
fn unwrap_items(self) -> Self::Iter {

View File

@ -23,8 +23,8 @@ LL | | }
error: could not find defining uses
--> $DIR/issue-58887.rs:13:5
|
LL | existential type Iter: Iterator<Item = T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Iter = impl Iterator<Item = T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -5,7 +5,7 @@ trait Bug {
}
impl Bug for &() {
existential type Item: Bug; //~ ERROR existential types are unstable
type Item = impl Bug; //~ ERROR existential types are unstable
//~^ ERROR the trait bound `(): Bug` is not satisfied
//~^^ ERROR could not find defining uses

View File

@ -1,17 +1,17 @@
error[E0658]: existential types are unstable
--> $DIR/issue-60371.rs:8:5
|
LL | existential type Item: Bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Item = impl Bug;
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
= help: add `#![feature(existential_type)]` to the crate attributes to enable
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
error[E0277]: the trait bound `(): Bug` is not satisfied
--> $DIR/issue-60371.rs:8:5
|
LL | existential type Item: Bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bug` is not implemented for `()`
LL | type Item = impl Bug;
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Bug` is not implemented for `()`
|
= help: the following implementations were found:
<&() as Bug>
@ -20,8 +20,8 @@ LL | existential type Item: Bug;
error: could not find defining uses
--> $DIR/issue-60371.rs:8:5
|
LL | existential type Item: Bug;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Item = impl Bug;
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View File

@ -1,10 +1,10 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
// build-pass (FIXME(62277): could be check-pass?)
mod my_mod {
use std::fmt::Debug;
pub existential type Foo: Debug;
pub existential type Foot: Debug;
pub type Foo = impl Debug;
pub type Foot = impl Debug;
pub fn get_foo() -> Foo {
5i32

View File

@ -1,9 +1,9 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
// don't reveal the concrete type
existential type NoReveal: std::fmt::Debug;
type NoReveal = impl std::fmt::Debug;
fn define_no_reveal() -> NoReveal {
""

View File

@ -1,9 +1,9 @@
// Issue 52985: user code provides no use case that allows an existential type
// We now emit a 'could not find defining uses' error
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
existential type Foo: Copy; //~ could not find defining uses
type Foo = impl Copy; //~ could not find defining uses
// make compiler happy about using 'Foo'
fn bar(x: Foo) -> Foo { x }

View File

@ -1,8 +1,8 @@
error: could not find defining uses
--> $DIR/no_inferrable_concrete_type.rs:6:1
|
LL | existential type Foo: Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | type Foo = impl Copy;
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,9 +1,9 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {}
mod boo {
pub existential type Boo: ::std::fmt::Debug;
pub type Boo = impl ::std::fmt::Debug;
fn bomp() -> Boo {
""
}

View File

@ -1,10 +1,10 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;
fn main() {}
existential type Two<T, U>: Debug;
type Two<T, U> = impl Debug;
fn two<T: Debug>(t: T) -> Two<T, u32> {
//~^ ERROR defining existential type use does not fully define existential type

View File

@ -1,4 +1,4 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {
}
@ -7,7 +7,7 @@ trait TraitWithAssoc {
type Assoc;
}
existential type Foo<V>: Trait<V::Assoc>; //~ associated type `Assoc` not found for `V`
type Foo<V> = impl Trait<V::Assoc>; //~ associated type `Assoc` not found for `V`
trait Trait<U> {}

View File

@ -1,8 +1,8 @@
error[E0220]: associated type `Assoc` not found for `V`
--> $DIR/not_well_formed.rs:10:32
--> $DIR/not_well_formed.rs:10:26
|
LL | existential type Foo<V>: Trait<V::Assoc>;
| ^^^^^^^^ associated type `Assoc` not found
LL | type Foo<V> = impl Trait<V::Assoc>;
| ^^^^^^^^ associated type `Assoc` not found
error: aborting due to previous error

View File

@ -1,16 +1,16 @@
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
fn main() {
}
existential type PartiallyDefined<T>: 'static;
type PartiallyDefined<T> = impl 'static;
//~^ ERROR: at least one trait must be specified
fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> {
4u32
}
existential type PartiallyDefined2<T>: 'static;
type PartiallyDefined2<T> = impl 'static;
//~^ ERROR: at least one trait must be specified
fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> {

View File

@ -1,14 +1,14 @@
error: at least one trait must be specified
--> $DIR/unused_generic_param.rs:6:39
--> $DIR/unused_generic_param.rs:6:33
|
LL | existential type PartiallyDefined<T>: 'static;
| ^^^^^^^
LL | type PartiallyDefined<T> = impl 'static;
| ^^^^^^^
error: at least one trait must be specified
--> $DIR/unused_generic_param.rs:13:40
--> $DIR/unused_generic_param.rs:13:34
|
LL | existential type PartiallyDefined2<T>: 'static;
| ^^^^^^^
LL | type PartiallyDefined2<T> = impl 'static;
| ^^^^^^^
error: aborting due to 2 previous errors

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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 {
()

View File

@ -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());

View File

@ -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]

View File

@ -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)`

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0562`.
error: could not find defining uses
--> $DIR/where-allowed.rs:122:5
|
LL | type Out = impl Debug;
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 41 previous errors
Some errors have detailed explanations: E0562, E0658.
For more information about an error, try `rustc --explain E0562`.

View File

@ -9,6 +9,6 @@ impl Howness for () {
Empty
}
}
//~^ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`,
//~^ ERROR expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`,
fn main() {}

View File

@ -7,11 +7,11 @@ LL | fn how_are_you(&self -> Empty {
| | help: `)` may belong here
| unclosed delimiter
error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `)`
error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `)`
--> $DIR/issue-58856-2.rs:11:1
|
LL | }
| - expected one of 11 possible tokens here
| - expected one of 10 possible tokens here
LL | }
| ^ unexpected token

View File

@ -1,11 +1,11 @@
// build-pass (FIXME(62277): could be check-pass?)
// compile-flags: -Z unpretty=hir
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
trait Animal {
}
fn main() {
pub existential type ServeFut: Animal;
pub type ServeFut = impl Animal;
}

View File

@ -1,7 +1,7 @@
// build-pass (FIXME(62277): could be check-pass?)
// compile-flags: -Z unpretty=hir
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
#[prelude_import]
use ::std::prelude::v1::*;
#[macro_use]

View File

@ -1,8 +1,8 @@
error: expected one of `async`, `const`, `existential`, `extern`, `fn`, `type`, or `unsafe`, found `pub`
error: expected one of `async`, `const`, `extern`, `fn`, `type`, or `unsafe`, found `pub`
--> $DIR/default.rs:22:13
|
LL | default pub fn foo<T: Default>() -> T { T::default() }
| ^^^ expected one of 7 possible tokens here
| ^^^ expected one of `async`, `const`, `extern`, `fn`, `type`, or `unsafe` here
error[E0449]: unnecessary visibility qualifier
--> $DIR/default.rs:16:5

View File

@ -1,11 +1,9 @@
// ignore-tidy-linelength
struct Foo;
impl Foo {
fn foo() {}
#[stable(feature = "rust1", since = "1.0.0")]
} //~ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or
} //~ ERROR expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, or
fn main() {}

View File

@ -1,8 +1,8 @@
error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}`
--> $DIR/issue-20711-2.rs:9:1
error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}`
--> $DIR/issue-20711-2.rs:7:1
|
LL | #[stable(feature = "rust1", since = "1.0.0")]
| - expected one of 10 possible tokens here
| - expected one of 9 possible tokens here
LL | }
| ^ unexpected token

View File

@ -1,9 +1,7 @@
// ignore-tidy-linelength
struct Foo;
impl Foo {
#[stable(feature = "rust1", since = "1.0.0")]
} //~ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or
} //~ ERROR expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, or
fn main() {}

View File

@ -1,8 +1,8 @@
error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}`
--> $DIR/issue-20711.rs:7:1
error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}`
--> $DIR/issue-20711.rs:5:1
|
LL | #[stable(feature = "rust1", since = "1.0.0")]
| - expected one of 10 possible tokens here
| - expected one of 9 possible tokens here
LL | }
| ^ unexpected token

View File

@ -1,8 +1,8 @@
error: expected one of `(`, `async`, `const`, `default`, `existential`, `extern`, `fn`, `type`, or `unsafe`, found `}`
error: expected one of `(`, `async`, `const`, `default`, `extern`, `fn`, `type`, or `unsafe`, found `}`
--> $DIR/issue-41155.rs:5:1
|
LL | pub
| - expected one of 9 possible tokens here
| - expected one of 8 possible tokens here
LL | }
| ^ unexpected token

View File

@ -1,10 +1,8 @@
// ignore-tidy-linelength
struct S;
impl S {
static fn f() {}
//~^ ERROR expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`,
}
//~^^ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`,
fn main() {}

View File

@ -1,8 +1,8 @@
error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `static`
--> $DIR/removed-syntax-static-fn.rs:6:5
error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `static`
--> $DIR/removed-syntax-static-fn.rs:4:5
|
LL | impl S {
| - expected one of 11 possible tokens here
| - expected one of 10 possible tokens here
LL | static fn f() {}
| ^^^^^^ unexpected token

View File

@ -1,7 +1,8 @@
// Private types and traits are not allowed in interfaces of associated types.
// This test also ensures that the checks are performed even inside private modules.
#![feature(associated_type_defaults, existential_type)]
#![feature(associated_type_defaults)]
#![feature(type_alias_impl_trait)]
mod m {
struct Priv;
@ -31,7 +32,7 @@ mod m {
type Alias1 = Priv;
//~^ ERROR private type `m::Priv` in public interface
existential type Exist: PrivTr;
type Exist = impl PrivTr;
//~^ ERROR private trait `m::PrivTr` in public interface
fn infer_exist() -> Self::Exist { Priv }
}

View File

@ -1,5 +1,5 @@
warning: private trait `m::PrivTr` in public interface (error E0445)
--> $DIR/private-in-public-assoc-ty.rs:15:5
--> $DIR/private-in-public-assoc-ty.rs:16:5
|
LL | / pub trait PubTr {
LL | |
@ -15,7 +15,7 @@ LL | | }
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
warning: private type `m::Priv` in public interface (error E0446)
--> $DIR/private-in-public-assoc-ty.rs:15:5
--> $DIR/private-in-public-assoc-ty.rs:16:5
|
LL | / pub trait PubTr {
LL | |
@ -30,7 +30,7 @@ LL | | }
= note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
error[E0446]: private type `m::Priv` in public interface
--> $DIR/private-in-public-assoc-ty.rs:24:9
--> $DIR/private-in-public-assoc-ty.rs:25:9
|
LL | struct Priv;
| - `m::Priv` declared as private
@ -39,7 +39,7 @@ LL | type Alias4 = Priv;
| ^^^^^^^^^^^^^^^^^^^ can't leak private type
error[E0446]: private type `m::Priv` in public interface
--> $DIR/private-in-public-assoc-ty.rs:31:9
--> $DIR/private-in-public-assoc-ty.rs:32:9
|
LL | struct Priv;
| - `m::Priv` declared as private
@ -48,13 +48,13 @@ LL | type Alias1 = Priv;
| ^^^^^^^^^^^^^^^^^^^ can't leak private type
error[E0445]: private trait `m::PrivTr` in public interface
--> $DIR/private-in-public-assoc-ty.rs:34:9
--> $DIR/private-in-public-assoc-ty.rs:35:9
|
LL | trait PrivTr {}
| - `m::PrivTr` declared as private
...
LL | existential type Exist: PrivTr;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
LL | type Exist = impl PrivTr;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
error: aborting due to 3 previous errors

View File

@ -1,9 +1,9 @@
// build-pass (FIXME(62277): could be check-pass?)
#![feature(existential_type)]
#![feature(type_alias_impl_trait)]
#![deny(private_in_public)]
pub existential type Pub: Default;
pub type Pub = impl Default;
#[derive(Default)]
struct Priv;
@ -18,7 +18,7 @@ pub trait Trait {
}
impl Trait for u8 {
existential type Pub: Default;
type Pub = impl Default;
fn method() -> Self::Pub { Priv }
}