Skip to content

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented Dec 7, 2025

Fixes #21204

Example

//- /main.rs
mod foo;

fn main() {
    foo::Foo::Variant { bar: 3, $0baz: false};
}
//- /foo.rs
pub enum Foo {
    Variant {
        bar: i32
    }
}

Before this PR

pub enum Foo {
    Variant {
        bar: i32,
        pub(crate) baz: bool
    }
}

After this PR

pub enum Foo {
    Variant {
        bar: i32,
        baz: bool
    }
}

Example
---
```rust
//- /main.rs
mod foo;

fn main() {
    foo::Foo::Variant { bar: 3, $0baz: false};
}
//- /foo.rs
pub enum Foo {
    Variant {
        bar: i32
    }
}
```

**Before this PR**

```rust
pub enum Foo {
    Variant {
        bar: i32,
        pub(crate) baz: bool
    }
}
```

**After this PR**

```rust
pub enum Foo {
    Variant {
        bar: i32,
        baz: bool
    }
}
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 7, 2025
@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Dec 8, 2025
Merged via the queue into rust-lang:master with commit a50c1cc Dec 8, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 8, 2025
@A4-Tacks A4-Tacks deleted the no-pub-in-variant-field branch December 9, 2025 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create field assist puts wrong visibility on a field

3 participants