Skip to content

Conversation

@BurntSushi
Copy link
Owner

This was bad timing. The lang team just stabilized (in nightly) a new
deny-by-default lint, named ambiguous_negative_literals, which
triggers an error for things like -1.hour(). While such things can be
confusingly ambiguous in some cases, in Jiff, -1.hour(), (-1).hour()
and -(1.hour()) are all, very intentionally, precisely equivalent.

For now we just allow the lint. If the lint stays, we'll likely want
to recommend allowing it in the Jiff docs.

See: rust-lang/rust#121364

@BurntSushi BurntSushi force-pushed the ag/fix-nightly-lint branch from 75ad0f8 to ee4f89f Compare July 27, 2024 12:33
@BurntSushi
Copy link
Owner Author

Ug. There's also a billion doc tests that will need to have this lint allow'd too.

This was bad timing. The lang team just stabilized (in nightly) a new
deny-by-default lint, named `ambiguous_negative_literals`, which
triggers an error for things like `-1.hour()`. While such things can be
confusingly ambiguous in some cases, in Jiff, `-1.hour()`, `(-1).hour()`
and `-(1.hour())` are all, very intentionally, precisely equivalent.

For now we just `allow` the lint. If the lint stays, we'll likely want
to recommend allowing it in the Jiff docs.

See: rust-lang/rust#121364
@BurntSushi BurntSushi force-pushed the ag/fix-nightly-lint branch from ee4f89f to 77f9894 Compare July 27, 2024 12:57
@BurntSushi BurntSushi merged commit a8cf3be into master Jul 27, 2024
@BurntSushi BurntSushi deleted the ag/fix-nightly-lint branch July 27, 2024 13:09
///
/// ```
/// # // See: https://github.com/rust-lang/rust/pull/121364
/// # #![allow(unknown_lints, ambiguous_negative_literals)]
Copy link

Choose a reason for hiding this comment

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

All of those manual allow-attr can be replaced with a single #![doc(test(attr(...)))] attr: #![doc(test(attr(allow(unknown_lints, ambiguous_negative_literals))))]

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh wow, that's great to know! Thank you.

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