From: Owen Avery Date: Tue, 25 Mar 2025 22:50:56 +0000 (-0400) Subject: gccrs: Lower raw string literals X-Git-Tag: basepoints/gcc-16~469 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=284120406a9f916a538af36b34127a0bfa33bb06;p=thirdparty%2Fgcc.git gccrs: Lower raw string literals gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_literal): Lower raw string literals into normal string literals. gcc/testsuite/ChangeLog: * rust/compile/issue-3549.rs: New test. Signed-off-by: Owen Avery --- diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index c1fef3d7a20..b0d347e6518 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -933,8 +933,8 @@ ASTLoweringBase::lower_literal (const AST::Literal &literal) case AST::Literal::LitType::BYTE_STRING: type = HIR::Literal::LitType::BYTE_STRING; break; - case AST::Literal::LitType::RAW_STRING: // TODO: Lower raw string literals. - rust_unreachable (); + case AST::Literal::LitType::RAW_STRING: + type = HIR::Literal::LitType::STRING; break; case AST::Literal::LitType::INT: type = HIR::Literal::LitType::INT; diff --git a/gcc/testsuite/rust/compile/issue-3549.rs b/gcc/testsuite/rust/compile/issue-3549.rs new file mode 100644 index 00000000000..cedbb5a02b5 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3549.rs @@ -0,0 +1,3 @@ +fn main() { + r#""#; +}