Uh oh!
There was an error while loading. Please reload this page.
resolve: Extend ambiguous_import_visibilities deprecation lint to glob-vs-glob ambiguities - #154149
Conversation
Uh oh!
There was an error while loading. Please reload this page.
| tcx, | ||
| ); | ||
| if let Some(max_vis_decl) = decl.ambiguity_vis_max.get() { | ||
| // Avoid the most visible import in an ambiguous glob set being reported as unused. |
| if let Some(binding) = resolution.binding() | ||
| && old_decl != Some(binding) | ||
| && (old_decl != Some(binding) || old_vis != Some(binding.vis())) |
There was a problem hiding this comment.
And this is a fix for #152347.
Here we are triggering the glob re-fetching on visibility updates.
This comment has been minimized.
This comment has been minimized.
petrochenkov
commented
Mar 20, 2026
@bors try |
This comment has been minimized.
This comment has been minimized.
resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities
This comment has been minimized.
This comment has been minimized.
petrochenkov
commented
Mar 20, 2026
@craterbot check |
craterbot
commented
Mar 20, 2026
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
craterbot
commented
Mar 28, 2026
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
craterbot
commented
Mar 30, 2026
🎉 Experiment
Footnotes
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
petrochenkov
commented
Apr 30, 2026
libc is a stress test for imports, and we are now doing more work to check imports for visibility ambiguities. |
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
panstromek
commented
May 5, 2026
perf triage: Marking as triaged based on the comment above. @rustbot label: +perf-regression-triaged |
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
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
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
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
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
View all comments
Continuation of #149596, implementation of this comment #149596 (comment) in particular.
FCP for the lint in general - #149596 (comment).
#152498 is reverted as a part of the change, but fixes are applied to keep the tests added in that PR working.
To implement this we have to have to track the most and the least visible declarations in an ambiguous glob set.
Part of #153961.
r? @yaahc maybe