rust/compiler/rustc_lint/src
Guillaume Gomez 2627db6a3c
Rollup merge of #86747 - FabianWolff:issue-86653, r=GuillaumeGomez
Improve wording of the `drop_bounds` lint

This PR addresses #86653. The issue is sort of a false positive of the `drop_bounds` lint, but I would argue that the best solution for #86653 is simply a rewording of the warning message and lint description, because even if the lint is _technically_ wrong, it still forces the programmer to think about what they are doing, and they can always use `#[allow(drop_bounds)]` if they think that they really need the `Drop` bound.

There are two issues with the current warning message and lint description:
- First, it says that `Drop` bounds are "useless", which is technically incorrect because they actually do have the effect of allowing you e.g. to call methods that also have a `Drop` bound on their generic arguments for some reason. I have changed the wording to emphasize not that the bound is "useless", but that it is most likely not what was intended.
- Second, it claims that `std::mem::needs_drop` detects whether a type has a destructor. But I think this is also technically wrong: The `Drop` bound says whether the type has a destructor or not, whereas `std::mem::needs_drop` also takes nested types with destructors into account, even if the top-level type does not itself have one (although I'm not 100% sure about the exact terminology here, i.e. whether the "drop glue" of the top-level type counts as a destructor or not).

cc `@jonhoo,` does this solve the issue for you?

r? `@GuillaumeGomez`
2021-08-22 20:52:50 +02:00
..
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs Link to edition guide instead of issues for 2021 lints. 2021-08-09 17:45:01 +02:00
builtin.rs introduce a Coerce predicate 2021-08-19 17:28:24 -04:00
context.rs Error when warnings lint group is used with force-warn 2021-08-18 11:53:59 +02:00
early.rs Add additional missing lint handling logic 2021-07-17 23:03:58 -05:00
internal.rs Auto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk 2021-07-13 15:06:10 +00:00
late.rs Add inferred args to typeck 2021-07-25 07:28:51 +00:00
levels.rs Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisa 2021-08-01 09:15:15 +00:00
lib.rs Remove box syntax from rustc_lint 2021-08-18 09:31:51 +02:00
methods.rs Fix doctest 2020-10-26 18:19:49 -04:00
non_ascii_idents.rs Stablize non_ascii_idents feature. 2021-04-08 02:52:00 +08:00
non_fmt_panic.rs Auto merge of #88083 - m-ou-se:non-fmt-panics-suggest-debug, r=estebank 2021-08-17 16:43:40 +00:00
nonstandard_style.rs Adjust #[no_mangle]-related checks and lints for impl items 2021-08-12 17:11:44 +08:00
noop_method_call.rs Warn in doc test 2021-03-03 11:23:33 +01:00
passes.rs Add inferred args to typeck 2021-07-25 07:28:51 +00:00
redundant_semicolon.rs Lint on redundant trailing semicolon after item 2020-12-29 16:30:02 -05:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs Rollup merge of #86747 - FabianWolff:issue-86653, r=GuillaumeGomez 2021-08-22 20:52:50 +02:00
types.rs Auto merge of #84039 - jyn514:uplift-atomic-ordering, r=wesleywiser 2021-08-16 06:36:13 +00:00
unused.rs Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00