about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-07 07:14:12 +0000
committerbors <bors@rust-lang.org>2023-06-07 07:14:12 +0000
commit7c34ec8947f00f316f66ce2ed7068a0395828833 (patch)
tree72f4a2333fe10f4d207dd88a17820544a7e46681 /tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff
parentf72914732527904480887847fe2c20df42e24dc2 (diff)
parente70dd55fd63ca0378ce143efd72c0c3b01914b15 (diff)
downloadrust-7c34ec8947f00f316f66ce2ed7068a0395828833.tar.gz
rust-7c34ec8947f00f316f66ce2ed7068a0395828833.zip
Auto merge of #10896 - y21:eager-or-lazy-autoderef, r=blyxyas,xFrednet
consider autoderef through user-defined `Deref` in `eager_or_lazy`

Fixes #10462

This PR handles autoderef in the `eager_or_lazy` util module and stops suggesting to change lazy to eager if autoderef in an expression goes through user defined `Deref` impls, e.g.
```rs
struct S;
impl Deref for S {
  type Target = ();
  fn deref(&self) -> &Self::Target { &() }
}

let _ = Some(()).as_ref().unwrap_or_else(|| &S); // autoderef `&S` -> `&()`
```

changelog: [`unnecessary_lazy_evaluations`]: don't suggest changing lazy evaluation to eager if autoderef goes through user-defined `Deref`

r? `@xFrednet`  (because of the earlier review in #10864, might help for context here)
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff')
0 files changed, 0 insertions, 0 deletions