-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Labels
C-compatibilityCategory: Changes that affect compatibilityCategory: Changes that affect compatibilityP-highPriority: HighPriority: High
Description
I noticed that Key
is a type alias or a newtype depending on used features. This is a compatibility hazard.
For example:
Crate A:
serializer.emit_arguments("foo", &format_args!("bar"))
Crate B:
With featrue dynamic_keys
serializer.emit_arguments(Key::from(compute_key_string()), &format_args!("baz"))
Crate C depends on both A and B -> crate A will break.
One can defend against this by always using Key::from
, but it's possible to forget and clippy complains about useless conversion.
I think the best course of action is to use a newtype for static keys too. It will be breaking for crates that don't defend but it's probably more predictable and easier to handle than the situation above.
dpc and Techcable
Metadata
Metadata
Assignees
Labels
C-compatibilityCategory: Changes that affect compatibilityCategory: Changes that affect compatibilityP-highPriority: HighPriority: High