Change method lookup to require invariance for mutable references

Fixes #17033.
Fixes #15965.

cc @nikomatsakis