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:
bors 2019-08-03 02:21:23 +00:00
commit d7270712cb
202 changed files with 1050 additions and 1033 deletions

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]
@ -10,5 +10,5 @@ extern crate std;
trait Animal { }
fn main() {
pub existential type ServeFut : Animal;
pub type ServeFut = impl Animal;
}