Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust span labels for HIDDEN_GLOB_REEXPORTS #112413

Merged

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Jun 8, 2023

Addresses #111378 (comment).

Before This PR

The possibility that the private item comes before the glob re-export was not account for, causing the span label messages to say "but private item here shadows it" before "the name Foo in the type namespace is supposed to be publicly re-exported here".

After This PR

warning: private item shadows public glob re-export
  --> $DIR/hidden_glob_reexports.rs:9:5
   |
LL |     struct Foo;
   |     ^^^^^^^^^^^ the private item here shadows the name `Foo` in the type namespace
...
LL |     pub use self::inner::*;
   |             -------------- but it is supposed to be publicly re-exported here
   |
   = note: `#[warn(hidden_glob_reexports)]` on by default

warning: private item shadows public glob re-export
  --> $DIR/hidden_glob_reexports.rs:27:9
   |
LL |     pub use self::inner::*;
   |             -------------- the name `Foo` in the type namespace is supposed to be publicly re-exported here
LL |
LL |     use self::other::Foo;
   |         ^^^^^^^^^^^^^^^^ but the private item here shadows it

@rustbot
Copy link
Collaborator

rustbot commented Jun 8, 2023

r? @eholk

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 8, 2023
@petrochenkov
Copy link
Contributor

There should be some way to reorder these labels without changing the wording.
ping @rust-lang/wg-diagnostics

@jieyouxu
Copy link
Member Author

jieyouxu commented Jun 8, 2023

There should be some way to reorder these labels without changing the wording.

I could just use span_note, it appears a bit more verbose though

warning: private item shadows public glob re-export
  --> tests/ui/resolve/hidden_glob_reexports.rs:9:5
   |
9  |     struct Foo;
   |     ^^^^^^^^^^^
   |
note: the name `Foo` in the type namespace is supposed to be publicly re-exported here
  --> tests/ui/resolve/hidden_glob_reexports.rs:12:13
   |
12 |     pub use self::inner::*;
   |             ^^^^^^^^^^^^^^
note: but the private item here shadows it
  --> tests/ui/resolve/hidden_glob_reexports.rs:9:5
   |
9  |     struct Foo;
   |     ^^^^^^^^^^^
   = note: `#[warn(hidden_glob_reexports)]` on by default

@petrochenkov petrochenkov self-assigned this Jun 10, 2023
@petrochenkov
Copy link
Contributor

Let's convert these messages to notes then.
(But diagnostic infra should support doing this for labels too.)
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 10, 2023
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jun 10, 2023

📌 Commit 80176a1 has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 10, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 10, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#112297 (bootstrap: Disallow `--exclude test::std`)
 - rust-lang#112298 (Update field-offset and enable unstable_offset_of)
 - rust-lang#112335 (ci: Upgrade loongarch64-linux-gnu GCC to 13.1.0)
 - rust-lang#112413 (Adjust span labels for `HIDDEN_GLOB_REEXPORTS`)
 - rust-lang#112483 (Add deprecation warning to python versions <3.6 in x.py)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 312e676 into rust-lang:master Jun 10, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 10, 2023
@estebank
Copy link
Contributor

(But diagnostic infra should support doing this for labels too.)

It's been in our backlog for a while to address this in some mechanized way. For now, we've been manually swapping between span labels and span notes on a case by case basis, like you've done here. Thanks for the ping!

@jieyouxu jieyouxu deleted the fix-hidden-glob-reexports-span-order branch August 16, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants