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

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-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. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants