mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
ffe95252bd
[`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 |
||
---|---|---|
.. | ||
test_utils | ||
ui | ||
ui-cargo | ||
ui-internal | ||
ui-toml | ||
workspace_test | ||
check-fmt.rs | ||
clippy.toml | ||
compile-test.rs | ||
dogfood.rs | ||
headers.rs | ||
integration.rs | ||
lint_message_convention.rs | ||
missing-test-files.rs | ||
versioncheck.rs | ||
workspace.rs |