dalek-cryptography / curve25519-dalek

A pure-Rust implementation of group operations on Ristretto and Curve25519
Other
867 stars 439 forks source link

Mark scalar::clamp_integer as must_use #558

Closed moiseev-signal closed 1 year ago

pinkforest commented 1 year ago

If I would think SemVer pedantically - I would think this is a breaking API behaviour change -

Since it's be damned if you don't and be damned if you do situation since SemVer isn't always practical :)

And since it's still a mandatory compiler warning at the build stage and not an optional clippy dev-only lint.

Some builds might have deny all warnings and if we add a warning those will break - however broken or not.

Ofcourse from practical PoV it makes sense to add this as a default - just wanted to mention.

If the preference is to maintain the SemVer and agree re: it's breaking - then I would suggest;

For 4.x I would suggest adding #[cfg_attr(curve25519_dalek_warn_unused), must_use)] and adopt as default in 5.x

That said -

Should probably check and add them to all similarly used fn's for the sake of consistency at the same release regardless.

robjtede commented 1 year ago

For 4.x I would suggest adding #[cfg_attr(curve25519_dalek_warn_unused), must_use)] and adopt as default in 5.x

TBH, this would be overkill. std itself adds must_use annotations all the time; it's not considered breaking.

pinkforest commented 1 year ago

Ya - though never remember seeing in a patch release though - would think minor bump makes sense most here perhaps

tarcieri commented 1 year ago

must_use isn't breaking. It generates a warning. Warnings are specifically designed so new ones can be added without breaking builds.

While -D warnings changes that, it's opt-in for that very reason.

pinkforest commented 1 year ago

That makes sense yes, I was being pedantic for no reason :sweat_smile:

rozbb commented 1 year ago

Sorry, I might have been hasty on this. I didn't realize @tarcieri hadn't approved. Should I roll back?

tarcieri commented 1 year ago

I forgot to hit approve, sorry. I agreed in spirit in my comment