libs: add Deref, DerefMut impls for references, fixing a bug in compiler
in the process that was blocking this.

Fixes #18621.