Skip to content

[crater experiment] lint against Struct { .. } when Struct has all private fields#159356

Draft
Jules-Bertholet wants to merge 2 commits into
rust-lang:mainfrom
Jules-Bertholet:crater-rest-test
Draft

[crater experiment] lint against Struct { .. } when Struct has all private fields#159356
Jules-Bertholet wants to merge 2 commits into
rust-lang:mainfrom
Jules-Bertholet:crater-rest-test

Conversation

@Jules-Bertholet

@Jules-Bertholet Jules-Bertholet commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Draft as this is just a Crater experiment, and should not be merged.

Deny-by-default lint on Struct { .. } patterns where Struct has only fields not visible from the location of the pattern (if it has no fields, it must be from a foreign crate and #[non_exhaustive]). This is to gather data to inform rust-lang/rfcs#3753.

@rustbot label A-patterns T-lang
@rustbot ready

r? compiler

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-patterns Relating to patterns and pattern matching T-lang Relevant to the language team S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 15, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_hir test:false 13.126
   Compiling rustc_parse v0.0.0 (/checkout/compiler/rustc_parse)
[RUSTC-TIMING] rustc_session test:false 23.626
   Compiling rustc_attr_parsing v0.0.0 (/checkout/compiler/rustc_attr_parsing)
error: crater fail !! problematic pattern detected !!
   --> compiler/rustc_attr_parsing/src/attributes/stability.rs:351:13
    |
351 |         Err(ErrorGuaranteed { .. }) => None,
    |             ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the type is defined in crate `rustc_span`
    = note: `#[deny(rest_pattern_match_on_struct_with_all_private_fields)]` on by default

error: crater fail !! problematic pattern detected !!
   --> compiler/rustc_attr_parsing/src/attributes/stability.rs:455:14
    |
455 |         (Err(ErrorGuaranteed { .. }), _) | (_, Err(ErrorGuaranteed { .. })) => None,
    |              ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the type is defined in crate `rustc_span`

error: crater fail !! problematic pattern detected !!
   --> compiler/rustc_attr_parsing/src/attributes/stability.rs:455:52
    |
455 |         (Err(ErrorGuaranteed { .. }), _) | (_, Err(ErrorGuaranteed { .. })) => None,
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the type is defined in crate `rustc_span`

[RUSTC-TIMING] rustc_attr_parsing test:false 6.516

@mati865

mati865 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Please describe what kind of crater run do you need: https://rustc-dev-guide.rust-lang.org/tests/crater.html#requesting-crater-runs
Looks like a check-only to me.

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 16, 2026
[crater experiment] lint against `Struct { .. }` when `Struct` has all private fields
@Jules-Bertholet

Copy link
Copy Markdown
Contributor Author

Yes, check-only

@rust-bors rust-bors Bot 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 Jul 16, 2026
@rust-bors

rust-bors Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 86531a3 failed: CI. Failed job:

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job dist-x86_64-linux-quick failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
##[endgroup]
[2026-07-16T12:46:46.796Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO)` starts
[2026-07-16T12:46:46.796Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO) > Build PGO instrumented rustc and LLVM` starts
[2026-07-16T12:46:46.796Z INFO  opt_dist::exec] Executing `RUST_BACKTRACE=full python3 /checkout/x.py build --target x86_64-unknown-linux-gnu --host x86_64-unknown-linux-gnu --stage 2 library/std --set rust.llvm-bitcode-linker=false --set build.extended=false --set rust.codegen-backends=['llvm'] --set rust.deny-warnings=false --set pgo.rustc.generate="/tmp/tmp-multistage/opt-artifacts/rustc-pgo" --set llvm.thin-lto=false --set llvm.link-shared=true [at /checkout/obj]`
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.06s
##[endgroup]
[TIMING:start] compile::Assemble { target_compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false } }
[TIMING:start] builder::Libdir { compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu }
---
   Compiling rustc_middle v0.0.0 (/checkout/compiler/rustc_middle)
   Compiling rustc_parse v0.0.0 (/checkout/compiler/rustc_parse)
[RUSTC-TIMING] rustc_hir test:false 8.110
   Compiling rustc_attr_parsing v0.0.0 (/checkout/compiler/rustc_attr_parsing)
error: crater fail !! problematic pattern detected !!
   --> /rustc-dev/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/compiler/rustc_attr_parsing/src/attributes/stability.rs:351:13
    |
351 |         Err(ErrorGuaranteed { .. }) => None,
    |             ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the type is defined in crate `rustc_span`
    = note: `#[deny(rest_pattern_match_on_struct_with_all_private_fields)]` on by default

error: crater fail !! problematic pattern detected !!
   --> /rustc-dev/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/compiler/rustc_attr_parsing/src/attributes/stability.rs:455:14
    |
455 |         (Err(ErrorGuaranteed { .. }), _) | (_, Err(ErrorGuaranteed { .. })) => None,
    |              ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the type is defined in crate `rustc_span`

error: crater fail !! problematic pattern detected !!
   --> /rustc-dev/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/compiler/rustc_attr_parsing/src/attributes/stability.rs:455:52
    |
455 |         (Err(ErrorGuaranteed { .. }), _) | (_, Err(ErrorGuaranteed { .. })) => None,
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the type is defined in crate `rustc_span`

[RUSTC-TIMING] rustc_attr_parsing test:false 3.332
error: could not compile `rustc_attr_parsing` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] rustc_session test:false 14.431
[RUSTC-TIMING] rustc_target test:false 38.164
[RUSTC-TIMING] rustc_parse test:false 41.478
[RUSTC-TIMING] rustc_middle test:false 75.209
Bootstrap failed while executing `build --target x86_64-unknown-linux-gnu --host x86_64-unknown-linux-gnu --stage 2 library/std --set rust.llvm-bitcode-linker=false --set build.extended=false --set rust.codegen-backends=['llvm'] --set rust.deny-warnings=false --set pgo.rustc.generate="/tmp/tmp-multistage/opt-artifacts/rustc-pgo" --set llvm.thin-lto=false --set llvm.link-shared=true`
Currently active steps:
compile::Assemble { target_compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false } } at src/bootstrap/src/core/build_steps/compile.rs:142
compile::Rustc { target: x86_64-unknown-linux-gnu, build_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: false }, crates: [] } at src/bootstrap/src/core/build_steps/compile.rs:2331
Build completed unsuccessfully in 0:12:32
[2026-07-16T12:59:19.097Z INFO  opt_dist::timer] Section `Stage 1 (Rustc PGO) > Build PGO instrumented rustc and LLVM` ended: FAIL (752.30s)`
---
[2026-07-16T12:59:19.098Z INFO  opt_dist::utils] Free disk space: 1.26 TiB out of total 2.51 TiB (49.62% used)
Error: Optimized build pipeline has failed

Caused by:
    Command RUST_BACKTRACE=full python3 /checkout/x.py build --target x86_64-unknown-linux-gnu --host x86_64-unknown-linux-gnu --stage 2 library/std --set rust.llvm-bitcode-linker=false --set build.extended=false --set rust.codegen-backends=['llvm'] --set rust.deny-warnings=false --set pgo.rustc.generate="/tmp/tmp-multistage/opt-artifacts/rustc-pgo" --set llvm.thin-lto=false --set llvm.link-shared=true [at /checkout/obj] has failed with exit code Some(1)

Stack backtrace:
   0: <anyhow::Error>::msg::<alloc::string::String>
             at /rust/deps/anyhow-1.0.102/src/backtrace.rs:10:14
   1: <opt_dist::exec::CmdBuilder>::run
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/exec.rs:81:17
   2: <opt_dist::exec::Bootstrap>::run
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/exec.rs:209:18
   3: opt_dist::execute_pipeline::{closure#1}::{closure#0}
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/main.rs:256:21
   4: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}::{closure#0}, ()>
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/timer.rs:111:22
   5: opt_dist::execute_pipeline::{closure#1}
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/main.rs:245:15
   6: <opt_dist::timer::TimerSection>::section::<opt_dist::execute_pipeline::{closure#1}, opt_dist::training::RustcPGOProfile>
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/timer.rs:111:22
   7: opt_dist::execute_pipeline
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/main.rs:242:35
   8: opt_dist::main
             at /rustc/86531a375a43e7ed5a4cbe0466f2ec7e8bd8a9d0/src/tools/opt-dist/src/main.rs:480:18
   9: <fn() -> core::result::Result<(), anyhow::Error> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/core/src/ops/function.rs:250:5
  10: std::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core::result::Result<(), anyhow::Error>, core::result::Result<(), anyhow::Error>>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/sys/backtrace.rs:166:18
  11: std::rt::lang_start::<core::result::Result<(), anyhow::Error>>::{closure#0}
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/rt.rs:206:18
  12: <&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe as core::ops::function::FnOnce<()>>::call_once
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/core/src/ops/function.rs:287:21
  13: std::panicking::catch_unwind::do_call::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/panicking.rs:576:43
  14: std::panicking::catch_unwind::<i32, &dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/panicking.rs:544:19
  15: std::panic::catch_unwind::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/panic.rs:359:14
  16: std::rt::lang_start_internal::{closure#0}
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/rt.rs:175:24
  17: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
             at /rustc/08d5b675a9b2abdca5e2fe4eabe0e07bbda15d49/library/std/src/panicking.rs:576:43

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

Labels

A-patterns Relating to patterns and pattern matching S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants