https://gcc.gnu.org/g:75ef9fd3ffc6ef0759cf9fa359c94bfa4fde1235
commit 75ef9fd3ffc6ef0759cf9fa359c94bfa4fde1235 Author: Owen Avery <powerboat9.ga...@gmail.com> Date: Tue Mar 25 18:50:56 2025 -0400 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 <powerboat9.ga...@gmail.com> Diff: --- gcc/rust/hir/rust-ast-lower-base.cc | 4 ++-- gcc/testsuite/rust/compile/issue-3549.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index 52781da1eaf5..749fe09f3baa 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 000000000000..cedbb5a02b55 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3549.rs @@ -0,0 +1,3 @@ +fn main() { + r#""#; +}