diff options
| author | bobtwinkles <srkoser+GitHub@gmail.com> | 2018-04-21 18:00:09 -0400 |
|---|---|---|
| committer | bobtwinkles <srkoser+GitHub@gmail.com> | 2018-04-23 23:59:58 -0400 |
| commit | d2dc21df02a6f24b0c5629d3c3ebc7c9b85d20da (patch) | |
| tree | 3b5f07bd31d5d000c18ae4854040a4372142f018 | |
| parent | 725c9b0ede0b222cd64a8dc87cbeed052ecad157 (diff) | |
| download | rust-d2dc21df02a6f24b0c5629d3c3ebc7c9b85d20da.tar.gz rust-d2dc21df02a6f24b0c5629d3c3ebc7c9b85d20da.zip | |
Add documentation for SyntaxContext::remove_mark
| -rw-r--r-- | src/libsyntax_pos/hygiene.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index 5e96b5ce673..6eb662744c3 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -238,6 +238,22 @@ impl SyntaxContext { }) } + /// Pulls a single mark off of the syntax context. This effectively moves the + /// context up one macro definition level. That is, if we have a nested macro + /// definition as follows: + /// + /// ```rust + /// macro_rules! f { + /// macro_rules! g { + /// ... + /// } + /// } + /// ``` + /// + /// and we have a SyntaxContext that is referring to something declared by an invocation + /// of g (call it g1), calling remove_mark will result in the SyntaxContext for the + /// invocation of f that created g1. + /// Returns the mark that was removed. pub fn remove_mark(&mut self) -> Mark { HygieneData::with(|data| { let outer_mark = data.syntax_contexts[self.0 as usize].outer_mark; |
