From 3b30c36c3bad547e4a196969511c33041c944478 Mon Sep 17 00:00:00 2001
From: bstrie <865233+bstrie@users.noreply.github.com>
Date: Thu, 18 Mar 2021 14:58:51 -0400
Subject: [PATCH 1/2] Document current limitation of type aliases on enums
---
src/items/type-aliases.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/items/type-aliases.md b/src/items/type-aliases.md
index c471f7a6a..2d43e18c2 100644
--- a/src/items/type-aliases.md
+++ b/src/items/type-aliases.md
@@ -1,3 +1,4 @@
+
# Type aliases
> **Syntax**\
@@ -33,6 +34,25 @@ let _ = TypeAlias(5); // Doesn't work
A type alias without the [_Type_] specification may only appear as an
[associated type] in a [trait].
+A type alias to an enum cannot refer to the enum's variants within a [use declaration]:
+
+```rust,edition2018,compile_fail
+mod my_mod {
+ pub enum MyEnum {
+ MyVariant
+ }
+
+ pub type TypeAlias = MyEnum;
+}
+
+use my_mod::MyEnum; // OK
+use my_mod::MyEnum::MyVariant; // OK
+use my_mod::TypeAlias; // OK
+use my_mod::TypeAlias::MyVariant; // Doesn't work
+
+let _ = my_mod::TypeAlias::MyVariant; // OK
+```
+
[IDENTIFIER]: ../identifiers.md
[_GenericParams_]: generics.md
[_WhereClause_]: generics.md#where-clauses
@@ -40,3 +60,4 @@ A type alias without the [_Type_] specification may only appear as an
[associated type]: associated-items.md#associated-types
[trait]: traits.md
[type]: ../types.md
+[use declaration]: use-declarations.md
From d0686385ba35ae9170d121bfa85ca2ff7711287f Mon Sep 17 00:00:00 2001
From: bstrie <865233+bstrie@users.noreply.github.com>
Date: Thu, 18 Mar 2021 15:45:25 -0400
Subject: [PATCH 2/2] Add error code
Co-authored-by: Joshua Nelson
---
src/items/type-aliases.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/items/type-aliases.md b/src/items/type-aliases.md
index 2d43e18c2..862b98700 100644
--- a/src/items/type-aliases.md
+++ b/src/items/type-aliases.md
@@ -36,7 +36,7 @@ A type alias without the [_Type_] specification may only appear as an
A type alias to an enum cannot refer to the enum's variants within a [use declaration]:
-```rust,edition2018,compile_fail
+```rust,edition2018,compile_fail,E0432
mod my_mod {
pub enum MyEnum {
MyVariant