Skip to content

Commit

Permalink
Rollup merge of rust-lang#124524 - spastorino:make-foreign-static-use…
Browse files Browse the repository at this point in the history
…-struct, r=oli-obk

Add StaticForeignItem and use it on ForeignItemKind

This is in preparation for unsafe extern blocks that adds a safe variant for functions inside extern blocks.

r? `@oli-obk`
cc `@compiler-errors`
  • Loading branch information
matthiaskrgr authored Apr 30, 2024
2 parents 4bee978 + 9276ce1 commit fc15bc1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion clippy_utils/src/ast_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,18 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
use ForeignItemKind::*;
match (l, r) {
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
(
Static(box StaticForeignItem {
ty: lt,
mutability: lm,
expr: le,
}),
Static(box StaticForeignItem {
ty: rt,
mutability: rm,
expr: re,
}),
) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
(
Fn(box ast::Fn {
defaultness: ld,
Expand Down

0 comments on commit fc15bc1

Please sign in to comment.