rust/compiler/rustc_resolve/src
Esteban Küber 8f7d61b9ef Detect unconstructable re-exported tuple structs
When a tuple-struct is re-exported that has inaccessible fields at the `use` scope, the type's constructor cannot be accessed through that re-export. We now account for this case and extend the resulting resolution error. We also check if the constructor would be accessible directly, not through the re-export, and if so, we suggest using the full path instead.

```
error[E0423]: cannot initialize a tuple struct which contains private fields
  --> $DIR/ctor-not-accessible-due-to-inaccessible-field-in-reexport.rs:12:33
   |
LL |             let crate::Foo(x) = crate::Foo(42);
   |                                 ^^^^^^^^^^
   |
note: the type is accessed through this re-export, but the type's constructor is not visible in this import's scope due to private fields
  --> $DIR/ctor-not-accessible-due-to-inaccessible-field-in-reexport.rs:3:9
   |
LL | pub use my_mod::Foo;
   |         ^^^^^^^^^^^
help: the type can be constructed directly, because its fields are available from the current scope
   |
LL |             let crate::Foo(x) = crate::my_mod::Foo(42);
   |                                 ~~~~~~~~~~~~~~~~~~
```

Fix #133343.
2025-09-28 21:33:34 +00:00
..
late Detect unconstructable re-exported tuple structs 2025-09-28 21:33:34 +00:00
rustdoc Update tests to work with new DocFragment field and redundant_explicit_links new API 2025-06-23 16:02:34 +02:00
build_reduced_graph.rs Introduce and use CmCell during import resolution. 2025-09-25 18:38:36 +02:00
check_unused.rs Move more early buffered lints to dyn lint diagnostics (3/N) 2025-09-14 12:38:12 +02:00
def_collector.rs Pass the target type down to parse_attribute_list 2025-08-14 18:11:56 +02:00
diagnostics.rs Move more early buffered lints to dyn lint diagnostics (1/N) 2025-09-14 12:38:11 +02:00
effective_visibilities.rs resolve: Minimize borrow scopes for resolutions 2025-07-26 00:19:12 +03:00
errors.rs Move more early buffered lints to dyn lint diagnostics (3/N) 2025-09-14 12:38:12 +02:00
ident.rs Detect unconstructable re-exported tuple structs 2025-09-28 21:33:34 +00:00
imports.rs Rollup merge of #146283 - LorrensP-2158466:resolve-cm-cell, r=petrochenkov 2025-09-26 06:36:30 +02:00
late.rs Move more early buffered lints to dyn lint diagnostics (3/N) 2025-09-14 12:38:12 +02:00
lib.rs Detect unconstructable re-exported tuple structs 2025-09-28 21:33:34 +00:00
macros.rs Rollup merge of #146283 - LorrensP-2158466:resolve-cm-cell, r=petrochenkov 2025-09-26 06:36:30 +02:00
rustdoc.rs Add new doc(attribute = "...") attribute 2025-08-28 15:56:29 +02:00