Skip to content

Commit 08b8ba0

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

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler/rustc_lexer/src/unescape.rs

Lines changed: 8 additions & 4 deletions
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+
/// relate 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.
@@ -73,9 +75,11 @@ impl EscapeError {
7375
}
7476
}
7577

76-
/// Takes a contents of a literal (without quotes) and produces a
77-
/// sequence of escaped characters or errors.
78-
/// Values are returned through invoking of the provided callback.
78+
/// Takes a contents of a literal (without quotes) and produces a sequence of
79+
/// escaped characters or errors.
80+
///
81+
/// Values are returned by invoking `callback`. For `Char` and `Byte` modes,
82+
/// the callback will be called exactly once.
7983
pub fn unescape_literal<F>(src: &str, mode: Mode, callback: &mut F)
8084
where
8185
F: FnMut(Range<usize>, Result<char, EscapeError>),

0 commit comments

Comments
 (0)