From 4f76aad18b2b765ecfe8682ea38209e09d4d3bd2 Mon Sep 17 00:00:00 2001 From: Xiao Ma Date: Thu, 2 Mar 2023 02:31:36 +0000 Subject: [PATCH] Fix `FeatureGate::gate` will crash on 32-bit x86. gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc: Adjust 'ld'->'u'. * checks/errors/rust-feature.h: Adjust the type of `m_issue`: 'uint64_t' -> 'unsigned'. Signed-off-by: Xiao Ma Co-authored-by: Thomas Schwinge --- gcc/rust/checks/errors/rust-feature-gate.cc | 4 ++-- gcc/rust/checks/errors/rust-feature.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/rust-feature-gate.cc index 07d367e6292..185afb472fb 100644 --- a/gcc/rust/checks/errors/rust-feature-gate.cc +++ b/gcc/rust/checks/errors/rust-feature-gate.cc @@ -75,8 +75,8 @@ FeatureGate::gate (Feature::Name name, Location loc, if (issue > 0) { const char *fmt_str - = "%s. see issue %ld " - " for more " + = "%s. see issue %u " + " for more " "information. add `#![feature(%s)]` to the crate attributes to " "enable."; rust_error_at (loc, fmt_str, error_msg.c_str (), issue, issue, diff --git a/gcc/rust/checks/errors/rust-feature.h b/gcc/rust/checks/errors/rust-feature.h index 7562eaf594b..6f2021f8e44 100644 --- a/gcc/rust/checks/errors/rust-feature.h +++ b/gcc/rust/checks/errors/rust-feature.h @@ -49,14 +49,14 @@ public: Name name () { return m_name; } const std::string &description () { return m_description; } State state () { return m_state; } - uint64_t issue () { return m_issue; } + unsigned issue () { return m_issue; } static Optional as_name (const std::string &name); static Feature create (Name name); private: Feature (Name name, State state, const char *name_str, - const char *rustc_since, uint64_t issue_number, + const char *rustc_since, unsigned issue_number, const Optional &edition, const char *description) : m_state (state), m_name (name), m_name_str (name_str), @@ -68,7 +68,7 @@ private: Name m_name; std::string m_name_str; std::string m_rustc_since; - uint64_t m_issue; + unsigned m_issue; Optional edition; std::string m_description; -- 2.47.2