expression

Raw string literals

Raw string literals preserve backslashes and can contain quotes when surrounded by matching hash delimiters. They still represent UTF-8 text. Expected stdout (not executed): C:\work\notes say "hi" Common mistake: Assuming raw strings are byte strings or interpret escape sequences.

Formal Syntax & Structure

rust syntaxrust
r#"text"#

Working Example

Example Snippetrust
fn main() {    let path = r"C:\work\notes";    let label = r#"say "hi""#;    println!("{path}");    println!("{label}");}
Rust Reference