Skip to content

Commit 1480496

Browse files
committed
Add some useful comments.
1 parent c6bbb37 commit 1480496

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_lexer/src/unescape.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use std::str::Chars;
77
#[cfg(test)]
88
mod tests;
99

10-
/// Errors and warnings that can occur during string unescaping.
10+
/// Errors and warnings that can occur during string unescaping. They mostly
11+
/// relates to malformed escape sequences, but there are a few that are about
12+
/// other problems.
1113
#[derive(Debug, PartialEq, Eq)]
1214
pub enum EscapeError {
1315
/// Expected 1 char, but 0 were found.
@@ -76,6 +78,7 @@ impl EscapeError {
7678
/// Takes a contents of a literal (without quotes) and produces a
7779
/// sequence of escaped characters or errors.
7880
/// Values are returned through invoking of the provided callback.
81+
/// For `Char` and `Byte` modes, the callback will be called exactly once.
7982
pub fn unescape_literal<F>(src: &str, mode: Mode, callback: &mut F)
8083
where
8184
F: FnMut(Range<usize>, Result<char, EscapeError>),

0 commit comments

Comments
 (0)