7

[`missing_fields_in_debug`]: don't ICE when self type is a generic param by y21...

 1 year ago
source link: https://github.com/rust-lang/rust-clippy/pull/10897
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Contributor

@y21 y21

commented

Jun 5, 2023

edited

Fixes #10887

This PR fixes an ICE that happens when the implementor (self type) of a Debug impl is a generic parameter.
The lint calls TyCtxt::type_of with that self type, which ICEs when called with generic parameters, so this just adds a quick check before getting there to ignore them.

That can only happen inside of core itself (afaik) because the orphan rules forbid defining an impl such as impl<T> Debug for T outside of core, so I'm not sure how to add a test for this.
It seems like this impl in particular caused this: https://doc.rust-lang.org/stable/std/fmt/trait.Debug.html#impl-Debug-for-F

changelog: [missing_fields_in_debug]: don't ICE on blanket Debug impl in core


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK