Skip to content

Conversation

@Manishearth
Copy link
Member

Latest Rust has a bunch of warnings around unexpected cfg keys, to avoid mistakes and encourage use of features. This can be worked around by documenting deliberate CFG keys in Cargo.toml (or by emitting them from the build script, which I'd rather not introduce).

This doesn't fix all of them, we have a ton of cfg(skip) that we should fix. Perhaps cfg(not(any())) for now, though really we should tweak the ctor macros to not need this, the cfg is a hack.

@Manishearth Manishearth requested a review from a team as a code owner June 13, 2024 22:23
@Manishearth Manishearth changed the title Fix unexpected_cfg lint warnings Fix some unexpected_cfg lint warnings Jun 13, 2024
@Manishearth
Copy link
Member Author

This doesn't fix all of them, we have a ton of cfg(skip) that we should fix. Perhaps cfg(not(any())) for now, though really we should tweak the ctor macros to not need this, the cfg is a hack.

Gonna make this change in this PR to try and get CI passing again. We can figure out a longer term macro solution later: this is extremely hacky and works in an unintuitive way.

options: skip,
error: DataError,
#[cfg(skip)]
#[cfg(not(all()))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: these cfg(skip)s in the invocations of gen_any_buffer_data_constructors! could be better modeled by changing the macro itself to not emit these functions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what I said in the comments, but I didn't want to figure that out whilst fixing nightly CI.

@Manishearth Manishearth requested a review from sffc June 14, 2024 21:25
@Manishearth
Copy link
Member Author

[cargo-make] WARN - Unable to parse Cargo.toml via cargo-metadata, fallbacking. cargo metadata exited with an error: error: missing field level

It appears we are required to include the lint level. Hm.

@sffc
Copy link
Member

sffc commented Jun 17, 2024

Can the level be "notice" or "ignore" or something?

@sffc sffc closed this Jun 17, 2024
@sffc
Copy link
Member

sffc commented Jun 17, 2024

We definitely want the lint for unknown directives. The suppression is only for the few we include intentionally.

(I don't know why the issue closed and reopened)

@sffc sffc reopened this Jun 17, 2024
@Manishearth
Copy link
Member Author

@sffc I don't understand, I had previously set the lint to "warn" and you didn't want that, what is the difference between "warn" and what you mean by "notice"?

@Manishearth
Copy link
Member Author

This fixes all but one case, and that needs to be fixed by improving the macro first. I'm working on that as a separate PR for now.

segmenter_lstm = { tagged = "_segmenter_lstm_tag_" }

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4x_custom_data)'] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is emitted by the build script, why do we need to suppress it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be unconditionally emitted with a "this cfg exists" directive

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed now?

unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4x_custom_data)'] }

[dependencies]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

@Manishearth
Copy link
Member Author

I resolved the comments but I also undid the cfg(skip) changes when fixing merge conflicts since that's going to conflict more.

@Manishearth Manishearth merged commit cfda36d into unicode-org:main Jun 18, 2024
@Manishearth Manishearth deleted the unexpected_cfgs branch June 18, 2024 17:32
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.

3 participants