Add a no_std attribute, when both no_std and no_core attributes are
missing, inject an external std crate.
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::compile_crate): Inject std crate
when both no_std and no_core attributes are missing.
* util/rust-attribute-values.h: Add no_std attribute value.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
std::string (Values::Attributes::NO_CORE)))
{
parsed_crate.inject_extern_crate ("core");
+ // #![no_core] implies #![no_std]
+ if (!has_attribute (parsed_crate,
+ std::string (Values::Attributes::NO_STD)))
+ {
+ parsed_crate.inject_extern_crate ("std");
+ }
}
if (last_step == CompileOptions::CompileStep::Expansion)
static constexpr auto &LANG = "lang";
static constexpr auto &LINK_NAME = "link_name";
static constexpr auto &NO_CORE = "no_core";
+ static constexpr auto &NO_STD = "no_std";
static constexpr auto &LINK_SECTION = "link_section";
static constexpr auto &NO_MANGLE = "no_mangle";
static constexpr auto &EXPORT_NAME = "export_name";