Auto merge of #63180 - varkor:trait-alias-impl-trait, r=Centril
Change opaque type syntax from `existential type` to type alias `impl Trait` This implements a new feature gate `type_alias_impl_trait` (this is slightly different from the originally proposed feature name, but matches what has been used in discussion since), deprecating the old `existential_types` feature. The syntax for opaque types has been changed. In addition, the "existential" terminology has been replaced with "opaque", as per previous discussion and the RFC. This makes partial progress towards implementing https://github.com/rust-lang/rust/issues/63063. r? @Centril
This commit is contained in:
commit
d7270712cb
202 changed files with 1050 additions and 1033 deletions
|
|
@ -28,7 +28,7 @@ impl Case1 for S1 {
|
|||
type B = Range<u16>;
|
||||
}
|
||||
|
||||
// Ensure we don't have existential desugaring:
|
||||
// Ensure we don't have opaque `impl Trait` desugaring:
|
||||
|
||||
pub trait Foo { type Out: Baz<Assoc: Default>; }
|
||||
pub trait Baz { type Assoc; }
|
||||
|
|
|
|||
|
|
@ -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>> {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(existential_type)]
|
||||
|
||||
use std::ops::Add;
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
@ -99,12 +99,10 @@ fn async_fn_with_impl_future_named_lifetime<'a>(x: &'a u8) -> impl Future<Output
|
|||
}
|
||||
}
|
||||
|
||||
/* FIXME(cramertj) support when `existential type T<'a, 'b>:;` works
|
||||
async fn async_fn_multiple_args(x: &u8, _y: &u8) -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
wake_and_yield_once().await;
|
||||
*x
|
||||
}
|
||||
*/
|
||||
|
||||
async fn async_fn_multiple_args_named_lifetime<'a>(x: &'a u8, _y: &'a u8) -> u8 {
|
||||
wake_and_yield_once().await;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
// Test that existential types are allowed to contain late-bound regions.
|
||||
// Test that opaque `impl Trait` types are allowed to contain late-bound regions.
|
||||
|
||||
// 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 {
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
// Checks to ensure that we properly detect when a closure constrains an existential type
|
||||
#![feature(existential_type)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {
|
||||
existential type Existential: Debug;
|
||||
fn _unused() -> Existential { String::new() }
|
||||
//~^ ERROR: concrete type differs from previous defining existential type use
|
||||
let null = || -> Existential { 0 };
|
||||
println!("{:?}", null());
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
--> $DIR/issue-52843-closure-constrain.rs:8:5
|
||||
|
|
||||
LL | fn _unused() -> Existential { String::new() }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, got `std::string::String`
|
||||
|
|
||||
note: previous use here
|
||||
--> $DIR/issue-52843-closure-constrain.rs:6:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | existential type Existential: Debug;
|
||||
LL | | fn _unused() -> Existential { String::new() }
|
||||
LL | |
|
||||
LL | | let null = || -> Existential { 0 };
|
||||
LL | | println!("{:?}", null());
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Crate that exports an existential type. Used for testing cross-crate.
|
||||
|
||||
#![crate_type="rlib"]
|
||||
|
||||
#![feature(existential_type)]
|
||||
|
||||
pub existential type Foo: std::fmt::Debug;
|
||||
|
||||
pub fn foo() -> Foo {
|
||||
5
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#![feature(existential_type)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
// declared but never defined
|
||||
existential type Bar: std::fmt::Debug; //~ ERROR could not find defining uses
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#![feature(existential_type)]
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
fn bomp() -> boo::Boo {
|
||||
""
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
error: could not find defining uses
|
||||
--> $DIR/existential-types-with-cycle-error.rs:3:1
|
||||
|
|
||||
LL | existential type Foo: Fn() -> Foo;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
error: could not find defining uses
|
||||
--> $DIR/existential-types-with-cycle-error2.rs:7:1
|
||||
|
|
||||
LL | existential type Foo: Bar<Foo, Item = Foo>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#![feature(existential_type)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
existential type Two<'a, 'b>: std::fmt::Debug;
|
||||
|
||||
fn one<'a>(t: &'a ()) -> Two<'a, 'a> { //~ ERROR non-defining existential type use
|
||||
t
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
error: at least one trait must be specified
|
||||
--> $DIR/unused_generic_param.rs:6:39
|
||||
|
|
||||
LL | existential type PartiallyDefined<T>: 'static;
|
||||
| ^^^^^^^
|
||||
|
||||
error: at least one trait must be specified
|
||||
--> $DIR/unused_generic_param.rs:13:40
|
||||
|
|
||||
LL | existential type PartiallyDefined2<T>: 'static;
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// Check that existential types must be ungated to use the `existential` keyword
|
||||
|
||||
existential type Foo: std::fmt::Debug; //~ ERROR existential types are unstable
|
||||
|
||||
trait Bar {
|
||||
type Baa: std::fmt::Debug;
|
||||
fn define() -> Self::Baa;
|
||||
}
|
||||
|
||||
impl Bar for () {
|
||||
existential type Baa: std::fmt::Debug; //~ ERROR existential types are unstable
|
||||
fn define() -> Self::Baa { 0 }
|
||||
}
|
||||
|
||||
fn define() -> Foo { 0 }
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
error[E0658]: existential types are unstable
|
||||
--> $DIR/feature-gate-existential-type.rs:3:1
|
||||
|
|
||||
LL | existential type Foo: std::fmt::Debug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
|
||||
= help: add `#![feature(existential_type)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: existential types are unstable
|
||||
--> $DIR/feature-gate-existential-type.rs:11:5
|
||||
|
|
||||
LL | existential type Baa: std::fmt::Debug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
|
||||
= help: add `#![feature(existential_type)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
type Foo = impl std::fmt::Debug; //~ ERROR `impl Trait` in type aliases is unstable
|
||||
|
||||
trait Bar {
|
||||
type Baa: std::fmt::Debug;
|
||||
fn define() -> Self::Baa;
|
||||
}
|
||||
|
||||
impl Bar for () {
|
||||
type Baa = impl std::fmt::Debug; //~ ERROR `impl Trait` in type aliases is unstable
|
||||
fn define() -> Self::Baa { 0 }
|
||||
}
|
||||
|
||||
fn define() -> Foo { 0 }
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
error[E0658]: `impl Trait` in type aliases is unstable
|
||||
--> $DIR/feature-gate-type_alias_impl_trait.rs:1:1
|
||||
|
|
||||
LL | type Foo = impl std::fmt::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]: `impl Trait` in type aliases is unstable
|
||||
--> $DIR/feature-gate-type_alias_impl_trait.rs:9:5
|
||||
|
|
||||
LL | type Baa = impl std::fmt::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: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -81,9 +81,9 @@ mod impl_trait_in_bindings {
|
|||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// The same applied to `existential type`s
|
||||
// The same applied to `type Foo = impl Bar`s
|
||||
|
||||
mod existential_types {
|
||||
mod opaque_types {
|
||||
trait Implemented {
|
||||
type Assoc;
|
||||
}
|
||||
|
|
@ -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 {
|
||||
()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// ignore-tidy-linelength
|
||||
#![feature(existential_type)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
pub trait Bar
|
||||
{
|
||||
|
|
@ -9,12 +9,12 @@ 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]
|
||||
|
||||
fn foo<T: Default>() -> Self::E {
|
||||
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for existential type
|
||||
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
(S::default(), T::default())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,14 +11,14 @@ 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)`
|
||||
= note: the return type of a function must have a statically known size
|
||||
|
||||
error: type parameter `T` is part of concrete type but not used in parameter list for existential type
|
||||
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/issue-55872-1.rs:16:37
|
||||
|
|
||||
LL | fn foo<T: Default>() -> Self::E {
|
||||
|
|
|
|||
|
|
@ -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,10 +9,10 @@ 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
|
||||
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
async {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
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
|
||||
|
||||
error: type parameter `T` is part of concrete type but not used in parameter list for existential type
|
||||
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/issue-55872-2.rs:14:28
|
||||
|
|
||||
LL | fn foo<T>() -> Self::E {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// ignore-tidy-linelength
|
||||
#![feature(existential_type)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
pub trait Bar {
|
||||
type E: Copy;
|
||||
|
|
@ -8,10 +8,10 @@ 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
|
||||
//~^ ERROR type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
|| ()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: type parameter `T` is part of concrete type but not used in parameter list for existential type
|
||||
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/issue-55872.rs:13:28
|
||||
|
|
||||
LL | fn foo<T>() -> Self::E {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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());
|
||||
|
|
@ -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 `impl Trait` in type aliases is 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 `impl Trait` in type aliases is 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
|
||||
|
|
|
|||
|
|
@ -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]: `impl Trait` in type aliases is 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]: `impl Trait` in type aliases is 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`.
|
||||
|
|
|
|||
|
|
@ -77,19 +77,19 @@ fn impl_trait_in_band(x: &impl MyTrait<'a>) {}
|
|||
|
||||
trait FunkyTrait<'a> { }
|
||||
impl<'a, T> FunkyTrait<'a> for T { }
|
||||
fn existential_impl_trait_in_band_outlives(x: &'a u32) -> impl ::std::fmt::Debug + 'a {
|
||||
fn ret_pos_impl_trait_in_band_outlives(x: &'a u32) -> impl ::std::fmt::Debug + 'a {
|
||||
x
|
||||
}
|
||||
fn existential_impl_trait_in_band_param(x: &'a u32) -> impl FunkyTrait<'a> {
|
||||
fn ret_pos_impl_trait_in_band_param(x: &'a u32) -> impl FunkyTrait<'a> {
|
||||
x
|
||||
}
|
||||
fn existential_impl_trait_in_band_param_static(x: &'a u32) -> impl FunkyTrait<'static> + 'a {
|
||||
fn ret_pos_impl_trait_in_band_param_static(x: &'a u32) -> impl FunkyTrait<'static> + 'a {
|
||||
x
|
||||
}
|
||||
fn existential_impl_trait_in_band_param_outlives(x: &'a u32) -> impl FunkyTrait<'a> + 'a {
|
||||
fn ret_pos_impl_trait_in_band_param_outlives(x: &'a u32) -> impl FunkyTrait<'a> + 'a {
|
||||
x
|
||||
}
|
||||
fn existential_impl_trait_in_band_higher_ranked(x: &'a u32) -> impl for<'b> FunkyTrait<'b> + 'a {
|
||||
fn ret_pos_impl_trait_in_band_higher_ranked(x: &'a u32) -> impl for<'b> FunkyTrait<'b> + 'a {
|
||||
x
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
@ -10,5 +10,5 @@ extern crate std;
|
|||
trait Animal { }
|
||||
|
||||
fn main() {
|
||||
pub existential type ServeFut : Animal;
|
||||
pub type ServeFut = impl Animal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// run-pass
|
||||
#![allow(unused_must_use)]
|
||||
// Tests that a heterogeneous list of existential types can be put inside an Arc
|
||||
// Tests that a heterogeneous list of existential `dyn` types can be put inside an Arc
|
||||
// and shared between threads as long as all types fulfill Send.
|
||||
|
||||
// ignore-emscripten no threads support
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// Crate that exports an opaque `impl Trait` type. Used for testing cross-crate.
|
||||
|
||||
#![crate_type="rlib"]
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
pub type Foo = impl std::fmt::Debug;
|
||||
|
||||
pub fn foo() -> Foo {
|
||||
5
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
// Crate that exports an existential type. Used for testing cross-crate.
|
||||
// Crate that exports an opaque `impl Trait` type. Used for testing cross-crate.
|
||||
|
||||
#![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()
|
||||
|
|
@ -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> {}
|
||||
|
||||
|
|
@ -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> {}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: defining existential type use does not fully define existential type
|
||||
error: defining opaque type use does not fully define opaque type
|
||||
--> $DIR/bound_reduction2.rs:17:1
|
||||
|
|
||||
LL | / fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T::Assoc> {
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
// declared but never defined
|
||||
type Bar = impl std::fmt::Debug; //~ ERROR could not find defining uses
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
mod boo {
|
||||
// declared in module but not defined inside of it
|
||||
pub type Boo = impl ::std::fmt::Debug; //~ ERROR could not find defining uses
|
||||
}
|
||||
|
||||
fn bomp() -> boo::Boo {
|
||||
""
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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 {
|
||||
""
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/different_defining_uses.rs:12:1
|
||||
|
|
||||
LL | / fn bar() -> Foo {
|
||||
|
|
@ -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 {
|
||||
""
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/different_defining_uses_never_type.rs:12:1
|
||||
|
|
||||
LL | / fn bar() -> Foo {
|
||||
|
|
@ -14,7 +14,7 @@ LL | | ""
|
|||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/different_defining_uses_never_type.rs:16:1
|
||||
|
|
||||
LL | / fn boo() -> Foo {
|
||||
|
|
@ -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 {
|
||||
""
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/generic_different_defining_uses.rs:11:1
|
||||
|
|
||||
LL | / fn my_iter2<T>(t: T) -> MyIter<T> {
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
fn main() {}
|
||||
|
||||
type Two<'a, 'b> = impl std::fmt::Debug;
|
||||
|
||||
fn one<'a>(t: &'a ()) -> Two<'a, 'a> { //~ ERROR non-defining opaque type use
|
||||
t
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: non-defining existential type use in defining scope
|
||||
error: non-defining opaque type use in defining scope
|
||||
--> $DIR/generic_duplicate_lifetime_param.rs:7:1
|
||||
|
|
||||
LL | / fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#![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> {
|
||||
//~^ ERROR defining existential type use restricts existential type
|
||||
//~^ ERROR defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: defining existential type use restricts existential type by using the generic parameter `T` twice
|
||||
error: defining opaque type use restricts opaque type by using the generic parameter `T` twice
|
||||
--> $DIR/generic_duplicate_param_use.rs:11:1
|
||||
|
|
||||
LL | / fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#![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
|
||||
//~^ defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: defining existential type use restricts existential type by using the generic parameter `T` twice
|
||||
error: defining opaque type use restricts opaque type by using the generic parameter `T` twice
|
||||
--> $DIR/generic_duplicate_param_use2.rs:10:1
|
||||
|
|
||||
LL | / fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#![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
|
||||
//~^ defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: defining existential type use restricts existential type by using the generic parameter `T` twice
|
||||
error: defining opaque type use restricts opaque type by using the generic parameter `T` twice
|
||||
--> $DIR/generic_duplicate_param_use3.rs:10:1
|
||||
|
|
||||
LL | / fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#![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
|
||||
//~^ ERROR defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: defining existential type use restricts existential type by using the generic parameter `T` twice
|
||||
error: defining opaque type use restricts opaque type by using the generic parameter `T` twice
|
||||
--> $DIR/generic_duplicate_param_use4.rs:10:1
|
||||
|
|
||||
LL | / fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/generic_duplicate_param_use5.rs:14:1
|
||||
|
|
||||
LL | / fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/generic_duplicate_param_use6.rs:14:1
|
||||
|
|
||||
LL | / fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/generic_duplicate_param_use8.rs:13:1
|
||||
|
|
||||
LL | / fn three<T: Debug, U: Debug>(_: T, u: U) -> Two<T, U> {
|
||||
|
|
@ -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;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
error: concrete type differs from previous defining existential type use
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/generic_duplicate_param_use9.rs:18:1
|
||||
|
|
||||
LL | / fn three<T: Debug, U: Debug>(t: T, u: U) -> Two<T, U> {
|
||||
|
|
@ -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
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
#![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
|
||||
|
||||
|
||||
// not a defining use, because it doesn't define *all* possible generics
|
||||
fn cmp() -> Cmp<u32> { //~ ERROR defining existential type use does not fully define
|
||||
fn cmp() -> Cmp<u32> { //~ ERROR defining opaque type use does not fully define
|
||||
5u32
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
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
|
||||
error: defining opaque type use does not fully define opaque type
|
||||
--> $DIR/generic_nondefining_use.rs:11:1
|
||||
|
|
||||
LL | / fn cmp() -> Cmp<u32> {
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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> {
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue