about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-14 16:59:26 +0000
committerbors <bors@rust-lang.org>2023-06-14 16:59:26 +0000
commitffe95252bd355fd9643de6dceea997bb7bee229b (patch)
tree756321fc3a37b513bb6552c8c0898ecabb81a434 /tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff
parent1d0d686f108a2b405fa3130c0903023c1afc0eac (diff)
parent4795c919399610d9105fae67492d3eb65c0c1c01 (diff)
downloadrust-ffe95252bd355fd9643de6dceea997bb7bee229b.tar.gz
rust-ffe95252bd355fd9643de6dceea997bb7bee229b.zip
Auto merge of #10954 - y21:issue10158, r=llogiq
[`derivable_impls`]: don't lint if `default()` call expr unsize-coerces to trait object

Fixes #10158.

This fixes a FP where the derive-generated Default impl would have different behavior because of unsize coercion from `Box<T>` to `Box<dyn Trait>`:
```rs
struct S {
  x: Box<dyn std::fmt::Debug>
}
impl Default for S {
  fn default() -> Self {
    Self {
      x: Box::<()>::default()
     // ^~ Box<()> coerces to Box<dyn Debug>
     // #[derive(Default)] would call Box::<dyn Debug>::default()
    }
  }
}
```
(this intentionally only looks for trait objects `dyn` specifically, and not any unsize coercion, e.g. `&[i32; 5]` to `&[i32]`, because that breaks existing tests and isn't actually problematic, as far as I can tell)

changelog: [`derivable_impls`]: don't lint if `default()` call expression unsize-coerces to trait object
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-unwind.diff')
0 files changed, 0 insertions, 0 deletions