Skip to content

resolve: Fix a false positive "cannot reexport" error for ambiguous glob sets - #156284

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
petrochenkov:kvak2
May 12, 2026
Merged

resolve: Fix a false positive "cannot reexport" error for ambiguous glob sets#156284
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
petrochenkov:kvak2

Conversation

@petrochenkov

Copy link
Copy Markdown
Contributor

Fixes#156264.

@rustbotrustbot 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 May 7, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
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 73 candidates
  • Random selection from 18 candidates

@rustbot

Copy link
Copy Markdown
Collaborator

⚠️Warning⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@petrochenkov

Copy link
Copy Markdown
ContributorAuthor

The proper fix requires landing #149195 first, and may potentially cause some performance issues.

@petrochenkov

Copy link
Copy Markdown
ContributorAuthor

r? @mu001999

@rustbotrustbot assigned mu001999 and unassigned JohnTitorMay 12, 2026
@mu001999

This comment was marked as outdated.

1 similar comment
@mu001999

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-borsBot commented May 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 235fa6b has been approved by mu001999

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@rust-borsrust-borsBot 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 May 12, 2026
rust-borsBot pushed a commit that referenced this pull request May 12, 2026
…uwer
Rollup of 6 pull requests
Successful merges:
- #156287 (move more compiler crates away from `box_patterns` )
- #156428 (Move `std::io::Cursor` to `core::io`)
- #156431 (Move `std::io::util` to `core::io`)
- #156145 (Move tests cast)
- #156284 (resolve: Fix a false positive "cannot reexport" error for ambiguous glob sets)
- #156502 (Give an example of a Ctor in the doc-comments)
rust-borsBot pushed a commit that referenced this pull request May 12, 2026
…uwer
Rollup of 6 pull requests
Successful merges:
- #156287 (move more compiler crates away from `box_patterns` )
- #156428 (Move `std::io::Cursor` to `core::io`)
- #156431 (Move `std::io::util` to `core::io`)
- #156145 (Move tests cast)
- #156284 (resolve: Fix a false positive "cannot reexport" error for ambiguous glob sets)
- #156502 (Give an example of a Ctor in the doc-comments)
@rust-bors
rust-borsBot merged commit 63322d0 into rust-lang:mainMay 12, 2026
11 checks passed
@rustbotrustbot added this to the 1.97.0 milestone May 12, 2026
rust-timer added a commit that referenced this pull request May 12, 2026
Rollup merge of #156284 - petrochenkov:kvak2, r=mu001999
resolve: Fix a false positive "cannot reexport" error for ambiguous glob sets
Fixes#156264.
@Mark-Simulacrum

Copy link
Copy Markdown
Member

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (27617b5): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.9%[-1.0%, -0.8%]6
All ❌✅ (primary)--0

Max RSS (memory usage)

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

Cycles

Results (primary -2.3%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-2.3%[-2.3%, -2.3%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-2.3%[-2.3%, -2.3%]1

Binary size

Results (secondary 0.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.1%[0.1%, 0.1%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Bootstrap: 510.527s -> 508.407s (-0.42%)
Artifact size: 400.06 MiB -> 400.06 MiB (-0.00%)

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 10, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 10, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 10, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 10, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
rust-borsBot pushed a commit that referenced this pull request Jul 13, 2026
…petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixes#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every #154149 / #156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 13, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
rust-borsBot pushed a commit that referenced this pull request Jul 13, 2026
…petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixes#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every #154149 / #156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 13, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 13, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
rust-borsBot pushed a commit that referenced this pull request Jul 13, 2026
…petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixes#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every #154149 / #156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 14, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
rust-borsBot pushed a commit that referenced this pull request Jul 14, 2026
…petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixes#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every #154149 / #156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 14, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 14, 2026
…biguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixesrust-lang#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
rust-borsBot pushed a commit that referenced this pull request Jul 14, 2026
…petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixes#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every #154149 / #156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
rust-timer added a commit that referenced this pull request Jul 14, 2026
Rollup merge of #159039 - calvinrp:fix/effective-vis-glob-ambiguity, r=petrochenkov
resolve: fix effective visibilities for items in ambiguous glob sets
Fixes#159038 (1.96.1 → 1.97.0 regression; details there).
When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.
Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every #154149 / #156284 test unmodified.
@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

E0365 newly triggers on pub(crate) reexports (cannot be re-exported outside)

6 participants

@petrochenkov@rustbot@mu001999@Mark-Simulacrum@rust-timer@JohnTitor