about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-18 14:00:17 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-18 20:46:13 +1100
commitcea683c08f775f980e5e8de408ea3b47235329c7 (patch)
tree970251569a7d5f18ce642b8648c464e4b2fd7a80 /compiler/rustc_errors/src
parentcda4736f1eaad8af6f49388baa9b7e480df8e329 (diff)
downloadrust-cea683c08f775f980e5e8de408ea3b47235329c7.tar.gz
rust-cea683c08f775f980e5e8de408ea3b47235329c7.zip
Use `.into_diagnostic()` less.
This commit replaces this pattern:
```
err.into_diagnostic(dcx)
```
with this pattern:
```
dcx.create_err(err)
```
in a lot of places.

It's a little shorter, makes the error level explicit, avoids some
`IntoDiagnostic` imports, and is a necessary prerequisite for the next
commit which will add a `level` arg to `into_diagnostic`.

This requires adding `track_caller` on `create_err` to avoid mucking up
the output of `tests/ui/track-diagnostics/track4.rs`. It probably should
have been there already.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 959e26fec70..763de78451e 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -1274,6 +1274,7 @@ impl DiagCtxt {
         self.create_err(err).emit()
     }
 
+    #[track_caller]
     pub fn create_err<'a>(
         &'a self,
         err: impl IntoDiagnostic<'a>,