Skip to content

resolve: Turn deprecation lints pub_use_of_private_extern_crate and private_macro_use into hard errors#155945

Open
petrochenkov wants to merge 1 commit intorust-lang:mainfrom
petrochenkov:moreslint
Open

resolve: Turn deprecation lints pub_use_of_private_extern_crate and private_macro_use into hard errors#155945
petrochenkov wants to merge 1 commit intorust-lang:mainfrom
petrochenkov:moreslint

Conversation

@petrochenkov
Copy link
Copy Markdown
Contributor

Closes #127909
Closes #120192
Closes #136820

TODO: crater run and description.

@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 28, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 28, 2026

r? @davidtwco

rustbot has assigned @davidtwco.
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 20 candidates

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
resolve: Turn deprecation lints `pub_use_of_private_extern_crate` and `private_macro_use` into hard errors
@petrochenkov petrochenkov added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 28, 2026
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job pr-check-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Build completed successfully in 0:00:00
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
skipping rustc download with `download-rustc = 'if-unchanged'` due to local changes
##[group]Checking stage1 compiler artifacts{rustc-main, rustc_abi, rustc_arena, rustc_ast, rustc_ast_ir, rustc_ast_lowering, rustc_ast_passes, rustc_ast_pretty, rustc_attr_parsing, rustc_baked_icu_data, rustc_borrowck, rustc_builtin_macros, rustc_codegen_llvm, rustc_codegen_ssa, rustc_const_eval, rustc_data_structures, rustc_driver, rustc_driver_impl, rustc_error_codes, rustc_error_messages, rustc_errors, rustc_expand, rustc_feature, rustc_fs_util, rustc_graphviz, rustc_hashes, rustc_hir, rustc_hir_analysis, rustc_hir_id, rustc_hir_pretty, rustc_hir_typeck, rustc_incremental, rustc_index, rustc_index_macros, rustc_infer, rustc_interface, rustc_lexer, rustc_lint, rustc_lint_defs, rustc_llvm, rustc_log, rustc_macros, rustc_metadata, rustc_middle, rustc_mir_build, rustc_mir_dataflow, rustc_mir_transform, rustc_monomorphize, rustc_next_trait_solver, rustc_parse, rustc_parse_format, rustc_passes, rustc_pattern_analysis, rustc_privacy, rustc_proc_macro, rustc_public, rustc_public_bridge, rustc_query_impl, rustc_resolve, rustc_sanitizers, rustc_serialize, rustc_session, rustc_span, rustc_symbol_mangling, rustc_target, rustc_thread_pool, rustc_trait_selection, rustc_traits, rustc_transmute, rustc_ty_utils, rustc_type_ir, rustc_type_ir_macros, rustc_windows_rc} (stage0 -> stage1, x86_64-unknown-linux-gnu)
##[endgroup]
##[group]Checking stage1 compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
##[endgroup]
##[group]Checking stage1 rustdoc (stage0 -> stage1, x86_64-unknown-linux-gnu)
---
    |
131 -                 hir_def::layout::IntegerType::Fixed(size, signed) => match signed {
131 +                 crate::rustc_abi::IntegerType::Fixed(size, signed) => match signed {
    |
131 -                 hir_def::layout::IntegerType::Fixed(size, signed) => match signed {
131 +                 ra_ap_rustc_abi::IntegerType::Fixed(size, signed) => match signed {
    |

error[E0603]: crate `layout` is private
   --> src/tools/rust-analyzer/crates/hir-ty/src/utils.rs:136:18
    |
---

error[E0603]: crate `layout` is private
   --> src/tools/rust-analyzer/crates/hir-ty/src/utils.rs:140:18
    |
140 |         hir_def::layout::Variants::Multiple { tag, tag_encoding, variants, .. } => {
    |                  ^^^^^^ private crate
    |
note: the crate `layout` is defined here
   --> src/tools/rust-analyzer/crates/hir-def/src/lib.rs:50:9
    |
 50 | pub use rustc_abi as layout;
    |         ^^^^^^^^^
help: consider importing one of these variants instead
    |
140 -         hir_def::layout::Variants::Multiple { tag, tag_encoding, variants, .. } => {
140 +         crate::rustc_abi::Variants::Multiple { tag, tag_encoding, variants, .. } => {
    |
140 -         hir_def::layout::Variants::Multiple { tag, tag_encoding, variants, .. } => {
140 +         ra_ap_rustc_abi::Variants::Multiple { tag, tag_encoding, variants, .. } => {
    |

error[E0603]: crate `layout` is private
  --> src/tools/rust-analyzer/crates/hir-ty/src/layout.rs:73:33
   |
73 | pub type TagEncoding = hir_def::layout::TagEncoding<RustcEnumVariantIdx>;
   |                                 ^^^^^^ private crate
   |
note: the crate `layout` is defined here
  --> src/tools/rust-analyzer/crates/hir-def/src/lib.rs:50:9
   |
50 | pub use rustc_abi as layout;
   |         ^^^^^^^^^
help: consider importing one of these enums instead
   |
73 - pub type TagEncoding = hir_def::layout::TagEncoding<RustcEnumVariantIdx>;
73 + pub type TagEncoding = crate::rustc_abi::TagEncoding<RustcEnumVariantIdx>;
   |
73 - pub type TagEncoding = hir_def::layout::TagEncoding<RustcEnumVariantIdx>;
73 + pub type TagEncoding = ra_ap_rustc_abi::TagEncoding<RustcEnumVariantIdx>;
   |

error[E0603]: crate `layout` is private
  --> src/tools/rust-analyzer/crates/hir-ty/src/layout.rs:74:30
   |
74 | pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx>;
   |                              ^^^^^^ private crate
   |
note: the crate `layout` is defined here
  --> src/tools/rust-analyzer/crates/hir-def/src/lib.rs:50:9
   |
50 | pub use rustc_abi as layout;
   |         ^^^^^^^^^
help: consider importing one of these enums instead
   |
74 - pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx>;
74 + pub type Variants = crate::rustc_abi::Variants<RustcFieldIdx, RustcEnumVariantIdx>;
   |
74 - pub type Variants = hir_def::layout::Variants<RustcFieldIdx, RustcEnumVariantIdx>;
74 + pub type Variants = ra_ap_rustc_abi::Variants<RustcFieldIdx, RustcEnumVariantIdx>;
   |

[RUSTC-TIMING] proc_macro_srv test:false 1.118
    Checking proc-macro-api v0.0.0 (/checkout/src/tools/rust-analyzer/crates/proc-macro-api)
[RUSTC-TIMING] zerocopy_derive test:false 2.899
---
    Checking idna v1.1.0
error[E0614]: type `u128` cannot be dereferenced
   --> src/tools/rust-analyzer/crates/hir-ty/src/utils.rs:154:58
    |
154 |                     let candidate_tag = tag.wrapping_sub(*niche_start as i128) as usize;
    |                                                          ^^^^^^^^^^^^ can't be dereferenced

error[E0277]: can't compare `&RustcEnumVariantIdx` with `RustcEnumVariantIdx`
   --> src/tools/rust-analyzer/crates/hir-ty/src/utils.rs:158:39
    |
158 |                         .filter(|x| x != untagged_variant)
    |                                       ^^ no implementation for `&RustcEnumVariantIdx == RustcEnumVariantIdx`
    |
    = help: the trait `std::cmp::PartialEq<RustcEnumVariantIdx>` is not implemented for `&RustcEnumVariantIdx`
help: consider dereferencing here
    |
158 |                         .filter(|x| *x != untagged_variant)
    |                                     +

error[E0614]: type `RustcEnumVariantIdx` cannot be dereferenced
   --> src/tools/rust-analyzer/crates/hir-ty/src/utils.rs:160:36
    |
160 |                         .unwrap_or(*untagged_variant);
    |                                    ^^^^^^^^^^^^^^^^^ can't be dereferenced

[RUSTC-TIMING] idna test:false 0.531
[RUSTC-TIMING] form_urlencoded test:false 0.167
[RUSTC-TIMING] toml test:false 1.900

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 28, 2026

☀️ Try build successful (CI)
Build commit: 7dabc88 (7dabc88a3b6768751847baeb49983f31ac5f20e2, parent: 03c609abb6638f9d7f49f34326d4137d07f5cd61)

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@craterbot check

@craterbot
Copy link
Copy Markdown
Collaborator

👌 Experiment pr-155945 created and queued.
🤖 Automatically detected try build 7dabc88
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

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
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 5, 2026

☔ The latest upstream changes (presumably #156190) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

5 participants