Export types provided by arc_lock feature. #442
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While switching from
write
towrite_arc
in some wrapper I'm making, I expected the return to change fromparking_lot::RwLockWriteGuard
toparking_lot::ArcRwLockWriteGuard
, so:But the
ArcRwLockWriteGuard
isn't present in the root of the crate, even with thearc_lock
feature;The actual return type is
lock_api::ArcRwLockWriteGuard
, from thelock_api
crate instead of theparking_lot
crate, the error isn't particularly helpful as it points to the wrong lock guard type.Interestingly enough, reproducing this on the playground, does result in two suggestions, one of which is the good one. The good suggestion only happens if
lock_api
is listed as a dependency in the targets'Cargo.toml
file, but if there's a dependency onparking_lot
, and that re-exportslock_api
(#150), I expect most users will not add a direct dependency onlock_api
, effectively hiding this useful suggestion.In short; I was confused by this behaviour, the docs don't show clearly that
ArcRwLockWriteGuard
is from thelock_api
crate and I just assumed the new structs would be exported after enabling the feature. I learned to check the return types carefully, but thought I'd still file a PR for it as it can be fixed easily to prevent others from running into this. Feel free to close the PR if it is deemed undesirable to re-export these types at the root of theparking_lot
crate.