You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
let_underscore_drop should not suggest drop() ing types that do not impl drop() bounds #10412
I saw this happen: cargo clippy --fix --allow-dirty -- -Aclippy::all -Wclippy::let-underscore-drop
clippy suggests
fnbar<T>(it:Box<[T]>)where[T]: std::ops::Index<usize>,{drop(it[0]);// drop here}fnmain(){}
But this does not compile
error[E0277]: the size for values of type `<[T] as Index<usize>>::Output` cannot be known at compilation time
--> src/main.rs:5:11
|
5 | drop(it[0]);
| ---- ^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `<[T] as Index<usize>>::Output`
note: required by a bound in `std::mem::drop`
--> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/mem/mod.rs:979:13
|
979 | pub fn drop<T>(_x: T) {}
| ^ required by this bound in `drop`
For more information about this error, try `rustc --explain E0277`.
changed the title [-]let_underscore_drop should not suggesr `drop()` ing types that do impl drop() bounds[/-][+]let_underscore_drop should not suggest `drop()` ing types that do not impl drop() bounds[/+]on Feb 27, 2023
Activity
[-]let_underscore_drop should not suggesr `drop()` ing types that do impl drop() bounds[/-][+]let_underscore_drop should not suggest `drop()` ing types that do not impl drop() bounds[/+]J-ZhengLi commentedon Apr 7, 2023
that repro code doesn't seem trigger the lint you mentioned anymore, maybe it's already fixed.
However, it does trigger
boxed_localand it's really confusing 😂, because if I remove theBoxthere will be compiler errors.