about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/docs/dev
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-02 21:12:10 +0000
committerPhilipp Krones <hello@philkrones.com>2023-08-17 17:50:37 +0200
commit48fca125b8ff5c090b834fd52ba042b0a0c6a77b (patch)
treed1c710cc96a513fbc2af9619e8896fe8ada49ea2 /src/tools/rust-analyzer/docs/dev
parent2562f8466ceeb13eec2ced152f518ef4f5753657 (diff)
Auto merge of #11069 - y21:issue11063, r=Alexendoo
[`missing_fields_in_debug`]: make sure self type is an adt

Fixes #11063, another ICE that can only happen in core.

This lint needs the `DefId` of the implementor to get its fields, but that ICEs if the implementor does not have a `DefId` (as is the case with primitive types, e.g. `impl Debug for bool`), which is where this ICE comes from.

This PR changes the check I added in #10897 to be more... robust against `Debug` implementations we don't want to lint.
Instead of just checking if the self type is a type parameter and "special casing" one specific case we don't want to lint, we should probably rather just check that the self type is either a struct, an enum or a union and only then continue.
That prevents weird edge cases like this one that can only happen in core.

Again, I don't know if it's even possible to add a test case for this since one cannot implement `Debug` for primitive types outside of the crate that defined `Debug` (core).
I did make sure that this PR no longer ICEs on `impl<T> Debug for T` and `impl Debug for bool`.
Maybe writing such a test is possible with `#![no_core]` and then re-defining the `Debug` trait or something like that...?

changelog: [`missing_fields_in_debug`]: make sure self type is an adt (fixes an ICE in core)

r? `@Alexendoo` (reviewed the last PRs for this lint)
Diffstat (limited to 'src/tools/rust-analyzer/docs/dev')
0 files changed, 0 insertions, 0 deletions