From: Owen Avery <powerboat9.ga...@gmail.com>

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>
---
 gcc/rust/hir/rust-ast-lower-base.cc      | 4 ++--
 gcc/testsuite/rust/compile/issue-3549.rs | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/rust/compile/issue-3549.rs

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#""#;
+}
-- 
2.49.0

Reply via email to