E4002

E4002#

The modifier is not supported here.

Erroneous Example#

pub struct S {
  pub(open) field: Int
}

This example declares a field with the pub(open) visibility modifier, which is not allowed and will give the following error on line 2:

The public open modifier is not supported here

Suggestion#

Change the visibility of the field to match the visibility of the struct:

///|
pub struct S {
  field : Int
}

///|
pub fn make() -> S {
  S::{ field: 0 }
}

We could have written pub field: Int instead of field: Int as well, but it is not necessary, as all fields in a public struct are public by default.