]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/resolve/privacy-enum-ctor.stderr
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / resolve / privacy-enum-ctor.stderr
index 01e6488de5303ae387ae768a04f3bfb3edebcce7..82a4211f08ac35fe6a5387a4e47552f0d2bf82a7 100644 (file)
 error[E0423]: expected value, found enum `n::Z`
-  --> $DIR/privacy-enum-ctor.rs:33:9
+  --> $DIR/privacy-enum-ctor.rs:23:9
    |
 LL |         n::Z;
    |         ^^^^
    |
-   = note: did you mean to use one of the following variants?
-           - `m::Z::Fn`
-           - `m::Z::Struct`
-           - `m::Z::Unit`
+note: the enum is defined here
+  --> $DIR/privacy-enum-ctor.rs:11:9
+   |
+LL | /         pub(in m) enum Z {
+LL | |             Fn(u8),
+LL | |             Struct {
+LL | |                 s: u8,
+LL | |             },
+LL | |             Unit,
+LL | |         }
+   | |_________^
+help: you might have meant to use the following enum variant
+   |
+LL |         m::Z::Unit;
+   |         ~~~~~~~~~~
+help: alternatively, the following enum variants are also available
+   |
+LL |         (m::Z::Fn(/* fields */));
+   |         ~~~~~~~~~~~~~~~~~~~~~~~~
+LL |         (m::Z::Struct { /* fields */ });
+   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 error[E0423]: expected value, found enum `Z`
-  --> $DIR/privacy-enum-ctor.rs:35:9
+  --> $DIR/privacy-enum-ctor.rs:25:9
    |
 LL |         Z;
-   |         ^ did you mean `f`?
-   |
-   = note: did you mean to use one of the following variants?
-           - `m::Z::Fn`
-           - `m::Z::Struct`
-           - `m::Z::Unit`
+   |         ^
+   |
+note: the enum is defined here
+  --> $DIR/privacy-enum-ctor.rs:11:9
+   |
+LL | /         pub(in m) enum Z {
+LL | |             Fn(u8),
+LL | |             Struct {
+LL | |                 s: u8,
+LL | |             },
+LL | |             Unit,
+LL | |         }
+   | |_________^
+help: you might have meant to use the following enum variant
+   |
+LL |         m::Z::Unit;
+   |         ~~~~~~~~~~
+help: alternatively, the following enum variants are also 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:39:20
+  --> $DIR/privacy-enum-ctor.rs:29:20
    |
-LL |         let _: Z = Z::Struct;
-   |                    ^^^^^^^^^ did you mean `Z::Struct { /* fields */ }`?
+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:51:16
+  --> $DIR/privacy-enum-ctor.rs:41:16
    |
+LL |     fn f() {
+   |     ------ similarly named function `f` defined here
+...
 LL |     let _: E = m::E;
-   |                ^^^-
-   |                   |
-   |                   did you mean `f`?
+   |                ^^^^
+   |
+note: the enum is defined here
+  --> $DIR/privacy-enum-ctor.rs:2:5
+   |
+LL | /     pub enum E {
+LL | |         Fn(u8),
+LL | |         Struct {
+LL | |             s: u8,
+LL | |         },
+LL | |         Unit,
+LL | |     }
+   | |_____^
+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
+   |
+LL |     let _: E = (E::Fn(/* fields */));
+   |                ~~~~~~~~~~~~~~~~~~~~~
+LL |     let _: E = (E::Struct { /* fields */ });
+   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+help: a function with a similar name exists
    |
-   = note: did you mean to use one of the following variants?
-           - `E::Fn`
-           - `E::Struct`
-           - `E::Unit`
-help: possible better candidates are found in other modules, you can import them into scope
+LL |     let _: E = m::f;
+   |                   ~
+help: consider importing one of these items instead
    |
 LL | use std::f32::consts::E;
    |
 LL | use std::f64::consts::E;
    |
+help: if you import `E`, refer to it directly
+   |
+LL -     let _: E = m::E;
+LL +     let _: E = E;
+   |
 
 error[E0423]: expected value, found struct variant `m::E::Struct`
-  --> $DIR/privacy-enum-ctor.rs:55:16
+  --> $DIR/privacy-enum-ctor.rs:45:16
    |
-LL |     let _: E = m::E::Struct;
-   |                ^^^^^^^^^^^^ did you mean `m::E::Struct { /* fields */ }`?
+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:59:16
+  --> $DIR/privacy-enum-ctor.rs:49:16
    |
 LL |     let _: E = E;
    |                ^
    |
-   = note: did you mean to use one of the following variants?
-           - `E::Fn`
-           - `E::Struct`
-           - `E::Unit`
-help: possible better candidates are found in other modules, you can import them into scope
+note: the enum is defined here
+  --> $DIR/privacy-enum-ctor.rs:2:5
+   |
+LL | /     pub enum E {
+LL | |         Fn(u8),
+LL | |         Struct {
+LL | |             s: u8,
+LL | |         },
+LL | |         Unit,
+LL | |     }
+   | |_____^
+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
+   |
+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;
    |
@@ -69,165 +157,269 @@ LL | use std::f64::consts::E;
    |
 
 error[E0423]: expected value, found struct variant `E::Struct`
-  --> $DIR/privacy-enum-ctor.rs:63:16
+  --> $DIR/privacy-enum-ctor.rs:53:16
    |
-LL |     let _: E = E::Struct;
-   |                ^^^^^^^^^ did you mean `E::Struct { /* fields */ }`?
+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:67:12
+  --> $DIR/privacy-enum-ctor.rs:57:12
    |
+LL |     pub enum E {
+   |     ---------- similarly named enum `E` defined here
+...
 LL |     let _: Z = m::n::Z;
-   |            ^ did you mean `E`?
-help: possible candidate is found in another module, you can import it into scope
+   |            ^ help: an enum with a similar name exists: `E`
    |
-LL | use m::n::Z;
+note: enum `m::Z` exists but is inaccessible
+  --> $DIR/privacy-enum-ctor.rs:11:9
    |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^ not accessible
 
 error[E0423]: expected value, found enum `m::n::Z`
-  --> $DIR/privacy-enum-ctor.rs:67:16
+  --> $DIR/privacy-enum-ctor.rs:57:16
    |
 LL |     let _: Z = m::n::Z;
    |                ^^^^^^^
    |
-   = note: did you mean to use one of the following variants?
-           - `m::Z::Fn`
-           - `m::Z::Struct`
-           - `m::Z::Unit`
+note: the enum is defined here
+  --> $DIR/privacy-enum-ctor.rs:11:9
+   |
+LL | /         pub(in m) enum Z {
+LL | |             Fn(u8),
+LL | |             Struct {
+LL | |                 s: u8,
+LL | |             },
+LL | |             Unit,
+LL | |         }
+   | |_________^
+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
+   |
+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:71:12
+  --> $DIR/privacy-enum-ctor.rs:61:12
    |
+LL |     pub enum E {
+   |     ---------- similarly named enum `E` defined here
+...
 LL |     let _: Z = m::n::Z::Fn;
-   |            ^ did you mean `E`?
-help: possible candidate is found in another module, you can import it into scope
+   |            ^ help: an enum with a similar name exists: `E`
    |
-LL | use m::n::Z;
+note: enum `m::Z` exists but is inaccessible
+  --> $DIR/privacy-enum-ctor.rs:11:9
    |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^ not accessible
 
 error[E0412]: cannot find type `Z` in this scope
-  --> $DIR/privacy-enum-ctor.rs:74:12
+  --> $DIR/privacy-enum-ctor.rs:64:12
    |
+LL |     pub enum E {
+   |     ---------- similarly named enum `E` defined here
+...
 LL |     let _: Z = m::n::Z::Struct;
-   |            ^ did you mean `E`?
-help: possible candidate is found in another module, you can import it into scope
+   |            ^ help: an enum with a similar name exists: `E`
    |
-LL | use m::n::Z;
+note: enum `m::Z` exists but is inaccessible
+  --> $DIR/privacy-enum-ctor.rs:11:9
    |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^ not accessible
 
 error[E0423]: expected value, found struct variant `m::n::Z::Struct`
-  --> $DIR/privacy-enum-ctor.rs:74:16
+  --> $DIR/privacy-enum-ctor.rs:64:16
    |
-LL |     let _: Z = m::n::Z::Struct;
-   |                ^^^^^^^^^^^^^^^ did you mean `m::n::Z::Struct { /* fields */ }`?
+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:78:12
+  --> $DIR/privacy-enum-ctor.rs:68:12
    |
+LL |     pub enum E {
+   |     ---------- similarly named enum `E` defined here
+...
 LL |     let _: Z = m::n::Z::Unit {};
-   |            ^ did you mean `E`?
-help: possible candidate is found in another module, you can import it into scope
+   |            ^ help: an enum with a similar name exists: `E`
    |
-LL | use m::n::Z;
+note: enum `m::Z` exists but is inaccessible
+  --> $DIR/privacy-enum-ctor.rs:11:9
    |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^ not accessible
 
 error[E0603]: enum `Z` is private
-  --> $DIR/privacy-enum-ctor.rs:67:22
+  --> $DIR/privacy-enum-ctor.rs:57:22
    |
 LL |     let _: Z = m::n::Z;
-   |                      ^
+   |                      ^ private enum
+   |
+note: the enum `Z` is defined here
+  --> $DIR/privacy-enum-ctor.rs:11:9
+   |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^
 
 error[E0603]: enum `Z` is private
-  --> $DIR/privacy-enum-ctor.rs:71:22
+  --> $DIR/privacy-enum-ctor.rs:61:22
    |
 LL |     let _: Z = m::n::Z::Fn;
-   |                      ^
+   |                      ^ private enum
+   |
+note: the enum `Z` is defined here
+  --> $DIR/privacy-enum-ctor.rs:11:9
+   |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^
 
 error[E0603]: enum `Z` is private
-  --> $DIR/privacy-enum-ctor.rs:74:22
+  --> $DIR/privacy-enum-ctor.rs:64:22
    |
 LL |     let _: Z = m::n::Z::Struct;
-   |                      ^
+   |                      ^ private enum
+   |
+note: the enum `Z` is defined here
+  --> $DIR/privacy-enum-ctor.rs:11:9
+   |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^
 
 error[E0603]: enum `Z` is private
-  --> $DIR/privacy-enum-ctor.rs:78:22
+  --> $DIR/privacy-enum-ctor.rs:68:22
    |
 LL |     let _: Z = m::n::Z::Unit {};
-   |                      ^
+   |                      ^ private enum
+   |
+note: the enum `Z` is defined here
+  --> $DIR/privacy-enum-ctor.rs:11:9
+   |
+LL |         pub(in m) enum Z {
+   |         ^^^^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/privacy-enum-ctor.rs:37:20
+  --> $DIR/privacy-enum-ctor.rs:27:20
    |
+LL |             Fn(u8),
+   |             -- fn(u8) -> Z {Z::Fn} defined here
+...
 LL |         let _: Z = Z::Fn;
-   |                    ^^^^^ expected enum `m::n::Z`, found fn item
+   |                -   ^^^^^ expected enum `Z`, found fn item
+   |                |
+   |                expected due to this
+   |
+   = note: expected enum `Z`
+           found fn item `fn(u8) -> Z {Z::Fn}`
+help: use parentheses to construct this tuple variant
    |
-   = note: expected type `m::n::Z`
-              found type `fn(u8) -> m::n::Z {m::n::Z::Fn}`
+LL |         let _: Z = Z::Fn(/* u8 */);
+   |                         ++++++++++
 
 error[E0618]: expected function, found enum variant `Z::Unit`
-  --> $DIR/privacy-enum-ctor.rs:41:17
+  --> $DIR/privacy-enum-ctor.rs:31:17
    |
 LL |             Unit,
-   |             ---- `Z::Unit` defined here
+   |             ---- enum variant `Z::Unit` defined here
 ...
 LL |         let _ = Z::Unit();
    |                 ^^^^^^^--
    |                 |
    |                 call expression requires function
-help: `Z::Unit` is a unit variant, you need to write it without the parenthesis
    |
-LL |         let _ = Z::Unit;
-   |                 ^^^^^^^
+help: `Z::Unit` is a unit enum variant, and does not take parentheses to be constructed
+   |
+LL -         let _ = Z::Unit();
+LL +         let _ = Z::Unit;
+   |
 
 error[E0308]: mismatched types
-  --> $DIR/privacy-enum-ctor.rs:53:16
+  --> $DIR/privacy-enum-ctor.rs:43:16
    |
+LL |         Fn(u8),
+   |         -- fn(u8) -> E {E::Fn} defined here
+...
 LL |     let _: E = m::E::Fn;
-   |                ^^^^^^^^ expected enum `m::E`, found fn item
+   |            -   ^^^^^^^^ expected enum `E`, found fn item
+   |            |
+   |            expected due to this
+   |
+   = note: expected enum `E`
+           found fn item `fn(u8) -> E {E::Fn}`
+help: use parentheses to construct this tuple variant
    |
-   = note: expected type `m::E`
-              found type `fn(u8) -> m::E {m::E::Fn}`
+LL |     let _: E = m::E::Fn(/* u8 */);
+   |                        ++++++++++
 
 error[E0618]: expected function, found enum variant `m::E::Unit`
-  --> $DIR/privacy-enum-ctor.rs:57:16
+  --> $DIR/privacy-enum-ctor.rs:47:16
    |
 LL |         Unit,
-   |         ---- `m::E::Unit` defined here
+   |         ---- enum variant `m::E::Unit` defined here
 ...
 LL |     let _: E = m::E::Unit();
    |                ^^^^^^^^^^--
    |                |
    |                call expression requires function
-help: `m::E::Unit` is a unit variant, you need to write it without the parenthesis
    |
-LL |     let _: E = m::E::Unit;
-   |                ^^^^^^^^^^
+help: `m::E::Unit` is a unit enum variant, and does not take parentheses to be constructed
+   |
+LL -     let _: E = m::E::Unit();
+LL +     let _: E = m::E::Unit;
+   |
 
 error[E0308]: mismatched types
-  --> $DIR/privacy-enum-ctor.rs:61:16
+  --> $DIR/privacy-enum-ctor.rs:51:16
    |
+LL |         Fn(u8),
+   |         -- fn(u8) -> E {E::Fn} defined here
+...
 LL |     let _: E = E::Fn;
-   |                ^^^^^ expected enum `m::E`, found fn item
+   |            -   ^^^^^ expected enum `E`, found fn item
+   |            |
+   |            expected due to this
    |
-   = note: expected type `m::E`
-              found type `fn(u8) -> m::E {m::E::Fn}`
+   = note: expected enum `E`
+           found fn item `fn(u8) -> E {E::Fn}`
+help: use parentheses to construct this tuple variant
+   |
+LL |     let _: E = E::Fn(/* u8 */);
+   |                     ++++++++++
 
 error[E0618]: expected function, found enum variant `E::Unit`
-  --> $DIR/privacy-enum-ctor.rs:65:16
+  --> $DIR/privacy-enum-ctor.rs:55:16
    |
 LL |         Unit,
-   |         ---- `E::Unit` defined here
+   |         ---- enum variant `E::Unit` defined here
 ...
 LL |     let _: E = E::Unit();
    |                ^^^^^^^--
    |                |
    |                call expression requires function
-help: `E::Unit` is a unit variant, you need to write it without the parenthesis
    |
-LL |     let _: E = E::Unit;
-   |                ^^^^^^^
+help: `E::Unit` is a unit enum variant, and does not take parentheses to be constructed
+   |
+LL -     let _: E = E::Unit();
+LL +     let _: E = E::Unit;
+   |
 
 error: aborting due to 23 previous errors
 
-Some errors occurred: E0308, E0412, E0423, E0603, E0618.
+Some errors have detailed explanations: E0308, E0412, E0423, E0603, E0618.
 For more information about an error, try `rustc --explain E0308`.