rust/tests/ui/privacy/suggest-box-new.stderr
Esteban Küber 42aa1273b0 When encountering struct fn call literal with private fields, suggest all builders
When encountering code like `Box(42)`, suggest `Box::new(42)` and *all*
other associated functions that return `-> Box<T>`.
2023-11-19 17:47:41 +00:00

28 lines
897 B
Plaintext

error[E0423]: cannot initialize a tuple struct which contains private fields
--> $DIR/suggest-box-new.rs:8:19
|
LL | wtf: Some(Box(U {
| ^^^
|
note: constructor is not visible here due to private fields
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
= note: private field
|
= note: private field
help: you might have meant to use an associated function to build this type
|
LL | wtf: Some(Box::new(U {
| +++++
LL | wtf: Some(Box::new_uninit_in(U {
| +++++++++++++++
LL | wtf: Some(Box::new_zeroed_in(U {
| +++++++++++++++
LL | wtf: Some(Box::new_uninit_slice(U {
| ++++++++++++++++++
and 10 other candidates
error: aborting due to previous error
For more information about this error, try `rustc --explain E0423`.