about summary refs log tree commit diff
path: root/src/test/ui/resolve
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-11-22 10:17:09 +0000
committerbors <bors@rust-lang.org>2022-11-22 10:17:09 +0000
commitb7463e8bdb7b039e75241dcc4ea65bbd24d5c608 (patch)
tree837bf66b75c278b9baeb86df6ed75a3230f62fef /src/test/ui/resolve
parenta78c9bee4d9d51a3891bd8ecae1f28a93b83653b (diff)
parent7a5376d23cb3324edcfaa278a9387898960d5f7c (diff)
Auto merge of #103578 - petrochenkov:nofict, r=nagisa
Unreserve braced enum variants in value namespace

With this PR braced enum variants (`enum E { V { /*...*/ } }`) no longer take a slot in value namespace, so the special case mentioned in the note in https://github.com/rust-lang/rfcs/blob/master/text/1506-adt-kinds.md#braced-structs is removed.

Report - https://github.com/rust-lang/rust/pull/103578#issuecomment-1292594900.
Diffstat (limited to 'src/test/ui/resolve')
-rw-r--r--src/test/ui/resolve/issue-18252.rs2
-rw-r--r--src/test/ui/resolve/issue-18252.stderr9
-rw-r--r--src/test/ui/resolve/issue-19452.stderr18
-rw-r--r--src/test/ui/resolve/issue-73427.stderr22
-rw-r--r--src/test/ui/resolve/privacy-enum-ctor.stderr90
5 files changed, 44 insertions, 97 deletions
diff --git a/src/test/ui/resolve/issue-18252.rs b/src/test/ui/resolve/issue-18252.rs
index af0a3cbcb2d..f6ebe292076 100644
--- a/src/test/ui/resolve/issue-18252.rs
+++ b/src/test/ui/resolve/issue-18252.rs
@@ -4,5 +4,5 @@ enum Foo {
 
 fn main() {
     let f = Foo::Variant(42);
-    //~^ ERROR expected function, tuple struct or tuple variant, found struct variant `Foo::Variant`
+    //~^ ERROR expected value, found struct variant `Foo::Variant`
 }
diff --git a/src/test/ui/resolve/issue-18252.stderr b/src/test/ui/resolve/issue-18252.stderr
index 13e7a59732d..d9006c0a6c2 100644
--- a/src/test/ui/resolve/issue-18252.stderr
+++ b/src/test/ui/resolve/issue-18252.stderr
@@ -1,12 +1,9 @@
-error[E0423]: expected function, tuple struct or tuple variant, found struct variant `Foo::Variant`
+error[E0533]: expected value, found struct variant `Foo::Variant`
   --> $DIR/issue-18252.rs:6:13
    |
-LL |     Variant { x: usize }
-   |     -------------------- `Foo::Variant` defined here
-...
 LL |     let f = Foo::Variant(42);
-   |             ^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `Foo::Variant { x: val }`
+   |             ^^^^^^^^^^^^ not a value
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0423`.
+For more information about this error, try `rustc --explain E0533`.
diff --git a/src/test/ui/resolve/issue-19452.stderr b/src/test/ui/resolve/issue-19452.stderr
index 8df84067e67..eff89241fd2 100644
--- a/src/test/ui/resolve/issue-19452.stderr
+++ b/src/test/ui/resolve/issue-19452.stderr
@@ -1,23 +1,15 @@
-error[E0423]: expected value, found struct variant `Homura::Madoka`
+error[E0533]: expected value, found struct variant `Homura::Madoka`
   --> $DIR/issue-19452.rs:10:18
    |
-LL |     Madoka { age: u32 }
-   |     ------------------- `Homura::Madoka` defined here
-...
 LL |     let homura = Homura::Madoka;
-   |                  ^^^^^^^^^^^^^^ help: use struct literal syntax instead: `Homura::Madoka { age: val }`
+   |                  ^^^^^^^^^^^^^^ not a value
 
-error[E0423]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
+error[E0533]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
   --> $DIR/issue-19452.rs:13:18
    |
 LL |     let homura = issue_19452_aux::Homura::Madoka;
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `issue_19452_aux::Homura::Madoka { /* fields */ }`
-   |
-  ::: $DIR/auxiliary/issue-19452-aux.rs:2:5
-   |
-LL |     Madoka { age: u32 }
-   |     ------ `issue_19452_aux::Homura::Madoka` defined here
+   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a value
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0423`.
+For more information about this error, try `rustc --explain E0533`.
diff --git a/src/test/ui/resolve/issue-73427.stderr b/src/test/ui/resolve/issue-73427.stderr
index d31c5e47775..4af5f29d809 100644
--- a/src/test/ui/resolve/issue-73427.stderr
+++ b/src/test/ui/resolve/issue-73427.stderr
@@ -17,16 +17,12 @@ LL | | }
    | |_^
 help: you might have meant to use one of the following enum variants
    |
-LL |     (A::Struct {}).foo();
-   |     ~~~~~~~~~~~~~~
 LL |     (A::Tuple()).foo();
    |     ~~~~~~~~~~~~
 LL |     A::Unit.foo();
    |     ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
    |
-LL |     (A::StructWithFields { /* fields */ }).foo();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 LL |     (A::TupleWithFields(/* fields */)).foo();
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -34,7 +30,7 @@ error[E0423]: expected value, found enum `B`
   --> $DIR/issue-73427.rs:35:5
    |
 LL |     B.foo();
-   |     ^
+   |     ^ help: the following enum variant is available: `(B::TupleWithFields(/* fields */))`
    |
 note: the enum is defined here
   --> $DIR/issue-73427.rs:9:1
@@ -44,12 +40,6 @@ LL | |     StructWithFields { x: () },
 LL | |     TupleWithFields(()),
 LL | | }
    | |_^
-help: the following enum variants are available
-   |
-LL |     (B::StructWithFields { /* fields */ }).foo();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL |     (B::TupleWithFields(/* fields */)).foo();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 error[E0423]: expected value, found enum `C`
   --> $DIR/issue-73427.rs:37:5
@@ -70,10 +60,8 @@ help: you might have meant to use the following enum variant
    |
 LL |     C::Unit.foo();
    |     ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
    |
-LL |     (C::StructWithFields { /* fields */ }).foo();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 LL |     (C::TupleWithFields(/* fields */)).foo();
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -130,7 +118,7 @@ error[E0532]: expected tuple struct or tuple variant, found enum `A`
 LL |     if let A(3) = x { }
    |            ^
    |
-   = help: you might have meant to match against one of the enum's non-tuple variants
+   = help: you might have meant to match against the enum's non-tuple variant
 note: the enum is defined here
   --> $DIR/issue-73427.rs:1:1
    |
@@ -155,7 +143,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found enum `A`
 LL |     let x = A(3);
    |             ^
    |
-   = help: you might have meant to construct one of the enum's non-tuple variants
+   = help: you might have meant to construct the enum's non-tuple variant
 note: the enum is defined here
   --> $DIR/issue-73427.rs:1:1
    |
diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr
index 82a4211f08a..d734fa76b4a 100644
--- a/src/test/ui/resolve/privacy-enum-ctor.stderr
+++ b/src/test/ui/resolve/privacy-enum-ctor.stderr
@@ -19,12 +19,10 @@ help: you might have meant to use the following enum variant
    |
 LL |         m::Z::Unit;
    |         ~~~~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
    |
 LL |         (m::Z::Fn(/* fields */));
    |         ~~~~~~~~~~~~~~~~~~~~~~~~
-LL |         (m::Z::Struct { /* fields */ });
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 error[E0423]: expected value, found enum `Z`
   --> $DIR/privacy-enum-ctor.rs:25:9
@@ -47,23 +45,10 @@ help: you might have meant to use the following enum variant
    |
 LL |         m::Z::Unit;
    |         ~~~~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
    |
 LL |         (m::Z::Fn(/* fields */));
    |         ~~~~~~~~~~~~~~~~~~~~~~~~
-LL |         (m::Z::Struct { /* fields */ });
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-error[E0423]: expected value, found struct variant `Z::Struct`
-  --> $DIR/privacy-enum-ctor.rs:29:20
-   |
-LL | /             Struct {
-LL | |                 s: u8,
-LL | |             },
-   | |_____________- `Z::Struct` defined here
-...
-LL |           let _: Z = Z::Struct;
-   |                      ^^^^^^^^^ help: use struct literal syntax instead: `Z::Struct { s: val }`
 
 error[E0423]: expected value, found enum `m::E`
   --> $DIR/privacy-enum-ctor.rs:41:16
@@ -89,12 +74,10 @@ help: you might have meant to use the following enum variant
    |
 LL |     let _: E = E::Unit;
    |                ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
    |
 LL |     let _: E = (E::Fn(/* fields */));
    |                ~~~~~~~~~~~~~~~~~~~~~
-LL |     let _: E = (E::Struct { /* fields */ });
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 help: a function with a similar name exists
    |
 LL |     let _: E = m::f;
@@ -111,17 +94,6 @@ LL -     let _: E = m::E;
 LL +     let _: E = E;
    |
 
-error[E0423]: expected value, found struct variant `m::E::Struct`
-  --> $DIR/privacy-enum-ctor.rs:45:16
-   |
-LL | /         Struct {
-LL | |             s: u8,
-LL | |         },
-   | |_________- `m::E::Struct` defined here
-...
-LL |       let _: E = m::E::Struct;
-   |                  ^^^^^^^^^^^^ help: use struct literal syntax instead: `m::E::Struct { s: val }`
-
 error[E0423]: expected value, found enum `E`
   --> $DIR/privacy-enum-ctor.rs:49:16
    |
@@ -143,12 +115,10 @@ help: you might have meant to use the following enum variant
    |
 LL |     let _: E = E::Unit;
    |                ~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
    |
 LL |     let _: E = (E::Fn(/* fields */));
    |                ~~~~~~~~~~~~~~~~~~~~~
-LL |     let _: E = (E::Struct { /* fields */ });
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 help: consider importing one of these items instead
    |
 LL | use std::f32::consts::E;
@@ -156,17 +126,6 @@ LL | use std::f32::consts::E;
 LL | use std::f64::consts::E;
    |
 
-error[E0423]: expected value, found struct variant `E::Struct`
-  --> $DIR/privacy-enum-ctor.rs:53:16
-   |
-LL | /         Struct {
-LL | |             s: u8,
-LL | |         },
-   | |_________- `E::Struct` defined here
-...
-LL |       let _: E = E::Struct;
-   |                  ^^^^^^^^^ help: use struct literal syntax instead: `E::Struct { s: val }`
-
 error[E0412]: cannot find type `Z` in this scope
   --> $DIR/privacy-enum-ctor.rs:57:12
    |
@@ -203,12 +162,10 @@ help: you might have meant to use the following enum variant
    |
 LL |     let _: Z = m::Z::Unit;
    |                ~~~~~~~~~~
-help: alternatively, the following enum variants are also available
+help: alternatively, the following enum variant is available
    |
 LL |     let _: Z = (m::Z::Fn(/* fields */));
    |                ~~~~~~~~~~~~~~~~~~~~~~~~
-LL |     let _: Z = (m::Z::Struct { /* fields */ });
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 error[E0412]: cannot find type `Z` in this scope
   --> $DIR/privacy-enum-ctor.rs:61:12
@@ -240,17 +197,6 @@ note: enum `m::Z` exists but is inaccessible
 LL |         pub(in m) enum Z {
    |         ^^^^^^^^^^^^^^^^ not accessible
 
-error[E0423]: expected value, found struct variant `m::n::Z::Struct`
-  --> $DIR/privacy-enum-ctor.rs:64:16
-   |
-LL | /             Struct {
-LL | |                 s: u8,
-LL | |             },
-   | |_____________- `m::n::Z::Struct` defined here
-...
-LL |       let _: Z = m::n::Z::Struct;
-   |                  ^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `m::n::Z::Struct { s: val }`
-
 error[E0412]: cannot find type `Z` in this scope
   --> $DIR/privacy-enum-ctor.rs:68:12
    |
@@ -332,6 +278,12 @@ help: use parentheses to construct this tuple variant
 LL |         let _: Z = Z::Fn(/* u8 */);
    |                         ++++++++++
 
+error[E0533]: expected value, found struct variant `Z::Struct`
+  --> $DIR/privacy-enum-ctor.rs:29:20
+   |
+LL |         let _: Z = Z::Struct;
+   |                    ^^^^^^^^^ not a value
+
 error[E0618]: expected function, found enum variant `Z::Unit`
   --> $DIR/privacy-enum-ctor.rs:31:17
    |
@@ -367,6 +319,12 @@ help: use parentheses to construct this tuple variant
 LL |     let _: E = m::E::Fn(/* u8 */);
    |                        ++++++++++
 
+error[E0533]: expected value, found struct variant `m::E::Struct`
+  --> $DIR/privacy-enum-ctor.rs:45:16
+   |
+LL |     let _: E = m::E::Struct;
+   |                ^^^^^^^^^^^^ not a value
+
 error[E0618]: expected function, found enum variant `m::E::Unit`
   --> $DIR/privacy-enum-ctor.rs:47:16
    |
@@ -402,6 +360,12 @@ help: use parentheses to construct this tuple variant
 LL |     let _: E = E::Fn(/* u8 */);
    |                     ++++++++++
 
+error[E0533]: expected value, found struct variant `E::Struct`
+  --> $DIR/privacy-enum-ctor.rs:53:16
+   |
+LL |     let _: E = E::Struct;
+   |                ^^^^^^^^^ not a value
+
 error[E0618]: expected function, found enum variant `E::Unit`
   --> $DIR/privacy-enum-ctor.rs:55:16
    |
@@ -419,7 +383,13 @@ LL -     let _: E = E::Unit();
 LL +     let _: E = E::Unit;
    |
 
+error[E0533]: expected value, found struct variant `m::n::Z::Struct`
+  --> $DIR/privacy-enum-ctor.rs:64:16
+   |
+LL |     let _: Z = m::n::Z::Struct;
+   |                ^^^^^^^^^^^^^^^ not a value
+
 error: aborting due to 23 previous errors
 
-Some errors have detailed explanations: E0308, E0412, E0423, E0603, E0618.
+Some errors have detailed explanations: E0308, E0412, E0423, E0533, E0603, E0618.
 For more information about an error, try `rustc --explain E0308`.