diff options
| author | bors <bors@rust-lang.org> | 2022-06-12 23:25:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-12 23:25:35 +0000 |
| commit | 1fb9603022fe20814d3b7980a3c88299b8e1f747 (patch) | |
| tree | 6142f1916e3b0c2b4175a4e53ce37f8a971fedb2 /compiler/rustc_parse/src/parser | |
| parent | 546c826f0ccaab36e897860205281f490db274e6 (diff) | |
| parent | 84a13a28b749eb4765da0918131a47461fb99e3d (diff) | |
| download | rust-1fb9603022fe20814d3b7980a3c88299b8e1f747.tar.gz rust-1fb9603022fe20814d3b7980a3c88299b8e1f747.zip | |
Auto merge of #98020 - TaKO8Ki:use-create-snapshot-for-diagnostic-in-rustc-expand, r=Dylan-DPC
Use `create_snapshot_for_diagnostic` instead of `clone` for `Parser` Use [`create_snapshot_for_diagnostic`](https://github.com/rust-lang/rust/blob/cd119057160cedea245aa2679add56723f3dc784/compiler/rustc_parse/src/parser/diagnostics.rs#L214-L223) I implemented in https://github.com/rust-lang/rust/pull/94731 instead of `clone` to avoid duplicate unclosed delims errors being emitted when the `Parser` is dropped. I missed this one in #95068.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index a4cdfdf55f9..6a44f5d6653 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -336,7 +336,7 @@ struct InInTypo { // SnapshotParser is used to create a snapshot of the parser // without causing duplicate errors being emitted when the `Parser` // is dropped. -pub(super) struct SnapshotParser<'a> { +pub struct SnapshotParser<'a> { parser: Parser<'a>, unclosed_delims: Vec<UnmatchedBrace>, } @@ -392,7 +392,7 @@ impl<'a> Parser<'a> { } /// Create a snapshot of the `Parser`. - pub(super) fn create_snapshot_for_diagnostic(&self) -> SnapshotParser<'a> { + pub fn create_snapshot_for_diagnostic(&self) -> SnapshotParser<'a> { let mut snapshot = self.clone(); let unclosed_delims = self.unclosed_delims.clone(); // Clear `unclosed_delims` in snapshot to avoid |
