Skip to content

resolve: Make sure visibilities of import declarations make sense#155213

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
petrochenkov:importvis
Apr 20, 2026
Merged

resolve: Make sure visibilities of import declarations make sense#155213
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
petrochenkov:importvis

Conversation

@petrochenkov

@petrochenkov petrochenkov commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

View all comments

That they are all ordered inside the module and not more private than the module itself.

The import_decl_vis logic is also reused when reporting ambiguous_import_visibilities lint.
Some asserts are hardened.
Some relevant tests are added.

Extracted from #154149.

@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 Apr 12, 2026
@rustbot

rustbot commented Apr 12, 2026

Copy link
Copy Markdown
Collaborator

r? @jdonszelmann

rustbot has assigned @jdonszelmann.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 11 candidates

@petrochenkov

Copy link
Copy Markdown
Contributor Author

cc @yaahc

@petrochenkov

Copy link
Copy Markdown
Contributor Author

To make sure the asserts are not expensive.
@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 12, 2026
resolve: Make sure visibilities of import declarations make sense
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 12, 2026
@rust-bors

rust-bors Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 89a90f3 (89a90f39ff9b6aadf1ca3a80a26c38deb2592682, parent: 14196dbfa3eb7c30195251eac092b1b86c8a2d84)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (89a90f3): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary 1.5%, secondary -6.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.7% [-6.7%, -6.7%] 1
All ❌✅ (primary) 1.5% [1.5%, 1.5%] 1

Cycles

Results (primary -2.6%, secondary 11.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
11.4% [2.7%, 25.8%] 3
Improvements ✅
(primary)
-2.6% [-3.0%, -2.3%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.6% [-3.0%, -2.3%] 2

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 491.114s -> 490.825s (-0.06%)
Artifact size: 394.23 MiB -> 394.30 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 12, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@petrochenkov

Copy link
Copy Markdown
Contributor Author

r? @mu001999
@bors rollup=maybe

@rustbot rustbot assigned mu001999 and unassigned jdonszelmann Apr 16, 2026
@rustbot

rustbot commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

mu001999 is currently at their maximum review capacity.
They may take a while to respond.

@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@jdonszelmann

Copy link
Copy Markdown
Contributor

@rustbot reroll

@rust-bors

This comment has been minimized.

Comment thread tests/ui/imports/ambiguous-import-visibility-globglob-priv.rs Outdated
That they are all ordered inside the module and not more private than the module itself
The `import_decl_vis` logic is reused when reporting `ambiguous_import_visibilities` lint
Some asserts are hardened
Some relevant tests are added
@rustbot

rustbot commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

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.

@petrochenkov

Copy link
Copy Markdown
Contributor Author

Rebased and updated.

@mu001999

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 394c717 has been approved by mu001999

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-review Status: Awaiting review from the assignee but also interested parties. labels Apr 20, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 20, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #154654 (Move `std::io::ErrorKind` to `core::io`)
 - #145270 (Fix an ICE observed with an explicit tail-call in a default trait method)
 - #154895 (borrowck: Apply `user_arg_index` nomenclature more broadly)
 - #155213 (resolve: Make sure visibilities of import declarations make sense)
 - #155346 (`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`)
 - #155517 (Add a test for Mach-O `#[link_section]` API inherited from LLVM)
 - #155549 (Remove some unnecessary lifetimes.)
 - #154248 (resolve :  mark repr_simd as internal)
 - #154772 (slightly optimize the `non-camel-case-types` lint)
 - #155541 (Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`)
 - #155544 (bootstrap: Make "detected modifications" for download-rustc less verbose)
@rust-bors rust-bors Bot merged commit d839949 into rust-lang:main Apr 20, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 20, 2026
rust-timer added a commit that referenced this pull request Apr 20, 2026
Rollup merge of #155213 - petrochenkov:importvis, r=mu001999

resolve: Make sure visibilities of import declarations make sense

That they are all ordered inside the module and not more private than the module itself.

The `import_decl_vis` logic is also reused when reporting `ambiguous_import_visibilities` lint.
Some asserts are hardened.
Some relevant tests are added.

Extracted from #154149.
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 21, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#154654 (Move `std::io::ErrorKind` to `core::io`)
 - rust-lang/rust#145270 (Fix an ICE observed with an explicit tail-call in a default trait method)
 - rust-lang/rust#154895 (borrowck: Apply `user_arg_index` nomenclature more broadly)
 - rust-lang/rust#155213 (resolve: Make sure visibilities of import declarations make sense)
 - rust-lang/rust#155346 (`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`)
 - rust-lang/rust#155517 (Add a test for Mach-O `#[link_section]` API inherited from LLVM)
 - rust-lang/rust#155549 (Remove some unnecessary lifetimes.)
 - rust-lang/rust#154248 (resolve :  mark repr_simd as internal)
 - rust-lang/rust#154772 (slightly optimize the `non-camel-case-types` lint)
 - rust-lang/rust#155541 (Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`)
 - rust-lang/rust#155544 (bootstrap: Make "detected modifications" for download-rustc less verbose)
jhpratt added a commit to jhpratt/rust that referenced this pull request May 5, 2026
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging rust-lang#155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from rust-lang#155257, rust-lang#155213, rust-lang#154149, etc.

r? @mu001999
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 5, 2026
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging rust-lang#155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from rust-lang#155257, rust-lang#155213, rust-lang#154149, etc.

r? @mu001999
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 5, 2026
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging rust-lang#155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from rust-lang#155257, rust-lang#155213, rust-lang#154149, etc.

r? @mu001999
rust-timer added a commit that referenced this pull request May 5, 2026
Rollup merge of #156014 - petrochenkov:kvak, r=mu001999

resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging #155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from #155257, #155213, #154149, etc.

r? @mu001999
ChayimFriedman2 pushed a commit to ChayimFriedman2/rust-analyzer that referenced this pull request May 11, 2026
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging rust-lang/rust#155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from rust-lang/rust#155257, rust-lang/rust#155213, rust-lang/rust#154149, etc.

r? @mu001999
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