External Publication
Visit Post

Method auto-(de)ref (and lack of it) in RFC 132 ufcs

Rust Internals [Unofficial] February 25, 2026
Source

What I was thinking is:

  • The full method resolution
  • Only recievers
  • Probably going to require the method being qualified, or just require it's a method, but maybe not the latter, because if it's supported in unqualified paths (e.g. use Trait::method) it doesn't make sense in similar-looking functions (e.g. fn foo in my playground link)
  • Manually enable by putting autoref (on second thoughts, autoderef? not sure of the exact syntax) before the value

That is, <current ufcs syntax>::method(autoref x, ...) behaves like x.method(...) and the only difference is method selection.


quinedot:

Some choices would change program semantics.

Played with your example, you (and I, initially) seem to have made the mistake of forgetting to add & in Foo::foo(var), making it infer &Self = &mut StringSelf = String.

Discussion in the ATmosphere

Loading comments...