From: Xiao Ma Date: Thu, 2 Mar 2023 02:31:36 +0000 (+0000) Subject: gccrs: Fix `FeatureGate::gate` will crash on 32-bit x86. X-Git-Tag: basepoints/gcc-15~2751 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2163af71247b99e8fd707e5d6da83d14456e02a5;p=thirdparty%2Fgcc.git gccrs: 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 --- diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/rust-feature-gate.cc index d2c45f1b18c1..21b20a834e96 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 3391dd7c4733..91fc150b223d 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;