diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-26 09:24:03 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-26 10:45:45 +1100 |
| commit | bf7d1b54e8a3195a0f52516d48659d9f1270436d (patch) | |
| tree | b31d7681d6a0066e0f8257108a10250b9ba98a48 /src/tools/rustfmt/tests/parser | |
| parent | 8c0b1fcd2914caaf1c3a1071028fb74b70c519e9 (diff) | |
Move `emit_stashed_diagnostic` call in rustfmt.
This call was added to `parse_crate_mod` in #121487, to fix a case where a stashed diagnostic wasn't emitted. But there is another path where a stashed diagnostic might fail to be emitted if there's a parse error, if the `build` call in `parse_crate_inner` fails before `parse_crate_mod` is reached. So this commit moves the `emit_stashed_diagnostic` call outwards, from `parse_crate_mod` to `format_project`, just after the `Parser::parse_crate` call. This should be far out enough to catch any parsing errors. Fixes #121517.
Diffstat (limited to 'src/tools/rustfmt/tests/parser')
| -rw-r--r-- | src/tools/rustfmt/tests/parser/stashed-diag2.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/parser/stashed-diag2.rs b/src/tools/rustfmt/tests/parser/stashed-diag2.rs new file mode 100644 index 00000000000..579a69def16 --- /dev/null +++ b/src/tools/rustfmt/tests/parser/stashed-diag2.rs @@ -0,0 +1,3 @@ +trait Trait<'1> { s> {} + +fn main() {} |
