Must constraint for a leaf which is a key

How to add must constraint for a leaf which is also a key?
Here b-num is also a key value

augment “/a/b” {
list c {
key “c-num” ;
leaf c-num {
must “…/c-num = /a/b/b-num”
{
error-message “c-num should be equal to b-num”;
}
type uint16;
}

Something like this should work:

must "/<module-prefix>:a/<module-prefix>:b[<module-prefix>:b-num=current()];

Check the XPath context paragraph in the YANG RFC:
https://tools.ietf.org/html/rfc7950#page-50

An easier way is to use a leafref type, leafreffing the path:

/<module-prefix>:a/<module-prefix>:b/<module-prefix>:b-num