about summary refs log tree commit diff
path: root/compiler/rustc_target
diff options
context:
space:
mode:
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>2021-10-24 11:57:45 -0700
committerDrMeepster <19316085+DrMeepster@users.noreply.github.com>2021-10-25 14:56:21 -0700
commita46daf050b863bc3d89e232a19c08f4bc015e92d (patch)
tree30a26f2194bfe83bb52a112bca0f48c39b45ea60 /compiler/rustc_target
parentefd0483949496b067cd5f7569d1b28cd3d5d3c72 (diff)
downloadrust-a46daf050b863bc3d89e232a19c08f4bc015e92d.tar.gz
rust-a46daf050b863bc3d89e232a19c08f4bc015e92d.zip
make thiscall on unsupported platforms an error
Diffstat (limited to 'compiler/rustc_target')
-rw-r--r--compiler/rustc_target/src/spec/mod.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index ff5dfa3f746..537a190211e 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1522,6 +1522,7 @@ impl Target {
             AmdGpuKernel => self.arch == "amdgcn",
             AvrInterrupt | AvrNonBlockingInterrupt => self.arch == "avr",
             Wasm => ["wasm32", "wasm64"].contains(&&self.arch[..]),
+            Thiscall { .. } => self.arch == "x86",
             // On windows these fall-back to platform native calling convention (C) when the
             // architecture is not supported.
             //
@@ -1552,15 +1553,13 @@ impl Target {
             // > convention is used.
             //
             // -- https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions
-            Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall if self.is_like_windows => {
-                true
-            }
+            Stdcall { .. } | Fastcall | Vectorcall if self.is_like_windows => true,
             // Outside of Windows we want to only support these calling conventions for the
             // architectures for which these calling conventions are actually well defined.
-            Stdcall { .. } | Fastcall | Thiscall { .. } if self.arch == "x86" => true,
+            Stdcall { .. } | Fastcall if self.arch == "x86" => true,
             Vectorcall if ["x86", "x86_64"].contains(&&self.arch[..]) => true,
             // Return a `None` for other cases so that we know to emit a future compat lint.
-            Stdcall { .. } | Fastcall | Thiscall { .. } | Vectorcall => return None,
+            Stdcall { .. } | Fastcall | Vectorcall => return None,
         })
     }