summaryrefslogtreecommitdiff
path: root/xmake/rules/rust/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-11-13 13:52:57 +0800
committerruki <[email protected]>2021-11-13 13:52:57 +0800
commit80326fdfb7fa838d3dc79aa24c9dcc01519b173b (patch)
tree0c2461c8dc9ec446af28274983e11fe508cef200 /xmake/rules/rust/xmake.lua
parent6b684d5cc448124c31a51fff71e4043667677a57 (diff)
add edition for rust
Diffstat (limited to 'xmake/rules/rust/xmake.lua')
-rw-r--r--xmake/rules/rust/xmake.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmake/rules/rust/xmake.lua b/xmake/rules/rust/xmake.lua
index f371692e1..e31e2f046 100644
--- a/xmake/rules/rust/xmake.lua
+++ b/xmake/rules/rust/xmake.lua
@@ -32,6 +32,7 @@ rule("rust.cxxbridge")
rule("rust.build")
set_sourcekinds("rc")
on_load(function (target)
+ -- set cratetype
local cratetype = target:values("rust.cratetype")
if cratetype == "staticlib" then
assert(target:is_static(), "target(%s) must be static kind for cratetype(staticlib)!", target:name())
@@ -56,6 +57,10 @@ rule("rust.build")
elseif target:is_binary() then
target:add("ldflags", "--crate-type=bin")
end
+
+ -- set edition
+ local edition = target:values("rust.edition") or "2018"
+ target:add("rcflags", "--edition", edition, {force = true})
end)
on_build("build.target")