Repository navigation
Tweak private re-export errors to point at correct span and have more context - #164218
Conversation
|
r? @tiif rustbot has assigned @tiif. Use Why was this reviewer chosen?The reviewer was selected based on:
|
pub| note: consider marking `V` as `pub` in the imported variant | ||
| --> $DIR/private-variant-reexport.rs:21:10 |
There was a problem hiding this comment.
Is the change from imported module to imported variant intended? I am a bit confused because I interpret this as there is a variant being imported, and we need to mark V as pub within that imported variant 🤔
There was a problem hiding this comment.
Addressed: changed to "the imported enum".
|
Reminder, once the PR becomes ready for a review, use |
4876bb9 to
a6abf4f
Compare
This comment has been minimized.
This comment has been minimized.
…uwer Rollup of 16 pull requests Successful merges: - #165575 (Upgrade bundled musl to 1.2.6) - #163992 (add `core::arch::{x86, x86_64}::x87_f80`) - #165117 (std: use skip_unsupported_miri_tests to control when tests should be skipped in Miri due to missing shims) - #165458 (fix incorrect byte count suffix on MSVC) - #165487 (Migrate built-in macros `pattern_type` & `view_type` to macros 2.0 that expand to internal syntax) - #165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - #165586 (Remove `backend_optimization_level`.) - #165646 (fix NumScalableVectors::from_field_count) - #165655 (Unignore passing GCC backend tests) - #165740 (miri subtree update) - #164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - #165682 (interpret: ensure newly created unions have uninit in their padding) - #165693 (Move `check_attr` to attribute parsing) - #165715 (windows: check for null before wide encoding) - #165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - #165733 (docs(num): remove needless whitespaces) Failed merges: - #165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - #153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - #164218 (Tweak private re-export errors to point at correct span and have more context) - #165709 (remove 'x miri' smoke test from PR CI)
…uwer Rollup of 16 pull requests Successful merges: - #165575 (Upgrade bundled musl to 1.2.6) - #163992 (add `core::arch::{x86, x86_64}::x87_f80`) - #165117 (std: use skip_unsupported_miri_tests to control when tests should be skipped in Miri due to missing shims) - #165458 (fix incorrect byte count suffix on MSVC) - #165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - #165586 (Remove `backend_optimization_level`.) - #165646 (fix NumScalableVectors::from_field_count) - #165655 (Unignore passing GCC backend tests) - #165740 (miri subtree update) - #153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - #164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - #165682 (interpret: ensure newly created unions have uninit in their padding) - #165693 (Move `check_attr` to attribute parsing) - #165715 (windows: check for null before wide encoding) - #165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - #165733 (docs(num): remove needless whitespaces) Failed merges: - #165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - #164218 (Tweak private re-export errors to point at correct span and have more context) - #165709 (remove 'x miri' smoke test from PR CI)
…uwer Rollup of 24 pull requests Successful merges: - #165709 (remove 'x miri' smoke test from PR CI) - #164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - #165569 (`Move` trait feature gate) - #165575 (Upgrade bundled musl to 1.2.6) - #163241 (Add enclosing item context when pointing at `FnMut` bound) - #163992 (add `core::arch::{x86, x86_64}::x87_f80`) - #165047 (Change the span building of paths from first-to-last to chained) - #165458 (fix incorrect byte count suffix on MSVC) - #165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - #165586 (Remove `backend_optimization_level`.) - #165646 (fix NumScalableVectors::from_field_count) - #165655 (Unignore passing GCC backend tests) - #165740 (miri subtree update) - #165753 (avoid Terminator:None in MIR inliner) - #153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - #164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - #165562 (stop using gce in a test) - #165681 (Add safety requirements for Pattern and Searcher) - #165682 (interpret: ensure newly created unions have uninit in their padding) - #165693 (Move `check_attr` to attribute parsing) - #165715 (windows: check for null before wide encoding) - #165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - #165733 (docs(num): remove needless whitespaces) - #165739 (remove NOP File::flush from fs tests) Failed merges: - #165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - #164218 (Tweak private re-export errors to point at correct span and have more context)
…uwer Rollup of 24 pull requests Successful merges: - #165709 (remove 'x miri' smoke test from PR CI) - #164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - #165569 (`Move` trait feature gate) - #165575 (Upgrade bundled musl to 1.2.6) - #163241 (Add enclosing item context when pointing at `FnMut` bound) - #163992 (add `core::arch::{x86, x86_64}::x87_f80`) - #165047 (Change the span building of paths from first-to-last to chained) - #165458 (fix incorrect byte count suffix on MSVC) - #165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - #165586 (Remove `backend_optimization_level`.) - #165646 (fix NumScalableVectors::from_field_count) - #165655 (Unignore passing GCC backend tests) - #165740 (miri subtree update) - #165753 (avoid Terminator:None in MIR inliner) - #153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - #164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - #165562 (stop using gce in a test) - #165681 (Add safety requirements for Pattern and Searcher) - #165682 (interpret: ensure newly created unions have uninit in their padding) - #165693 (Move `check_attr` to attribute parsing) - #165715 (windows: check for null before wide encoding) - #165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - #165733 (docs(num): remove needless whitespaces) - #165739 (remove NOP File::flush from fs tests) Failed merges: - #165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - #164218 (Tweak private re-export errors to point at correct span and have more context)
This comment has been minimized.
This comment has been minimized.
```
error[E0364]: `f` is private, and cannot be re-exported
--> $DIR/privacy-early.rs:10:13
|
LL | pub macro m() {
LL | use f as g;
| ^^^^^^
...
LL | foo::m!();
| --------- in this macro invocation
|
note: consider marking `f` as `pub` in the imported module
--> $DIR/privacy-early.rs:6:5
|
LL | fn f() {}
| ^^^^^^^^^
```
where it was
```
error[E0364]: `f` is private, and cannot be re-exported
--> $DIR/privacy-early.rs:10:13
|
LL | pub macro m() {
LL | use f as g;
| ^^^^^^
...
LL | foo::m!();
| --------- in this macro invocation
|
note: consider marking `f` as `pub` in the imported module
--> $DIR/privacy-early.rs:10:13
|
LL | use f as g;
| ^^^^^^
...
LL | foo::m!();
| --------- in this macro invocation
```
Use span when suggesting making module public:
```
note: consider declaring module `foo` with `pub`
--> $DIR/E0365.rs:1:1
|
LL | / mod foo {
LL | | pub const X: u32 = 1;
LL | | }
| |_^
```
Show container when talking about enclosing module:
```
note: consider marking `f` as `pub` in the imported module
--> $DIR/privacy-early.rs:6:5
|
LL | mod foo {
LL | fn f() {}
| ^^^^^^^^^
```
Use accurate descriptor for enclosing item:
```
note: consider declaring struct `S1` with `pub`
--> $DIR/crate-private-reexport.rs:3:1
|
LL | / struct S1 {
LL | | #[rustfmt::skip]
LL | | bar: i32,
LL | | }
| |_^
```
```
note: consider marking `Full` as `pub` in the imported variant
--> $DIR/issue-46209-private-enum-variant-reexport.rs:26:9
|
LL | enum Lieutenant {
LL | JuniorGrade,
LL | Full,
| ^^^^
```
a6abf4f to
bef8da0
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=tiif |
Rollup of 9 pull requests Successful merges: - #165117 (std: use skip_unsupported_miri_tests to control when tests should be skipped in Miri due to missing shims) - #165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - #165750 (Wrap proc-macro `EscapeError` enum into a struct) - #164218 (Tweak private re-export errors to point at correct span and have more context) - #165021 (In irrefutable patterns, the FieldPat is skipped, which means the name: field is not printed) - #165537 (Canonicalization cleanups) - #165772 (Remove unnecessary mut from HirIdValidator::check_nested_id) - #165779 (make improper_ctypes accept `x87_f80`) - #165780 (std: map more errno values to ErrorKind on Hermit)
Rollup merge of #164218 - estebank:priv-span-fix, r=tiif Tweak private re-export errors to point at correct span and have more context Use the correct span when talking about imported module that should be marked as public: ``` error[E0364]: `f` is private, and cannot be re-exported --> $DIR/privacy-early.rs:10:13 | LL | pub macro m() { LL | use f as g; | ^^^^^^ ... LL | foo::m!(); | --------- in this macro invocation | note: consider marking `f` as `pub` in the imported module --> $DIR/privacy-early.rs:6:5 | LL | fn f() {} | ^^^^^^^^^ ``` where it was: ``` error[E0364]: `f` is private, and cannot be re-exported --> $DIR/privacy-early.rs:10:13 | LL | pub macro m() { LL | use f as g; | ^^^^^^ ... LL | foo::m!(); | --------- in this macro invocation | note: consider marking `f` as `pub` in the imported module --> $DIR/privacy-early.rs:10:13 | LL | use f as g; | ^^^^^^ ... LL | foo::m!(); | --------- in this macro invocation ``` Use span when suggesting making module public: ``` note: consider declaring module `foo` with `pub` --> $DIR/E0365.rs:1:1 | LL | / mod foo { LL | | pub const X: u32 = 1; LL | | } | |_^ ``` Show container when talking about enclosing module: ``` note: consider marking `f` as `pub` in the imported module --> $DIR/privacy-early.rs:6:5 | LL | mod foo { LL | fn f() {} | ^^^^^^^^^ ``` Use accurate descriptor for enclosing item: ``` note: consider declaring struct `S1` with `pub` --> $DIR/crate-private-reexport.rs:3:1 | LL | / struct S1 { LL | | #[rustfmt::skip] LL | | bar: i32, LL | | } | |_^ ``` ``` note: consider marking `Full` as `pub` in the imported variant --> $DIR/issue-46209-private-enum-variant-reexport.rs:26:9 | LL | enum Lieutenant { LL | JuniorGrade, LL | Full, | ^^^^ ```
Use the correct span when talking about imported module that should be marked as public:
where it was:
Use span when suggesting making module public:
Show container when talking about enclosing module:
Use accurate descriptor for enclosing item: