about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-02 19:46:46 +0000
committerbors <bors@rust-lang.org>2022-10-02 19:46:46 +0000
commitbef93d3b1464b6d467482d47a53c62aadaa9f41c (patch)
tree48689a77210ac027077feff51677ea3ec859b6aa /compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp
parent0341198ba1980468ae190208a546a40a0634f06c (diff)
parent162aa19793f21c99cf7ec2a8c080ee2f8843f7db (diff)
downloadrust-bef93d3b1464b6d467482d47a53c62aadaa9f41c.tar.gz
rust-bef93d3b1464b6d467482d47a53c62aadaa9f41c.zip
Auto merge of #7962 - Jarcho:fix_match_type_on_diagnostic_items, r=llogiq
Fix and improve `match_type_on_diagnostic_item`

This extracts the fix for the lint out of #7647. There's still a couple of other functions to check, but at least this will get lint working again.

The two added util functions (`is_diagnostic_item` and `is_lang_item`) are needed to handle `DefId` for unit and tuple struct/variant constructors. The `rustc_diagnostic_item` and `lang` attributes are attached to the struct/variant `DefId`, but most of the time they are used through their constructors which have a different `DefId`. The two utility functions will check if the `DefId` is for a constructor and switch to the associated struct/variant `DefId`.

There does seem to be a bug on rustc's side where constructor `DefId`s from external crates seem to be returning `DefKind::Variant` instead of `DefKind::Ctor()`. There's a workaround put in right.

changelog: None
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/ArchiveWrapper.cpp')
0 files changed, 0 insertions, 0 deletions