about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-05 13:05:34 +0000
committerbors <bors@rust-lang.org>2022-08-05 13:05:34 +0000
commitd77da9da84fc89908ad01578c33c2dca8f597ffe (patch)
tree00e7a11bbb113dcd22d23227557af1d788ae2133 /compiler
parent9bbbf60b0442f1d56fc39f30274be77acc79164c (diff)
parent0a754b309ce05a34a10aac339c1a4253b7a551ee (diff)
Auto merge of #100073 - dpaoliello:externvar, r=michaelwoerister
Add test for raw-dylib with an external variable

All existing tests of link kind `raw-dylib` only validate the ability to link against functions, but it is also possible to link against variables.

This adds tests for linking against a variable using `raw-dylib` both by-name and by-ordinal.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index a2ac329f28f..2b213ac5c71 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -209,7 +209,14 @@ impl CheckAttrVisitor<'_> {
         }
 
         // FIXME(@lcnr): this doesn't belong here.
-        if matches!(target, Target::Closure | Target::Fn | Target::Method(_) | Target::ForeignFn) {
+        if matches!(
+            target,
+            Target::Closure
+                | Target::Fn
+                | Target::Method(_)
+                | Target::ForeignFn
+                | Target::ForeignStatic
+        ) {
             self.tcx.ensure().codegen_fn_attrs(self.tcx.hir().local_def_id(hir_id));
         }