public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7937] gccrs: Improve byte vector to string conversion
@ 2024-01-16 18:08 Arthur Cohen
0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:750ac3263c8db064b1d6b3ae33ec6a2036e38bb8
commit r14-7937-g750ac3263c8db064b1d6b3ae33ec6a2036e38bb8
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date: Wed Aug 2 16:45:42 2023 -0400
gccrs: Improve byte vector to string conversion
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc
(MacroBuiltin::include_str_handler): Use vector::data.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diff:
---
gcc/rust/expand/rust-macro-builtins.cc | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/gcc/rust/expand/rust-macro-builtins.cc b/gcc/rust/expand/rust-macro-builtins.cc
index 718d740b1dc..b36a46f0aff 100644
--- a/gcc/rust/expand/rust-macro-builtins.cc
+++ b/gcc/rust/expand/rust-macro-builtins.cc
@@ -576,10 +576,8 @@ MacroBuiltin::include_str_handler (location_t invoc_locus,
if (expect_single)
rust_error_at (invoc_locus, "%s was not a valid utf-8 file",
target_filename.c_str ());
- else if (!bytes.empty ())
- str = std::string ((const char *) &bytes[0], bytes.size ());
else
- return tl::nullopt;
+ str = std::string ((const char *) bytes.data (), bytes.size ());
auto node = AST::SingleASTNode (make_string (invoc_locus, str));
auto str_tok = make_token (Token::make_string (invoc_locus, std::move (str)));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-16 18:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:08 [gcc r14-7937] gccrs: Improve byte vector to string conversion Arthur Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).