about summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-03-02 21:23:15 +0900
committerGitHub <noreply@github.com>2021-03-02 21:23:15 +0900
commit5e68c60406741c41d7dff65e74d05f641ee6022f (patch)
treeb9520af8789e24ebeb6aedeab006b9586840adcc /src/test/ui/parser
parentae5e024194a99bf265c874d64999e6beae916cde (diff)
parent4f4e15d5eb9750c4ac8c140207612122562d6c51 (diff)
downloadrust-5e68c60406741c41d7dff65e74d05f641ee6022f.tar.gz
rust-5e68c60406741c41d7dff65e74d05f641ee6022f.zip
Rollup merge of #82516 - PoignardAzur:inherent-impl-ty, r=oli-obk
Add incomplete feature gate for inherent associate types.

Mentored by ``````@oli-obk``````

So far the only change is that instead of giving an automatic error, the following code compiles:

```rust
struct Foo;

impl Foo {
    type Bar = isize;
}
```

The backend work to make it actually usable isn't there yet. In particular, this:

```rust
let x : Foo::Bar;
```

will give you:

```sh
error[E0223]: ambiguous associated type
  --> /$RUSTC_DIR/src/test/ui/assoc-inherent.rs:15:13
   |
LL |     let x : Foo::Bar;
   |             ^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Bar`
```
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs8
-rw-r--r--src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr22
2 files changed, 21 insertions, 9 deletions
diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
index fa9c7ababcf..1ccc9497d9d 100644
--- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
+++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.rs
@@ -8,16 +8,16 @@ struct X;
 impl X {
     type Y;
     //~^ ERROR associated type in `impl` without body
-    //~| ERROR associated types are not yet supported in inherent impls
+    //~| ERROR inherent associated types are unstable
     type Z: Ord;
     //~^ ERROR associated type in `impl` without body
     //~| ERROR bounds on `type`s in `impl`s have no effect
-    //~| ERROR associated types are not yet supported in inherent impls
+    //~| ERROR inherent associated types are unstable
     type W: Ord where Self: Eq;
     //~^ ERROR associated type in `impl` without body
     //~| ERROR bounds on `type`s in `impl`s have no effect
-    //~| ERROR associated types are not yet supported in inherent impls
+    //~| ERROR inherent associated types are unstable
     type W where Self: Eq;
     //~^ ERROR associated type in `impl` without body
-    //~| ERROR associated types are not yet supported in inherent impls
+    //~| ERROR inherent associated types are unstable
 }
diff --git a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
index 214467793bc..818d73c898d 100644
--- a/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
+++ b/src/test/ui/parser/impl-item-type-no-body-semantic-fail.stderr
@@ -51,30 +51,42 @@ LL | #![feature(generic_associated_types)]
    = note: `#[warn(incomplete_features)]` on by default
    = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
 
-error[E0202]: associated types are not yet supported in inherent impls (see #8995)
+error[E0658]: inherent associated types are unstable
   --> $DIR/impl-item-type-no-body-semantic-fail.rs:9:5
    |
 LL |     type Y;
    |     ^^^^^^^
+   |
+   = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
+   = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
 
-error[E0202]: associated types are not yet supported in inherent impls (see #8995)
+error[E0658]: inherent associated types are unstable
   --> $DIR/impl-item-type-no-body-semantic-fail.rs:12:5
    |
 LL |     type Z: Ord;
    |     ^^^^^^^^^^^^
+   |
+   = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
+   = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
 
-error[E0202]: associated types are not yet supported in inherent impls (see #8995)
+error[E0658]: inherent associated types are unstable
   --> $DIR/impl-item-type-no-body-semantic-fail.rs:16:5
    |
 LL |     type W: Ord where Self: Eq;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
+   = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
 
-error[E0202]: associated types are not yet supported in inherent impls (see #8995)
+error[E0658]: inherent associated types are unstable
   --> $DIR/impl-item-type-no-body-semantic-fail.rs:20:5
    |
 LL |     type W where Self: Eq;
    |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
+   = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
 
 error: aborting due to 10 previous errors; 1 warning emitted
 
-For more information about this error, try `rustc --explain E0202`.
+For more information about this error, try `rustc --explain E0658`.